private XPMemberInfo CreateMemberInfo(ITypesInfo typesInfo, XPMemberInfo memberInfo, ProvidedAssociationAttribute providedAssociationAttribute, AssociationAttribute associationAttribute) { var typeToCreateOn = GetTypeToCreateOn(memberInfo, associationAttribute); if (typeToCreateOn == null) throw new NotImplementedException(); XPMemberInfo xpCustomMemberInfo; if (!(memberInfo.IsCollection) || (memberInfo.IsCollection && providedAssociationAttribute.RelationType == RelationType.ManyToMany)) { xpCustomMemberInfo = typesInfo.CreateCollection( typeToCreateOn, memberInfo.Owner.ClassType, associationAttribute.Name, XpandModuleBase.Dictiorary, providedAssociationAttribute.ProvidedPropertyName ?? memberInfo.Owner.ClassType.Name + "s", false); } else { xpCustomMemberInfo = typesInfo.CreateMember( typeToCreateOn, memberInfo.Owner.ClassType, associationAttribute.Name, XpandModuleBase.Dictiorary, providedAssociationAttribute.ProvidedPropertyName ?? memberInfo.Owner.ClassType.Name, false); } if (!string.IsNullOrEmpty(providedAssociationAttribute.AssociationName) && !memberInfo.HasAttribute(typeof(AssociationAttribute))) memberInfo.AddAttribute(new AssociationAttribute(providedAssociationAttribute.AssociationName)); typesInfo.RefreshInfo(typeToCreateOn); return xpCustomMemberInfo; }
void HideMemberInDetailView(XPMemberInfo xpMemberInfo) { if (!xpMemberInfo.HasAttribute(typeof(VisibleInDetailViewAttribute))) { xpMemberInfo.AddAttribute(new VisibleInDetailViewAttribute(false)); } }
public static void CreateForeignKey(this ConnectionProviderSql connectionProviderSql, XPMemberInfo xpMemberInfo, bool throwUnableToCreateDBObjectException = false) { if (xpMemberInfo.HasAttribute(typeof(AssociationAttribute))) { CallSchemaUpdateMethod(connectionProviderSql, CreateForeighKey(xpMemberInfo), throwUnableToCreateDBObjectException); } }
public static void ModifyModel(IModelMemberReminderInfo modelMemberReminderInfo, XPMemberInfo customMemberInfo) { var modelClass = modelMemberReminderInfo.ModelClass; var modelClassCreateExpandAbleMembers = modelClass as IModelClassCreateExpandAbleMembers; if (modelClassCreateExpandAbleMembers != null) { modelClassCreateExpandAbleMembers.CreateExpandAbleMembers = true; } if (!customMemberInfo.HasAttribute(typeof(ExpandObjectMembersAttribute))) { customMemberInfo.AddAttribute(new ExpandObjectMembersAttribute(ExpandObjectMembers.Always)); } }
string TruncateValue(XPMemberInfo xpMemberInfo, string value) { if (xpMemberInfo.HasAttribute(typeof(SizeAttribute))) { int size = ((SizeAttribute)xpMemberInfo.GetAttributeInfo(typeof(SizeAttribute))).Size; if (size > -1 && value.Length > size) { value = value.Substring(0, size - 1); } } else if (value.Length > 99) { value = value.Substring(0, 99); } return(value); }
bool MemberHasChanged(ISupportChangedMembers supportChangedMembers, XPMemberInfo m) { return m.HasAttribute(typeof(PersistentAttribute)) || m.IsKey || m is ServiceField || supportChangedMembers.ChangedProperties.Contains(m.Name); }
private XPMemberInfo CreateMemberInfo(ITypesInfo typesInfo, XPMemberInfo memberInfo, ProvidedAssociationAttribute providedAssociationAttribute, AssociationAttribute associationAttribute) { var typeToCreateOn = GetTypeToCreateOn(memberInfo, associationAttribute); if (typeToCreateOn == null) { throw new NotImplementedException(); } XPMemberInfo xpCustomMemberInfo; if (!(memberInfo.IsNonAssociationList) || (memberInfo.IsNonAssociationList && providedAssociationAttribute.RelationType == RelationType.ManyToMany)) { xpCustomMemberInfo = typesInfo.CreateCollection( typeToCreateOn, memberInfo.Owner.ClassType, associationAttribute.Name, XpandModuleBase.Dictiorary, providedAssociationAttribute.ProvidedPropertyName ?? memberInfo.Owner.ClassType.Name + "s", false); } else { xpCustomMemberInfo = typesInfo.CreateMember( typeToCreateOn, memberInfo.Owner.ClassType, associationAttribute.Name, XpandModuleBase.Dictiorary, providedAssociationAttribute.ProvidedPropertyName ?? memberInfo.Owner.ClassType.Name, false); } if (!string.IsNullOrEmpty(providedAssociationAttribute.AssociationName) && !memberInfo.HasAttribute(typeof(AssociationAttribute))) { memberInfo.AddAttribute(new AssociationAttribute(providedAssociationAttribute.AssociationName)); } typesInfo.RefreshInfo(typeToCreateOn); return(xpCustomMemberInfo); }
void HideMemberInDetailView(XPMemberInfo xpMemberInfo) { if (!xpMemberInfo.HasAttribute(typeof(VisibleInDetailViewAttribute))) xpMemberInfo.AddAttribute(new VisibleInDetailViewAttribute(false)); }
string TruncateValue(XPMemberInfo xpMemberInfo, string value) { if (xpMemberInfo.HasAttribute(typeof(SizeAttribute))) { int size = ((SizeAttribute)xpMemberInfo.GetAttributeInfo(typeof(SizeAttribute))).Size; if (size > -1 && value.Length > size) value = value.Substring(0, size - 1); } else if (value.Length > 99) value = value.Substring(0, 99); return value; }
bool MemberHasChanged(ISupportChangedMembers supportChangedMembers, XPMemberInfo m) { return(m.HasAttribute(typeof(PersistentAttribute)) || m.IsKey || m is ServiceField || supportChangedMembers.ChangedProperties.Contains(m.Name)); }