本文整理汇总了C#中XPClassInfo.FindMember方法的典型用法代码示例。如果您正苦于以下问题:C# XPClassInfo.FindMember方法的具体用法?C# XPClassInfo.FindMember怎么用?C# XPClassInfo.FindMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XPClassInfo
的用法示例。
在下文中一共展示了XPClassInfo.FindMember方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseMemberInfos
Dictionary<string, XPMemberInfo> BaseMemberInfos(XPClassInfo outputClassInfo) {
var members = ((InitialDataAttribute)outputClassInfo.FindAttributeInfo(typeof(InitialDataAttribute))).BaseMembers;
var xpMemberInfos = new Dictionary<string, XPMemberInfo>();
if (members != null) {
var baseMembers = members.Split(',');
foreach (var baseMember in baseMembers) {
var strings = baseMember.Split('|');
var xpMemberInfo = outputClassInfo.FindMember(strings[0]);
xpMemberInfos.Add(strings[strings.Length - 1], xpMemberInfo);
}
}
return xpMemberInfos;
}
示例2: GetXpMemberInfo
public static XPMemberInfo GetXpMemberInfo(XPClassInfo xpClassInfo, string propertyName, bool throwIfMissing) {
if (propertyName.IndexOf(".", StringComparison.Ordinal) > -1) {
XPMemberInfo info = xpClassInfo.FindMember(propertyName.Split(".".ToCharArray())[0]);
if (info != null) {
XPClassInfo type = info.ReferenceType;
if (info.IsAssociation && info.IsCollection && info.CollectionElementType != null)
type = info.CollectionElementType;
return GetXpMemberInfo(type, propertyName.Substring(propertyName.IndexOf(".", StringComparison.Ordinal) + 1), throwIfMissing);
}
return null;
}
XPMemberInfo xpMemberInfo = xpClassInfo.FindMember(propertyName);
if (xpMemberInfo == null && throwIfMissing)
throw new PropertyMissingException(xpClassInfo.FullName, propertyName);
return xpMemberInfo;
}
示例3: CreateKey
void CreateKey(XPClassInfo outputClassInfo, XPClassInfo classInfo) {
var initialDataAttribute = ((InitialDataAttribute) outputClassInfo.FindAttributeInfo(typeof (InitialDataAttribute)));
var inputKeyPropertyName = initialDataAttribute.InputKeyPropertyName;
if (!String.IsNullOrEmpty(inputKeyPropertyName) ) {
var member = classInfo.FindMember(inputKeyPropertyName);
if (member == null)
classInfo.CreateMember(inputKeyPropertyName, initialDataAttribute.inputKeyPropertyType).AddAttribute(new KeyAttribute(true));
else {
member.AddAttribute(new KeyAttribute(true));
}
}
else if (!HasKey(classInfo)) {
classInfo.CreateMember("Oid_" + classInfo.TableName, typeof(int)).AddAttribute(new KeyAttribute(true));
}
}
示例4: CreateMemberInfo
static XpandCustomMemberInfo CreateMemberInfo(IModelMemberEx modelMemberEx, XPClassInfo xpClassInfo) {
var calculatedMember = modelMemberEx as IModelMemberCalculated;
if (calculatedMember != null)
return xpClassInfo.CreateCalculabeMember(calculatedMember.Name, calculatedMember.Type, calculatedMember.AliasExpression);
var modelMemberOrphanedColection = modelMemberEx as IModelMemberOrphanedColection;
if (modelMemberOrphanedColection != null) {
return xpClassInfo.CreateCollection(modelMemberOrphanedColection.Name, modelMemberOrphanedColection.CollectionType.TypeInfo.Type,
modelMemberOrphanedColection.Criteria);
}
var modelMemberOneToManyCollection = modelMemberEx as IModelMemberOneToManyCollection;
if (modelMemberOneToManyCollection!=null) {
var elementType = modelMemberOneToManyCollection.CollectionType.TypeInfo.Type;
var associationAttribute = new AssociationAttribute(modelMemberOneToManyCollection.AssociationName, elementType);
var xpandCollectionMemberInfo = xpClassInfo.CreateCollection(modelMemberOneToManyCollection.Name, elementType, null, associationAttribute);
modelMemberOneToManyCollection.AssociatedMember.ModelClass.TypeInfo.FindMember(modelMemberOneToManyCollection.AssociatedMember.Name).AddAttribute(associationAttribute);
return xpandCollectionMemberInfo;
}
var modelMemberModelMember = modelMemberEx as IModelMemberModelMember;
if (modelMemberModelMember != null){
var memberInfo = ModelMemberModelMemberDomainLogic.Get_MemberInfo(modelMemberModelMember);
return (XpandCustomMemberInfo) xpClassInfo.FindMember(memberInfo.Name);
}
return xpClassInfo.CreateCustomMember(modelMemberEx.Name, modelMemberEx.Type, modelMemberEx is IModelMemberNonPersistent);
}