コード例 #1
0
 private void CustomizeAppearanceDemoObject(ITypeInfo ti)
 {
     if (ti != null)
     {
         IMemberInfo mi1 = ti.FindMember("HideSimpleLayoutItem");
         if (mi1 == null)
         {
             mi1 = ti.CreateMember("HideSimpleLayoutItem", typeof(bool));
             mi1.AddAttribute(new ImmediatePostDataAttribute());
             mi1.AddAttribute(new VisibleInListViewAttribute(false));
             mi1.AddAttribute(new VisibleInLookupListViewAttribute(false));
         }
         IMemberInfo mi2 = ti.FindMember("HideSimpleLayoutGroup");
         if (mi2 == null)
         {
             mi2 = ti.CreateMember("HideSimpleLayoutGroup", typeof(bool));
             mi2.AddAttribute(new ImmediatePostDataAttribute());
             mi2.AddAttribute(new VisibleInListViewAttribute(false));
             mi2.AddAttribute(new VisibleInLookupListViewAttribute(false));
         }
         IMemberInfo mi3 = ti.FindMember("HideTabPageGroup");
         if (mi3 == null)
         {
             mi3 = ti.CreateMember("HideTabPageGroup", typeof(bool));
             mi3.AddAttribute(new ImmediatePostDataAttribute());
             mi3.AddAttribute(new VisibleInListViewAttribute(false));
             mi3.AddAttribute(new VisibleInLookupListViewAttribute(false));
         }
     }
 }
コード例 #2
0
        public override void CustomizeTypesInfo(DevExpress.ExpressApp.DC.ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);

            ITypeInfo typeInfo1 = typesInfo.FindTypeInfo(typeof(PersistentObject1));

            typeInfo1.AddAttribute(new DevExpress.Persistent.Base.DefaultClassOptionsAttribute());

            IMemberInfo memberInfo0 = typeInfo1.FindMember("NewIntField");

            if (memberInfo0 == null)
            {
                typeInfo1.CreateMember("NewIntField", typeof(int));
            }

            ITypeInfo   typeInfo2   = typesInfo.FindTypeInfo(typeof(PersistentObject2));
            IMemberInfo memberInfo1 = typeInfo1.FindMember("PersistentObject2s");
            IMemberInfo memberInfo2 = typeInfo2.FindMember("PersistentObject1");

            if (memberInfo1 == null)
            {
                memberInfo1 = typeInfo1.CreateMember("PersistentObject2s", typeof(DevExpress.Xpo.XPCollection <PersistentObject2>));
                memberInfo1.AddAttribute(new DevExpress.Xpo.AssociationAttribute("PersistentObject1-PersistentObject2s", typeof(PersistentObject2)), true);
                memberInfo1.AddAttribute(new DevExpress.Xpo.AggregatedAttribute(), true);
            }
            if (memberInfo2 == null)
            {
                memberInfo2 = typeInfo2.CreateMember("PersistentObject1", typeof(PersistentObject1));
                memberInfo2.AddAttribute(new DevExpress.Xpo.AssociationAttribute("PersistentObject1-PersistentObject2s", typeof(PersistentObject1)), true);
            }

            typesInfo.RefreshInfo(typeof(PersistentObject1));
            typesInfo.RefreshInfo(typeof(PersistentObject2));
        }
コード例 #3
0
 private void CreateFields(ITypeInfo ClassInfo, XPCollection <BusinessObjectField> Fields)
 {
     foreach (BusinessObjectField businessObjectField in Fields)
     {
         var Member = ClassInfo.FindMember(businessObjectField.Name);
         if (Member == null)
         {
             if (businessObjectField.PrimitiveType != TypeCode.Empty)
             {
                 ClassInfo.CreateMember(businessObjectField.Name, GetTypeByTypeCode(businessObjectField.PrimitiveType));
             }
             else
             {
                 ClassInfo.CreateMember(businessObjectField.Name, Type.GetType(businessObjectField.CompiledModelClass.FullType, false));
             }
         }
     }
 }
コード例 #4
0
        protected virtual IMemberInfo OnCreateMember(ITypeInfo typeInfo, string name, Type propertyType)
        {
            IMemberInfo memberInfo = typeInfo.CreateMember(name, propertyType);

            if (memberInfo.MemberType == typeof(Type))
            {
                memberInfo.AddAttribute(new ValueConverterAttribute(typeof(TypeValueConverter)));
            }
            return(memberInfo);
        }
コード例 #5
0
 public static void CreateMember(ITypeInfo typeInfo , FilterProviderBase provider)
 {
     var attributes = new List<Attribute>{new BrowsableAttribute(false),new MemberDesignTimeVisibilityAttribute(
                                                                                                       false)};
     
     IMemberInfo member = typeInfo.CreateMember(provider.FilterMemberName, provider.FilterMemberType);
     if (provider.FilterMemberIndexed)
         attributes.Add(new IndexedAttribute());
     if (provider.FilterMemberSize!=SizeAttribute.DefaultStringMappingFieldSize)
         attributes.Add(new SizeAttribute(provider.FilterMemberSize));
     foreach (var attribute in attributes)
         member.AddAttribute(attribute);
 }
コード例 #6
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            //CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);
            ITypeInfo typeInfoDomainObject1 = XafTypesInfo.Instance.FindTypeInfo(typeof(PermissionPolicyUser));

            typeInfoDomainObject1.CreateMember("Color", typeof(Int32));
            IMemberInfo typeInfoDomainObject1Metadata = typeInfoDomainObject1.FindMember("Color");

            typeInfoDomainObject1Metadata.AddAttribute(new VisibleInReportsAttribute(false));
            typeInfoDomainObject1Metadata.AddAttribute(new VisibleInDetailViewAttribute(false));
            typeInfoDomainObject1Metadata.AddAttribute(new VisibleInListViewAttribute(false));
            typeInfoDomainObject1Metadata.AddAttribute(new VisibleInLookupListViewAttribute(false));

            typeInfoDomainObject1.CreateMember("Color2", typeof(Int32));
            IMemberInfo typeInfoDomainObject1Metadata2 = typeInfoDomainObject1.FindMember("Color2");

            typeInfoDomainObject1Metadata2.AddAttribute(new VisibleInReportsAttribute(false));
            typeInfoDomainObject1Metadata2.AddAttribute(new VisibleInDetailViewAttribute(false));
            typeInfoDomainObject1Metadata2.AddAttribute(new VisibleInListViewAttribute(false));
            typeInfoDomainObject1Metadata2.AddAttribute(new VisibleInLookupListViewAttribute(false));
        }
コード例 #7
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);
            ITypeInfo   userTypeInfo       = typesInfo.FindTypeInfo(typeof(PermissionPolicyUser));
            IMemberInfo userLoginsProperty = userTypeInfo.FindMember("UserLogins");

            if (userLoginsProperty == null)
            {
                userLoginsProperty = userTypeInfo.CreateMember("UserLogins", typeof(XPCollection <UserLoginInfo>));
                userLoginsProperty.AddAttribute(new DevExpress.Xpo.AssociationAttribute(typeof(UserLoginInfo)), true);
                userLoginsProperty.AddAttribute(new DevExpress.Xpo.AggregatedAttribute(), true);
                userLoginsProperty.AddAttribute(new VisibleInDetailViewAttribute(false), true);
                ITypeInfo userLoginTypeInfo = typesInfo.FindTypeInfo(typeof(UserLoginInfo));
                userLoginTypeInfo.FindMember("User").AddAttribute(new DevExpress.Xpo.AssociationAttribute(typeof(PermissionPolicyUser)), false);
                ((XafMemberInfo)userLoginsProperty).Refresh();
            }
        }
コード例 #8
0
        public static void CreateMember(ITypeInfo typeInfo, FilterProviderBase provider)
        {
            var attributes = new List <Attribute> {
                new BrowsableAttribute(false), new MemberDesignTimeVisibilityAttribute(
                    false)
            };

            IMemberInfo member = typeInfo.CreateMember(provider.FilterMemberName, provider.FilterMemberType);

            if (provider.FilterMemberIndexed)
            {
                attributes.Add(new IndexedAttribute());
            }
            if (provider.FilterMemberSize != SizeAttribute.DefaultStringMappingFieldSize)
            {
                attributes.Add(new SizeAttribute(provider.FilterMemberSize));
            }
            foreach (var attribute in attributes)
            {
                member.AddAttribute(attribute);
            }
        }
コード例 #9
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            ITypeInfo   typeInfo1   = typesInfo.FindTypeInfo(typeof(ExternalDocument));
            ITypeInfo   typeInfo2   = typesInfo.FindTypeInfo(typeof(ОбъектРемонта));
            IMemberInfo memberInfo1 = typeInfo1.FindMember("ОбъектРемонта");
            IMemberInfo memberInfo2 = typeInfo2.FindMember("ExternalDocument");

            if (memberInfo2 == null)
            {
                memberInfo2 = typeInfo2.CreateMember("ExternalDocument", typeof(XPCollection <ExternalDocument>));
                memberInfo2.AddAttribute(new DevExpress.Xpo.AssociationAttribute("A", typeof(ExternalDocument)), true);
                memberInfo2.AddAttribute(new DevExpress.Xpo.AggregatedAttribute(), true);
            }
            if (memberInfo1 == null)
            {
                memberInfo1 = typeInfo1.CreateMember("Asset", typeof(ОбъектРемонта));
                memberInfo1.AddAttribute(new DevExpress.Xpo.AssociationAttribute("A", typeof(ОбъектРемонта)), true);
                memberInfo1.AddAttribute(new DevExpress.Persistent.Base.ImmediatePostDataAttribute(), true);
            }

            ((XafMemberInfo)memberInfo1).Refresh();
            ((XafMemberInfo)memberInfo2).Refresh();

            if (typesInfo == null)
            {
                return;
            }
            ITypeInfo typeInfo;

            // В класс ОбъектРемонта добавляем свойство ExternalFactor
            // Ищем TypeInfo для класса Galaktika.EAM.Module.Активы.ОбъектРемонта
            typeInfo = typesInfo.FindTypeInfo(typeof(ОбъектРемонта));
            if (typeInfo != null)
            {
                // Для типа добавляем свойство Mass с типом decimal
                var exfProperty = typeInfo.CreateMember("ExternalFactor", typeof(decimal));
            }
        }
コード例 #10
0
 protected virtual IMemberInfo OnCreateMember(ITypeInfo typeInfo, string name, Type propertyType) {
     IMemberInfo memberInfo = typeInfo.CreateMember(name, propertyType);
     if (memberInfo.MemberType == typeof(Type))
         memberInfo.AddAttribute(new ValueConverterAttribute(typeof(TypeValueConverter)));
     return memberInfo;
 }