コード例 #1
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);

            if (Executed("CustomizeTypesInfo"))
            {
                return;
            }
            foreach (var memberInfo in typesInfo.PersistentTypes.SelectMany(info => info.Members).Where(info => info.FindAttribute <InvisibleInAllViewsAttribute>() != null))
            {
                memberInfo.AddAttribute(new VisibleInDetailViewAttribute(false));
                memberInfo.AddAttribute(new VisibleInListViewAttribute(false));
                memberInfo.AddAttribute(new VisibleInLookupListViewAttribute(false));
            }

            AssignSecurityEntities();
            ITypeInfo findTypeInfo = typesInfo.FindTypeInfo(typeof(IModelMember));
            var       type         = (BaseInfo)findTypeInfo.FindMember("Type");

            var attribute = type.FindAttribute <ModelReadOnlyAttribute>();

            if (attribute != null)
            {
                type.RemoveAttribute(attribute);
            }

            type      = (BaseInfo)typesInfo.FindTypeInfo(typeof(IModelBOModelClassMembers));
            attribute = type.FindAttribute <ModelReadOnlyAttribute>();
            if (attribute != null)
            {
                type.RemoveAttribute(attribute);
            }
        }
コード例 #2
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     if (Application != null) {
         typesInfo.FindTypeInfo(typeof(ShowInAnalysisPermission)).FindMember("ControllerType").AddAttribute(new VisibleInDetailViewAttribute(false));
         typesInfo.FindTypeInfo(typeof(PivotSettingsPermission)).FindMember("ControllerType").AddAttribute(new VisibleInDetailViewAttribute(false));
     }
 }
コード例 #3
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            CustomizeAppearanceDemoObject(typesInfo.FindTypeInfo(typeof(FeatureCenter.Module.ConditionalAppearance.ConditionalAppearanceHideShowEditorsObject)));
            ITypeInfo typeInfo = typesInfo.FindTypeInfo(typeof(FeatureCenter.Module.Messages.Messages));

            typeInfo.FindMember("Win").AddAttribute(new ExpandObjectMembersAttribute(ExpandObjectMembers.InDetailView));
            typeInfo.FindMember("Web").AddAttribute(new ExpandObjectMembersAttribute(ExpandObjectMembers.InDetailView));
        }
コード例 #4
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo)
 {
     base.CustomizeTypesInfo(typesInfo);
     if (Application != null)
     {
         typesInfo.FindTypeInfo(typeof(ShowInAnalysisPermission)).FindMember("ControllerType").AddAttribute(new VisibleInDetailViewAttribute(false));
         typesInfo.FindTypeInfo(typeof(PivotSettingsPermission)).FindMember("ControllerType").AddAttribute(new VisibleInDetailViewAttribute(false));
     }
 }
コード例 #5
0
ファイル: Extensions.cs プロジェクト: egarim/XpoExtenderDemo
 public static void AddXpoExtenderDefaultClassOptions(this ITypesInfo TypeInfo)
 {
     TypeInfo.FindTypeInfo(typeof(ExtendedModel)).AddAttribute(new DefaultClassOptionsAttribute());
     //TypeInfo.FindTypeInfo(typeof(Process)).AddAttribute(new DefaultClassOptionsAttribute());
     TypeInfo.FindTypeInfo(typeof(CompiledModel)).AddAttribute(new DefaultClassOptionsAttribute());
     TypeInfo.FindTypeInfo(typeof(CompiledModelClass)).AddAttribute(new DefaultClassOptionsAttribute());
     //TypeInfo.FindTypeInfo(typeof(BusinessObjectField)).AddAttribute(new DefaultClassOptionsAttribute());
     //TypeInfo.FindTypeInfo(typeof(BusinessObjectExtension)).AddAttribute(new DefaultClassOptionsAttribute());
 }
コード例 #6
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);

            var dfco = new DefaultClassOptionsAttribute();

            typesInfo.FindTypeInfo(typeof(DbDiagnosis)).AddAttribute(dfco);
            typesInfo.FindTypeInfo(typeof(DbTemporaryExposureKey)).AddAttribute(dfco);
        }
コード例 #7
0
ファイル: NHEntityStore.cs プロジェクト: xwagner2/eXpand
        public void RegisterEntity(Type type)
        {
            types.Add(type);
            TypeInfo typeInfo = (TypeInfo)typesInfo.FindTypeInfo(type);

            typeInfo.Source       = this;
            typeInfo.IsPersistent = Metadata.Any(tm => tm.Type == type);

            typeInfo.Refresh();
            typeInfo.RefreshMembers();
        }
コード例 #8
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);
            var CustomerTypeInfo = typesInfo.FindTypeInfo(typeof(Customer));

            CustomerTypeInfo.AddAttribute(new DefaultClassOptionsAttribute());
            var InvoiceTypeInfo = typesInfo.FindTypeInfo(typeof(Invoice));

            InvoiceTypeInfo.AddAttribute(new DefaultClassOptionsAttribute());
        }
コード例 #9
0
 public static IJobDetail StoreJob(this IScheduler scheduler, IXpandJobDetail xpandJobDetail,ITypesInfo typesInfo) {
     var jobDetail = (JobDetailImpl)(scheduler.GetJobDetail(xpandJobDetail) ?? xpandJobDetail.CreateQuartzJobDetail());
     jobDetail.AssignXpandJobDetail(xpandJobDetail);
     var typeInfo = typesInfo.FindTypeInfo(xpandJobDetail.JobDataMap.GetType());
     jobDetail.AssignDataMap(typeInfo, xpandJobDetail.JobDataMap);
     if (xpandJobDetail.Job.DataMap != null) {
         typeInfo = typesInfo.FindTypeInfo(xpandJobDetail.Job.DataMap.GetType());
         jobDetail.AssignDataMap(typeInfo, xpandJobDetail.Job.DataMap);
     }
     scheduler.StoreJobCore(jobDetail);
     return jobDetail;
 }
コード例 #10
0
ファイル: XpandModuleBase.cs プロジェクト: maxx1337/eXpand
        public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
            base.CustomizeTypesInfo(typesInfo);
            OnApplicationInitialized(Application);
            var type = (BaseInfo)typesInfo.FindTypeInfo(typeof(IModelMember)).FindMember("Type");
            var attribute = type.FindAttribute<ModelReadOnlyAttribute>();
            if (attribute != null)
                type.RemoveAttribute(attribute);

            type = (BaseInfo)typesInfo.FindTypeInfo(typeof(IModelBOModelClassMembers));
            attribute = type.FindAttribute<ModelReadOnlyAttribute>();
            if (attribute != null)
                type.RemoveAttribute(attribute);
        }
コード例 #11
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);

            //typesInfo.LoadTypes(Assembly.LoadFrom("MySolution.Module.D2.dll"));

            //typesInfo.RefreshInfo(typeof(Employee));

            typesInfo.FindTypeInfo(typeof(Task)).AddAttribute(new DefaultClassOptionsAttribute());
            typesInfo.FindTypeInfo(typeof(Employee)).AddAttribute(new DefaultClassOptionsAttribute());

            //typesInfo.RefreshInfo(typeof(Task));
        }
コード例 #12
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            if (Executed("CustomizeTypesInfo"))
            {
                return;
            }
            if (RuntimeMode)
            {
                foreach (var persistentType in typesInfo.PersistentTypes)
                {
                    CreateAttributeRegistratorAttributes(persistentType);
                }
            }
            CreateXpandDefaultProperty(typesInfo);
            ModelValueOperator.Register();
            foreach (var memberInfo in typesInfo.PersistentTypes.SelectMany(info => info.Members).Where(info => info.FindAttribute <InvisibleInAllViewsAttribute>() != null).ToList())
            {
                memberInfo.AddAttribute(new VisibleInDetailViewAttribute(false));
                memberInfo.AddAttribute(new VisibleInListViewAttribute(false));
                memberInfo.AddAttribute(new VisibleInLookupListViewAttribute(false));
            }

            AssignSecurityEntities();
            ITypeInfo findTypeInfo = typesInfo.FindTypeInfo(typeof(IModelMember));
            var       type         = (BaseInfo)findTypeInfo.FindMember("Type");

            var attribute = type.FindAttribute <ModelReadOnlyAttribute>();

            if (attribute != null)
            {
                type.RemoveAttribute(attribute);
            }

            type      = (BaseInfo)typesInfo.FindTypeInfo(typeof(IModelBOModelClassMembers));
            attribute = type.FindAttribute <ModelReadOnlyAttribute>();
            if (attribute != null)
            {
                type.RemoveAttribute(attribute);
            }

            if (!SequenceGenerator.UseGuidKey)
            {
                var typeInfo   = typesInfo.FindTypeInfo(SequenceObjectType);
                var memberInfo = (BaseInfo)typeInfo.FindMember("Oid");
                memberInfo.RemoveAttribute(new KeyAttribute(false));
                memberInfo = (BaseInfo)typeInfo.FindMember <ISequenceObject>(o => o.TypeName);
                memberInfo.AddAttribute(new KeyAttribute(false));
            }
        }
コード例 #13
0
        /// <summary>
        /// Creates the model builder.
        /// </summary>
        /// <typeparam name="TModelBuilder">The type of the t model builder.</typeparam>
        /// <param name="typesInfo">The types information.</param>
        /// <returns>TModelBuilder.</returns>
        /// <exception cref="InvalidOperationException">Cannot create ModelBuilder of Type '{typeof(TModelBuilder)}' because the base generic type can not be found</exception>
        /// <exception cref="InvalidOperationException">Cannot create ModelBuilder of Type '{typeof(TModelBuilder)}' because no TypeInfo for Type '{builderForType}' could be found</exception>
        /// <autogeneratedoc />
        public static TModelBuilder CreateModelBuilder <TModelBuilder>(this ITypesInfo typesInfo)
        {
            _ = typesInfo ?? throw new ArgumentNullException(nameof(typesInfo));

            var modelTypeForBuilder = typeof(TModelBuilder).BaseType?.GenericTypeArguments.FirstOrDefault();

            if (modelTypeForBuilder == null)
            {
                throw new InvalidOperationException($"Cannot create ModelBuilder of Type '{typeof(TModelBuilder)}' because the base generic type can not be found");
            }

            var typeInfo = typesInfo.FindTypeInfo(modelTypeForBuilder);

            if (typeInfo == null)
            {
                throw new InvalidOperationException($"Cannot create ModelBuilder of Type '{typeof(TModelBuilder)}' because no TypeInfo for Type '{modelTypeForBuilder}' could be found");
            }

            var builder = Activator.CreateInstance(typeof(TModelBuilder), typeInfo);

            if (builder is TModelBuilder tModelBuilder)
            {
                return(tModelBuilder);
            }

            throw new InvalidOperationException($"Created builder type '{builder!.GetType()}' is not of expected type {typeof(TModelBuilder)}");
        }
コード例 #14
0
ファイル: Epay3Module.cs プロジェクト: gokcer/epay-server
 public override void CustomizeTypesInfo(ITypesInfo typesInfo)
 {
     base.CustomizeTypesInfo(typesInfo);
     CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);
     // hide oid fields. (armikom) https://www.devexpress.com/Support/Center/Question/Details/T516783/hide-oid-on-xaf-xpobject-screens
     typesInfo.FindTypeInfo(typeof(XPObject)).KeyMember.AddAttribute(new BrowsableAttribute(false));
 }
コード例 #15
0
ファイル: Module.cs プロジェクト: GIsidori/Soluzione-xMax
 public override void CustomizeTypesInfo(ITypesInfo typesInfo)
 {
     base.CustomizeTypesInfo(typesInfo);
     CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);
     //Se non commento la seguente riga di codice, il comando UpdateModel su moduli Win e Web va in errore....
     typesInfo.FindTypeInfo(typeof(XPObject)).KeyMember.AddAttribute(new BrowsableAttribute(false));
 }
コード例 #16
0
        private void UpdateSchemaInternal(ITypesInfo typesInfo)
        {
            List <BusinessObjectExtension> NewTypes = new List <BusinessObjectExtension>();
            var UoW = XpoHelper.CreateUnitOfWork();
            Dictionary <XPClassInfo, XPCollection <BusinessObjectField> > DynamicClasses = new Dictionary <XPClassInfo, XPCollection <BusinessObjectField> >();
            var Model = UoW.Query <ExtendedModel>().FirstOrDefault(model => model.Name == ModelName);

            if (Model == null)
            {
                Debug.WriteLine($"Model {ModelName} not found");
                return;
            }

            XPDictionary dictionary = new ReflectionDictionary();
            XPClassInfo  BaseClass  = dictionary.GetClassInfo(typeof(BaseObject));

            foreach (BusinessObjectExtension businessObjectExtension in Model.BusinessObjectExtensions)
            {
                if (!String.IsNullOrEmpty(businessObjectExtension.Type))
                {
                    ITypeInfo ClassInfo = typesInfo.FindTypeInfo(businessObjectExtension.Type);
                    CreateFields(ClassInfo, businessObjectExtension.BusinessObjectFields);
                }
            }
        }
コード例 #17
0
ファイル: XpandListView.cs プロジェクト: paulute/eXpand
 void UpdateLayoutManager(ITypesInfo typesInfo) {
     if (!(LayoutManager is ILayoutManager)) {
         var typeInfo = ReflectionHelper.FindTypeDescendants(typesInfo.FindTypeInfo(typeof(ILayoutManager))).FirstOrDefault();
         if (typeInfo != null)
             this.SetPropertyInfoBackingFieldValue(view => view.LayoutManager, this, ReflectionHelper.CreateObject(typeInfo.Type));
     }
 }
コード例 #18
0
 void CreateMembers(ITypesInfo typesInfo, Type optionsType, Type persistentType) {
     ITypeInfo typeInfo = typesInfo.FindTypeInfo(ReflectionHelper.GetType(persistentType.Name));
     IEnumerable<PropertyInfo> propertyInfos = optionsType.GetProperties().Where(info => info.GetSetMethod() != null).Where(propertyInfo => typeInfo.FindMember(propertyInfo.Name) == null);
     foreach (PropertyInfo propertyInfo in propertyInfos) {
         OnCreateMember(typeInfo, propertyInfo.Name, propertyInfo.PropertyType);
     }
 }
コード例 #19
0
        void HandleCustomAttribute(IMemberInfo memberInfo, ITypesInfo typesInfo)
        {
            var customAttributes = memberInfo.FindAttributes <Attribute>().OfType <ICustomAttribute>().ToList();

            foreach (var customAttribute in customAttributes)
            {
                for (int index = 0; index < customAttribute.Name.Split(';').Length; index++)
                {
                    string s        = customAttribute.Name.Split(';')[index];
                    var    theValue = customAttribute.Value.Split(';')[index];
                    var    typeInfo = typesInfo.FindTypeInfo(theValue);
                    if (customAttribute is PropertyEditorAttribute && typeInfo.IsInterface)
                    {
                        try {
                            theValue = typeInfo.Implementors.Single().FullName;
                        }
                        catch (InvalidOperationException) {
                            if (Application != null)
                            {
                                throw new InvalidOperationException(typeInfo.FullName + " has no implementors");
                            }
                        }
                    }
                    memberInfo.AddAttribute(new CustomAttribute(s, theValue));
                }
            }
        }
コード例 #20
0
ファイル: TypesInfoExtensions.cs プロジェクト: xyyhqq/eXpand
        public static Type FindBussinessObjectType(this ITypesInfo typesInfo, Type type)
        {
            if (!(type.IsInterface))
            {
                return(type);
            }
            var implementors = typesInfo.FindTypeInfo(type).Implementors.ToArray();
            var objectType   = implementors.FirstOrDefault();

            if (objectType == null)
            {
                throw new ArgumentException("Add a business object that implements " +
                                            type.FullName + " at your AdditionalBusinessClasses (module.designer.cs)");
            }
            if (implementors.Length > 1)
            {
                var typeInfos = implementors.Where(implementor => implementor.Base != null && !(type.IsAssignableFrom(implementor.Base.Type)));
                foreach (ITypeInfo implementor in typeInfos)
                {
                    return(implementor.Type);
                }

                throw new ArgumentNullException("More than 1 objects implement " + type.FullName);
            }
            return(objectType.Type);
        }
コード例 #21
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            ITypeInfo typeInfo = typesInfo.FindTypeInfo(typeof(T));

            typeInfo.AddAttribute(Expression(), new TypeConverterAttribute(typeof(TReferenceConverter)));
        }
コード例 #22
0
ファイル: SchedulerExtensions.cs プロジェクト: xyyhqq/eXpand
        public static IJobDetail StoreJob(this IScheduler scheduler, IXpandJobDetail xpandJobDetail, ITypesInfo typesInfo)
        {
            var jobDetail = (JobDetailImpl)(scheduler.GetJobDetail(xpandJobDetail) ?? xpandJobDetail.CreateQuartzJobDetail());

            jobDetail.AssignXpandJobDetail(xpandJobDetail);
            var typeInfo = typesInfo.FindTypeInfo(xpandJobDetail.JobDataMap.GetType());

            jobDetail.AssignDataMap(typeInfo, xpandJobDetail.JobDataMap);
            if (xpandJobDetail.Job.DataMap != null)
            {
                typeInfo = typesInfo.FindTypeInfo(xpandJobDetail.Job.DataMap.GetType());
                jobDetail.AssignDataMap(typeInfo, xpandJobDetail.Job.DataMap);
            }
            scheduler.StoreJobCore(jobDetail);
            return(jobDetail);
        }
コード例 #23
0
ファイル: XpandSecurityModule.cs プロジェクト: Raoulwe/eXpand
 void CreateMember(ITypesInfo typesInfo, IRoleTypeProvider roleTypeProvider, SecurityOperationsAttribute attribute) {
     var roleTypeInfo = typesInfo.FindTypeInfo(roleTypeProvider.RoleType);
     if (roleTypeInfo.FindMember(attribute.OperationProviderProperty) == null) {
         var memberInfo = roleTypeInfo.CreateMember(attribute.OperationProviderProperty, typeof(SecurityOperationsEnum));
         memberInfo.AddAttribute(new RuleRequiredFieldAttribute());
     }
 }
コード例 #24
0
        void HandleCustomAttribute(IMemberInfo memberInfo, ITypesInfo typesInfo)
        {
            var customAttributes = memberInfo.FindAttributes <Attribute>().OfType <ICustomAttribute>().ToList();

            foreach (var customAttribute in customAttributes)
            {
                for (int index = 0; index < customAttribute.Name.Split(';').Length; index++)
                {
                    string s        = customAttribute.Name.Split(';')[index];
                    var    theValue = customAttribute.Value.Split(';')[index];
                    var    typeInfo = typesInfo.FindTypeInfo(theValue);
                    if (customAttribute is PropertyEditorAttribute && typeInfo.IsInterface)
                    {
                        if (!typeInfo.Implementors.Any())
                        {
                            if (Application != null)
                            {
                                throw new InvalidOperationException(typeInfo.FullName + " has no implementors");
                            }
                        }
                        else
                        {
                            var single = typeInfo.Implementors.Single(info => !info.FindAttribute <DevExpress.ExpressApp.Editors.PropertyEditorAttribute>().IsDefaultEditor);
                            theValue = single.Type.FullName;
                        }
                    }
                    memberInfo.AddAttribute(new ModelDefaultAttribute(s, theValue));
                }
            }
        }
コード例 #25
0
ファイル: Module.cs プロジェクト: plcode7/TypeInfoDemo
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);

            ITypeInfo ClienteTypeInfo = typesInfo.FindTypeInfo(typeof(Cliente));

            if (ClienteTypeInfo != null)
            {
                ClienteTypeInfo.AddAttribute(new DefaultClassOptionsAttribute());
                ClienteTypeInfo.AddAttribute(new ModelDefaultAttribute("Caption", "Clase de Cliente"));
                AppearanceAttribute attribute = new AppearanceAttribute("Back Color Red");

                attribute.TargetItems = "*";
                attribute.BackColor   = "Red";

                ClienteTypeInfo.AddAttribute(attribute);

                var NombreMemberInfo = ClienteTypeInfo.OwnMembers.Where(m => m.Name == "Nombre").FirstOrDefault();
                if (NombreMemberInfo != null)
                {
                    NombreMemberInfo.AddAttribute(new RuleRequiredFieldAttribute("Nombre es requerido", DefaultContexts.Save));
                }
            }
        }
コード例 #26
0
ファイル: TypesInfoExtensions.cs プロジェクト: xyyhqq/eXpand
        public static IEnumerable <ITypeInfo> DomainSealedInfos(this ITypesInfo typesInfo, Type type)
        {
            var typeInfo  = typesInfo.FindTypeInfo(type);
            var infos     = typeInfo.IsInterface ? typeInfo.Implementors : typeInfo.Descendants;
            var typeInfos = infos.Where(info => !info.IsAbstract).Reverse().ToArray();

            return(typeInfos.Except(typeInfos.SelectMany(BaseInfos)));
        }
コード例 #27
0
        public void Init()
        {
            _TypesInfo = A.Fake <ITypesInfo>();
            _TypeInfo  = A.Fake <ITypeInfo>();
            A.CallTo(() => _TypesInfo.FindTypeInfo(A <Type> .Ignored)).Returns(_TypeInfo);

            _Builder = ModelBuilder.Create <TargetClass>(_TypesInfo);
        }
コード例 #28
0
ファイル: LogicModule.cs プロジェクト: aries544/eXpand
 void AddNewObjectCreateGroup(ITypesInfo typesInfo, IEnumerable<Type> types) {
     foreach (var type in types) {
         var typeDescendants = ReflectionHelper.FindTypeDescendants(typesInfo.FindTypeInfo(type));
         foreach (var typeInfo in typeDescendants) {
             typeInfo.AddAttribute(new NewObjectCreateGroupAttribute("Logic"));
         }
     }
 }
コード例 #29
0
ファイル: Module.cs プロジェクト: derjabkin/eXpand
 private void SetAdditionalExportedTypesProperties(ITypesInfo typesInfo)
 {
     foreach (var type in AdditionalExportedTypes)
     {
         var typeInfo = (TypeInfo)typesInfo.FindTypeInfo(type);
         typeInfo.IsDomainComponent = true;
     }
 }
コード例 #30
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);
            var contactTypeInfo = typesInfo.FindTypeInfo(typeof(Contact));

            contactTypeInfo.AddAttribute(new DefaultClassOptionsAttribute());
        }
        public void Init()
        {
            _TypesInfo = A.Fake<ITypesInfo>();
            _TypeInfo = A.Fake<ITypeInfo>();
            A.CallTo(() => _TypesInfo.FindTypeInfo(A<Type>.Ignored)).Returns(_TypeInfo);

            _Builder = ModelBuilder.Create<TargetClass>(_TypesInfo);
        }
コード例 #32
0
        void CreateMember(ITypesInfo typesInfo, IRoleTypeProvider roleTypeProvider, SecurityOperationsAttribute attribute)
        {
            var roleTypeInfo = typesInfo.FindTypeInfo(roleTypeProvider.RoleType);

            if (roleTypeInfo.FindMember(attribute.OperationProviderProperty) == null)
            {
                roleTypeInfo.CreateMember(attribute.OperationProviderProperty, typeof(SecurityOperationsEnum));
            }
        }
コード例 #33
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();
            }
        }
コード例 #34
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     if (Application == null)
         return;
     typesInfo.FindTypeInfo(TypesInfo.AnalysisType).AddAttribute(new DefaultPropertyAttribute("Name"));
     foreach (var keyValuePair in GetOptionsMapperDictionary()) {
         CreateMembers(typesInfo, keyValuePair.Key, keyValuePair.Value);
     }
 }
コード例 #35
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     if (Debugger.IsAttached) {
         IEnumerable<XPClassInfo> collection = XafTypesInfo.XpoTypeInfoSource.XPDictionary.Classes.Cast<XPClassInfo>();
         foreach (var typeInfo in collection)
             if (typeInfo.HasAttribute(typeof(RuleCombinationOfPropertiesIsUniqueAttribute)))
                 if (typesInfo.FindTypeInfo(typeInfo.ClassType).DefaultMember == null)
                     throw new NullReferenceException("DefaultMember of " + typeInfo.FullName + " is null");
     }
 }
コード例 #36
0
ファイル: Extensions.cs プロジェクト: egarim/XpoExtenderDemo
 public static void XafExtenderRegisterTypes(this ITypesInfo TypeInfo, IEnumerable <Type> types)
 {
     DevExpress.ExpressApp.DC.TypeInfo MyDynamicType;
     foreach (Type type in types)
     {
         MyDynamicType = (DevExpress.ExpressApp.DC.TypeInfo)TypeInfo.FindTypeInfo(type);
         MyDynamicType.RemoveAttributes <NonPersistentAttribute>();
         TypeInfo.RefreshInfo(type);
     }
 }
コード例 #37
0
        void CreateMembers(ITypesInfo typesInfo, Type optionsType, Type persistentType)
        {
            ITypeInfo typeInfo = typesInfo.FindTypeInfo(ReflectionHelper.GetType(persistentType.Name));
            IEnumerable <PropertyInfo> propertyInfos = optionsType.GetProperties().Where(info => info.GetSetMethod() != null).Where(propertyInfo => typeInfo.FindMember(propertyInfo.Name) == null);

            foreach (PropertyInfo propertyInfo in propertyInfos)
            {
                OnCreateMember(typeInfo, propertyInfo.Name, propertyInfo.PropertyType);
            }
        }
コード例 #38
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     var typeInfo = typesInfo.FindTypeInfo<XpoStateMachine>();
     typeInfo.CreateMember(EnableFilteredPropety, typeof (bool));
     if (!RuntimeMode) {
         CreateDesignTimeCollection(typesInfo, typeof(XpoStateMachine), AdminRoles);
     } else if (Application.CanBuildSecurityObjects()) {
         BuildSecuritySystemObjects();
     }
 }
コード例 #39
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            OnApplicationInitialized(Application);
            var type      = (BaseInfo)typesInfo.FindTypeInfo(typeof(IModelMember)).FindMember("Type");
            var attribute = type.FindAttribute <ModelReadOnlyAttribute>();

            if (attribute != null)
            {
                type.RemoveAttribute(attribute);
            }

            type      = (BaseInfo)typesInfo.FindTypeInfo(typeof(IModelBOModelClassMembers));
            attribute = type.FindAttribute <ModelReadOnlyAttribute>();
            if (attribute != null)
            {
                type.RemoveAttribute(attribute);
            }
        }
コード例 #40
0
        static void AddKnownTypesFor <T>(ITypesInfo typesInfo)
        {
            var typeInfos = typesInfo.FindTypeInfo <T>().Implementors;
            var types     = typeInfos.Where(info => !info.IsAbstract).Select(info => info.Type).Where(type => type.IsSerializable && !type.IsInterface);

            foreach (var type in types)
            {
                WcfDataServerHelper.AddKnownType(type);
            }
        }
コード例 #41
0
        void ModifySequenceObjectWhenMySqlDatalayer(ITypesInfo typesInfo)
        {
            var typeInfo = typesInfo.FindTypeInfo(SequenceObjectType);

            if (IsMySql(typeInfo))
            {
                var memberInfo = (XafMemberInfo)typeInfo.FindMember <ISequenceObject>(o => o.TypeName);
                memberInfo.RemoveAttributes <SizeAttribute>();
                memberInfo.AddAttribute(new SizeAttribute(255));
            }
        }
コード例 #42
0
 void AddNewObjectCreateGroup(ITypesInfo typesInfo, IEnumerable <Type> types)
 {
     foreach (var type in types)
     {
         var typeDescendants = ReflectionHelper.FindTypeDescendants(typesInfo.FindTypeInfo(type));
         foreach (var typeInfo in typeDescendants)
         {
             typeInfo.AddAttribute(new NewObjectCreateGroupAttribute("SimpleModifer"));
         }
     }
 }
コード例 #43
0
 void HandleCustomAttribute(IMemberInfo memberInfo, ITypesInfo typesInfo) {
     var customAttributes = memberInfo.FindAttributes<Attribute>().OfType<ICustomAttribute>().ToList();
     foreach (var customAttribute in customAttributes) {
         for (int index = 0; index < customAttribute.Name.Split(';').Length; index++) {
             string s = customAttribute.Name.Split(';')[index];
             var theValue = customAttribute.Value.Split(';')[index];
             var typeInfo = typesInfo.FindTypeInfo(theValue);
             if (customAttribute is PropertyEditorAttribute && typeInfo.IsInterface) {
                 try {
                     theValue = typeInfo.Implementors.Single().FullName;
                 } catch (InvalidOperationException) {
                     if (Application != null)
                         throw new InvalidOperationException(typeInfo.FullName + " has no implementors");
                 }
             }
             memberInfo.AddAttribute(new ModelDefaultAttribute(s, theValue));
         }
     }
 }
コード例 #44
0
ファイル: ModelLoader.cs プロジェクト: gvilas/eXpand
 private XafApplication GetApplication(string executableName, ITypesInfo typesInfo) {
     string assemblyPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
     try {
         ReflectionHelper.AddResolvePath(assemblyPath);
         var assembly = ReflectionHelper.GetAssembly(Path.GetFileNameWithoutExtension(executableName), assemblyPath);
         var assemblyInfo = typesInfo.FindAssemblyInfo(assembly);
         typesInfo.LoadTypes(assembly);
         var findTypeInfo = typesInfo.FindTypeInfo(typeof(XafApplication));
         var findTypeDescendants = ReflectionHelper.FindTypeDescendants(assemblyInfo, findTypeInfo, false);
         return Enumerator.GetFirst(findTypeDescendants).CreateInstance(new object[0]) as XafApplication;
     } finally {
         ReflectionHelper.RemoveResolvePath(assemblyPath);
     }
 }
コード例 #45
0
		public ObjectMemberValueCriteriaProcessor(ITypesInfo typesInfo, Type objectType)
			: base() {
			this.typesInfo = typesInfo;
			objectTypeInfo = typesInfo.FindTypeInfo(objectType);
		}
コード例 #46
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo)
 {
     base.CustomizeTypesInfo(typesInfo);
     ITypeInfo info = typesInfo.FindTypeInfo(typeof(PersistentBase));
     if (FilterProviderManager.Providers != null)
         foreach (FilterProviderBase provider in FilterProviderManager.Providers)
         {
             if (info.FindMember(provider.FilterMemberName) == null)
                 CreateMember(info, provider);
         }
 }
コード例 #47
0
ファイル: XpandModuleBase.cs プロジェクト: gvilas/eXpand
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     InitializeInstanceXafApplicationManager();
     var type = (BaseInfo)typesInfo.FindTypeInfo(typeof(IModelMember)).FindMember("Type");
     var attribute = type.FindAttribute<ReadOnlyAttribute>();
     if (attribute != null)
         type.RemoveAttribute(attribute);
 }
コード例 #48
0
ファイル: SequenceGenerator.cs プロジェクト: aries544/eXpand
 void ModifySequenceObjectWhenMySqlDatalayer(ITypesInfo typesInfo) {
     var typeInfo = typesInfo.FindTypeInfo(SequenceObjectType);
     if (IsMySql(typeInfo)) {
         var memberInfo = (XafMemberInfo)typeInfo.FindMember<ISequenceObject>(o => o.TypeName);
         memberInfo.RemoveAttributes<SizeAttribute>();
         memberInfo.AddAttribute(new SizeAttribute(255));
     }
 }
コード例 #49
0
ファイル: XpandSecurityModule.cs プロジェクト: noxe/eXpand
 void CreateMember(ITypesInfo typesInfo, IRoleTypeProvider roleTypeProvider, SecurityOperationsAttribute attribute) {
     var roleTypeInfo = typesInfo.FindTypeInfo(roleTypeProvider.RoleType);
     if (roleTypeInfo.FindMember(attribute.OperationProviderProperty) == null) {
         roleTypeInfo.CreateMember(attribute.OperationProviderProperty, typeof(SecurityOperationsEnum));
     }
 }