Esempio n. 1
0
 static void AddAttributes(IModelMemberEx modelMemberEx, XPCustomMemberInfo memberInfo)
 {
     if (modelMemberEx.Size != 0)
     {
         memberInfo.AddAttribute(new SizeAttribute(modelMemberEx.Size));
     }
     if (modelMemberEx is IModelMemberNonPersistent && !(modelMemberEx is IModelMemberCalculated))
     {
         memberInfo.AddAttribute(new NonPersistentAttribute());
     }
 }
Esempio n. 2
0
 static void AddAttributes(IModelRuntimeMember runtimeMember, XPCustomMemberInfo memberInfo)
 {
     if (runtimeMember.Size != 0)
     {
         memberInfo.AddAttribute(new SizeAttribute(runtimeMember.Size));
     }
     if (runtimeMember is IModelRuntimeNonPersistentMember && !(runtimeMember is IModelRuntimeCalculatedMember))
     {
         memberInfo.AddAttribute(new NonPersistentAttribute());
     }
 }
 private void addAttributes(IMemberInfo memberInfo, AssociationAttribute associationAttribute, ProvidedAssociationAttribute providedAssociationAttribute, XPCustomMemberInfo customMemberInfo)
 {
     customMemberInfo.AddAttribute(getAssociationAttribute(customMemberInfo.IsCollection, memberInfo.Owner.Type,associationAttribute.Name));
     if (providedAssociationAttribute.AttributesFactoryProperty != null){
         var property = memberInfo.Owner.Type.GetProperty(providedAssociationAttribute.AttributesFactoryProperty, BindingFlags.Static|BindingFlags.Public);
         if (property== null)
             throw new NullReferenceException(string.Format("Static propeprty {0} not found at {1}", providedAssociationAttribute.GetPropertyInfo(x=>x.AttributesFactoryProperty).Name, memberInfo.Owner.Type.FullName));
         var values = (IEnumerable<Attribute>) property.GetValue(null, null);
         foreach (Attribute attribute in values){
             customMemberInfo.AddAttribute(attribute);
         }
     }
 }
 static void CreateAttributes(IExtendedMemberInfo extendedMemberInfo, XPCustomMemberInfo memberInfo)
 {
     foreach (AttributeInfoAttribute attributeInfo in extendedMemberInfo.TypeAttributes.Select(typeAttribute => typeAttribute.Create()))
     {
         memberInfo.AddAttribute((Attribute)ReflectionHelper.CreateObject(attributeInfo.Constructor.DeclaringType, attributeInfo.InitializedArgumentValues));
     }
 }
 private void createAttributes(IExtendedMemberInfo extendedMemberInfo, XPCustomMemberInfo customMemberInfo)
 {
     foreach (IPersistentAttributeInfo typeAttribute in extendedMemberInfo.TypeAttributes){
         AttributeInfo attributeInfo = typeAttribute.Create();
         customMemberInfo.AddAttribute((Attribute)Activator.CreateInstance(attributeInfo.Constructor.DeclaringType, attributeInfo.InitializedArgumentValues[0], ReflectionHelper.GetType(attributeInfo.InitializedArgumentValues[2] as string)));
     }
 }
Esempio n. 6
0
 void AddExtraAttributes(XPMemberInfo memberInfo, ProvidedAssociationAttribute providedAssociationAttribute, XPCustomMemberInfo customMemberInfo)
 {
     if (!(string.IsNullOrEmpty(providedAssociationAttribute.AttributesFactoryProperty)))
     {
         foreach (var attribute in GetAttributes(providedAssociationAttribute.AttributesFactoryProperty, memberInfo.Owner))
         {
             customMemberInfo.AddAttribute(attribute);
         }
     }
 }
 public DynamicDataTableClassInfo(XPDictionary dictionary, DataTable table)
     : base(dictionary)
 {
     if (table.PrimaryKey.Length != 1)
     {
         throw new NotSupportedException();
     }
     baseClassCore = dictionary.QueryClassInfo(typeof(XPDataTableObject));
     tableNameCore = table.TableName;
     foreach (DataColumn column in table.Columns)
     {
         XPCustomMemberInfo member = CreateMember(column.Caption, column.DataType);
         member.AddAttribute(new PersistentAttribute(column.ColumnName));
         member.AddAttribute(new DisplayNameAttribute(column.Caption));
         if (table.PrimaryKey[0] == column)
         {
             member.AddAttribute(new KeyAttribute(column.AutoIncrement));
         }
     }
     dictionary.AddClassInfo(this);
 }
Esempio n. 8
0
        public static XPCustomMemberInfo CreateMember(this ITypesInfo typesInfo, Type typeToCreateOn, Type typeOfMember, string associationName, XPDictionary dictionary, string propertyName, bool refreshTypesInfo)
        {
            XPCustomMemberInfo member = null;

            if (typeIsRegister(typesInfo, typeToCreateOn))
            {
                XPClassInfo xpClassInfo = dictionary.GetClassInfo(typeToCreateOn);
                if (xpClassInfo.FindMember(propertyName) == null)
                {
                    member = xpClassInfo.CreateMember(propertyName, typeOfMember);
                    member.AddAttribute(new AssociationAttribute(associationName));

                    if (refreshTypesInfo)
                    {
                        typesInfo.RefreshInfo(typeToCreateOn);
                    }
                }
            }
            return(member);
        }
Esempio n. 9
0
        static XPCustomMemberInfo CreateCollection(this ITypesInfo typeInfo, Type typeToCreateOn, Type typeOfCollection, string associationName, XPDictionary dictionary, string collectionName, bool refreshTypesInfo,
                                                   bool isManyToMany)
        {
            XPCustomMemberInfo member = null;

            if (typeIsRegister(typeInfo, typeToCreateOn))
            {
                XPClassInfo xpClassInfo = dictionary.GetClassInfo(typeToCreateOn);
                if (xpClassInfo.FindMember(collectionName) == null)
                {
                    member = xpClassInfo.CreateMember(collectionName, typeof(XPCollection), true);
                    member.AddAttribute(new AssociationAttribute(associationName, typeOfCollection)
                    {
                        UseAssociationNameAsIntermediateTableName = isManyToMany
                    });

                    if (refreshTypesInfo)
                    {
                        typeInfo.RefreshInfo(typeToCreateOn);
                    }
                }
            }
            return(member);
        }
 public void CreateAttributes(IExtendedMemberInfo extendedMemberInfo, XPCustomMemberInfo memberInfo) {
     foreach (AttributeInfoAttribute attributeInfo in extendedMemberInfo.TypeAttributes.Select(typeAttribute => typeAttribute.Create())) {
         memberInfo.AddAttribute((Attribute)ReflectionHelper.CreateObject(attributeInfo.Constructor.DeclaringType, attributeInfo.InitializedArgumentValues));
     }
 }
 public void CreateAttributes(IExtendedMemberInfo extendedMemberInfo, XPCustomMemberInfo customMemberInfo) {
     foreach (AttributeInfo attributeInfo in extendedMemberInfo.TypeAttributes.Select(typeAttribute => typeAttribute.Create())) {
         customMemberInfo.AddAttribute((Attribute)Activator.CreateInstance(attributeInfo.Constructor.DeclaringType,attributeInfo.InitializedArgumentValues));
     }
 }
Esempio n. 12
0
 static void AddAttributes(IModelRuntimeMember runtimeMember, XPCustomMemberInfo memberInfo) {
     if (runtimeMember.Size != 0)
         memberInfo.AddAttribute(new SizeAttribute(runtimeMember.Size));
     if (runtimeMember is IModelRuntimeNonPersistentMember && !(runtimeMember is IModelRuntimeCalculatedMember))
         memberInfo.AddAttribute(new NonPersistentAttribute());
 }
Esempio n. 13
0
 static void AddAttributes(IModelMemberEx modelMemberEx, XPCustomMemberInfo memberInfo) {
     if (modelMemberEx.Size != 0)
         memberInfo.AddAttribute(new SizeAttribute(modelMemberEx.Size));
     if (modelMemberEx is IModelMemberNonPersistent && !(modelMemberEx is IModelMemberCalculated))
         memberInfo.AddAttribute(new NonPersistentAttribute());
 }
 void AddExtraAttributes(XPMemberInfo memberInfo, ProvidedAssociationAttribute providedAssociationAttribute, XPCustomMemberInfo customMemberInfo) {
     if (!(string.IsNullOrEmpty(providedAssociationAttribute.AttributesFactoryProperty)))
         foreach (var attribute in GetAttributes(providedAssociationAttribute.AttributesFactoryProperty, memberInfo.Owner)) {
             customMemberInfo.AddAttribute(attribute);
         }
 }