Ejemplo n.º 1
0
 public NHObjectSpaceProvider(ITypesInfo typesInfo, IPersistenceManager persistenceManager)
 {
     Guard.ArgumentNotNull(typesInfo, "typesInfo");
     Guard.ArgumentNotNull(persistenceManager, "persistenceManager");
     this.typesInfo = typesInfo;
     this.persistenceManager = persistenceManager;
 }
Ejemplo n.º 2
0
        internal NHNestedObjectSpace(ITypesInfo typesInfo, IEntityStore entityStore, IPersistenceManager persistenceManager, 
            Dictionary<object, ObjectSpaceInstanceInfo> instances,  NHObjectSpace parentObjectSpace) : 
            base(typesInfo, entityStore, persistenceManager, instances, null)
        {

            this.parentObjectSpace = parentObjectSpace;
        }
Ejemplo n.º 3
0
        public CriteriaObjectReplacer(ITypesInfo typesInfo)
        {
            if (typesInfo == null)
                throw new ArgumentNullException("typesInfo");

            this.typesInfo = typesInfo;
        }
Ejemplo n.º 4
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     if (!RuntimeMode) {
         CreateDesignTimeCollection(typesInfo, typeof(UserModelDifferenceObject), "Users");
         CreateDesignTimeCollection(typesInfo, typeof(RoleModelDifferenceObject), "Roles");
     }
 }
Ejemplo n.º 5
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     if (!RuntimeMode) {
         CreateDesignTimeCollection(typesInfo, typeof(SendEmailJobDetailDataMap), "Users");
         CreateDesignTimeCollection(typesInfo, typeof(SendEmailJobDetailDataMap), "Roles");
     }
 }
Ejemplo n.º 6
0
 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());
     }
 }
Ejemplo n.º 7
0
 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));
     }
 }
Ejemplo n.º 8
0
 public ApplicationModulesManager CreateApplicationModulesManager(XafApplication application, string configFileName, string assembliesPath, ITypesInfo typesInfo) {
     if (!string.IsNullOrEmpty(configFileName)) {
         bool isWebApplicationModel =
             String.Compare(Path.GetFileNameWithoutExtension(configFileName), "web", StringComparison.OrdinalIgnoreCase) == 0;
         if (string.IsNullOrEmpty(assembliesPath)) {
             assembliesPath = Path.GetDirectoryName(configFileName);
             if (isWebApplicationModel) {
                 assembliesPath = Path.Combine(assembliesPath + "", "Bin");
             }
         }
     }
     ReflectionHelper.AddResolvePath(assembliesPath);
     try {
         var result = new ApplicationModulesManager(new ControllersManager(), assembliesPath);
         foreach (ModuleBase module in application.Modules) {
             result.AddModule(module);
         }
         result.Security = application.Security;
         if (GetModulesFromConfig(application) != null) {
             result.AddModuleFromAssemblies(GetModulesFromConfig(application));
         }
         return result;
     } finally {
         ReflectionHelper.RemoveResolvePath(assembliesPath);
     }
 }
        private XPCustomMemberInfo CreateMemberInfo(ITypesInfo typesInfo, IMemberInfo memberInfo, ProvidedAssociationAttribute providedAssociationAttribute, AssociationAttribute associationAttribute) {
            var typeToCreateOn = getTypeToCreateOn(memberInfo, associationAttribute);
            if (typeToCreateOn == null)
                throw new NotImplementedException();
            XPCustomMemberInfo xpCustomMemberInfo;
            if (!(memberInfo.IsList) || (memberInfo.IsList && providedAssociationAttribute.RelationType == RelationType.ManyToMany)) {
                xpCustomMemberInfo = typesInfo.CreateCollection(
                    typeToCreateOn,
                    memberInfo.Owner.Type,
                    associationAttribute.Name,
                    XpandModuleBase.Dictiorary,
                    providedAssociationAttribute.ProvidedPropertyName ?? memberInfo.Owner.Type.Name + "s", false);
            } else {
                xpCustomMemberInfo = typesInfo.CreateMember(
                    typeToCreateOn,
                    memberInfo.Owner.Type,
                    associationAttribute.Name,
                    XpandModuleBase.Dictiorary,
                    providedAssociationAttribute.ProvidedPropertyName ?? memberInfo.Owner.Type.Name, false);
            }

            if (!string.IsNullOrEmpty(providedAssociationAttribute.AssociationName) && memberInfo.FindAttribute<AssociationAttribute>() == null)
                memberInfo.AddAttribute(new AssociationAttribute(providedAssociationAttribute.AssociationName));

            typesInfo.RefreshInfo(typeToCreateOn);

            return xpCustomMemberInfo;
        }
Ejemplo n.º 10
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);
     }
 }
Ejemplo n.º 11
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     var memberInfos = typesInfo.PersistentTypes.SelectMany(info => info.OwnMembers);
     foreach (var memberInfo in memberInfos) {
         HandleCustomAttribute(memberInfo, typesInfo);
     }
 }
Ejemplo n.º 12
0
 protected override IObjectSpace CreateObjectSpaceCore(UnitOfWork unitOfWork, ITypesInfo typesInfo) {
     var objectSpace = new XpandObjectSpace(new XpandUnitOfWork(unitOfWork.DataLayer), typesInfo) {
         AsyncServerModeSourceResolveSession = AsyncServerModeSourceResolveSession,
         AsyncServerModeSourceDismissSession = AsyncServerModeSourceDismissSession
     };
     return objectSpace;
 }
Ejemplo n.º 13
0
        ApplicationModulesManager CreateModulesManager(XafApplication application, string configFileName, string assembliesPath, ITypesInfo typesInfo) {
            if (!string.IsNullOrEmpty(configFileName)) {
                bool isWebApplicationModel = string.Compare(Path.GetFileNameWithoutExtension(configFileName), "web", true) == 0;
                if (string.IsNullOrEmpty(assembliesPath)) {
                    assembliesPath = Path.GetDirectoryName(configFileName);
                    if (isWebApplicationModel) {
                        assembliesPath = Path.Combine(assembliesPath + "", "Bin");
                    }
                }
            }
            ReflectionHelper.AddResolvePath(assembliesPath);
            try {
                var result = new ApplicationModulesManager(new ControllersManager(), assembliesPath);
                if (application != null) {
                    foreach (ModuleBase module in application.Modules) {
                        result.AddModule(module);
                    }
                    result.Security = application.Security;
                }
                if (!string.IsNullOrEmpty(configFileName)) {
                    result.AddModuleFromAssemblies(GetModulesFromConfig(application));
                }
                if (typesInfo is TypesInfo)
                    XpandModuleBase.Dictiorary = ((TypesInfo)typesInfo).Source.XPDictionary;

                result.Load(typesInfo);
                return result;
            } finally {
                XpandModuleBase.Dictiorary = XafTypesInfo.XpoTypeInfoSource.XPDictionary;
                ReflectionHelper.RemoveResolvePath(assembliesPath);
            }

        }
Ejemplo n.º 14
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     new FullTextContainsFunction().Register();
     if (Application != null && Application.Security != null) {
         CreatePessimisticLockingField(typesInfo);
     }
 }
Ejemplo n.º 15
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));
     }
 }
Ejemplo n.º 16
0
 protected void CreateDesignTimeCollection(ITypesInfo typesInfo, Type classType, string propertyName) {
     XPClassInfo info = XafTypesInfo.XpoTypeInfoSource.XPDictionary.GetClassInfo(classType);
     if (info.FindMember(propertyName) == null) {
         info.CreateMember(propertyName, typeof(XPCollection), true);
         typesInfo.RefreshInfo(classType);
     }
 }
Ejemplo n.º 17
0
 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);
 }
 IEnumerable<XPMemberInfo> GetDecoratedMembers(ITypesInfo typesInfo) {
     var memberInfos =
         typesInfo.PersistentTypes.Where(info => (info.IsInterface && !info.IsDomainComponent) || !info.IsInterface).SelectMany(typeInfo => {
             XPClassInfo xpClassInfo = XpandModuleBase.Dictiorary.QueryClassInfo(typeInfo.Type);
             return xpClassInfo != null ? xpClassInfo.OwnMembers : new List<XPMemberInfo>();
         });
     return memberInfos.Where(memberInfo => memberInfo.HasAttribute(typeof(ProvidedAssociationAttribute)));
 }
Ejemplo n.º 19
0
 private void SetAdditionalExportedTypesProperties(ITypesInfo typesInfo)
 {
     foreach (var type in AdditionalExportedTypes)
     {
         var typeInfo = (TypeInfo)typesInfo.FindTypeInfo(type);
         typeInfo.IsDomainComponent = true;
     }
 }
Ejemplo n.º 20
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     var memberInfos = typesInfo.PersistentTypes.SelectMany(info => info.OwnMembers);
     foreach (var memberInfo in memberInfos) {
         HandleNumericFormatAttribute(memberInfo);
         HandleSequencePropertyAttribute(memberInfo);
     }
 }
Ejemplo n.º 21
0
        public NHEntityStore(ITypesInfo typesInfo, IPersistenceManager persistenceManager)
        {
            Guard.ArgumentNotNull(typesInfo, "typesInfo");
            Guard.ArgumentNotNull(persistenceManager, "persistenceManager");

            this.typesInfo = typesInfo;
            this.persistenceManager = persistenceManager;
        }
Ejemplo n.º 22
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("Logic"));
         }
     }
 }
Ejemplo n.º 23
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     if (!RuntimeMode) {
         CreateDesignTimeCollection(typesInfo, typeof(DashboardDefinition), "Roles");
     } else if ((Application.Security.UserType != null && !Application.Security.UserType.IsInterface)) {
         BuildSecuritySystemObjects();
     }
 }
Ejemplo n.º 24
0
 void CreateMembers(ITypesInfo typesInfo) {
     foreach (FilterProviderBase provider in FilterProviderManager.Providers) {
         FilterProviderBase provider1 = provider;
         foreach (ITypeInfo typeInfo in typesInfo.PersistentTypes.Where(typeInfo => TypeMatch(typeInfo, provider1))) {
             CreateMember(typeInfo, provider);
         }
     }
 }
        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);
        }
Ejemplo n.º 26
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     if (!RuntimeMode) {
         CreateDesignTimeCollection(typesInfo, typeof(UserModelDifferenceObject), "Users");
         CreateDesignTimeCollection(typesInfo, typeof(RoleModelDifferenceObject), "Roles");
     } else if (Application.CanBuildSecurityObjects()) {
         BuildSecuritySystemObjects();
     }
 }
Ejemplo n.º 27
0
 void CreateMembers(ITypesInfo typesInfo) {
     foreach (FilterProviderBase provider in FilterProviderManager.Providers) {
         FilterProviderBase provider1 = provider;
         foreach (ITypeInfo typeInfo in typesInfo.PersistentTypes.Where(
             typeInfo => (provider1.ObjectType == null || provider1.ObjectType == typeInfo.Type) && typeInfo.FindMember(provider1.FilterMemberName) == null && typeInfo.IsPersistent)) {
             CreateMember(typeInfo, provider);
         }
     }
 }
Ejemplo n.º 28
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo) {
     base.CustomizeTypesInfo(typesInfo);
     if (!RuntimeMode) {
         CreateDesignTimeCollection(typesInfo, typeof(SendEmailJobDetailDataMap), "Users");
         CreateDesignTimeCollection(typesInfo, typeof(SendEmailJobDetailDataMap), "Roles");
     } else if ((Application.CanBuildSecurityObjects())) {
         BuildSecuritySystemObjects();
     }
 }
Ejemplo n.º 29
0
 public NHObjectSpaceProvider(ITypesInfo typesInfo, IPersistenceManager persistenceManager, ISelectDataSecurityProvider selectDataProvider)
 {
     Guard.ArgumentNotNull(typesInfo, "typesInfo");
     Guard.ArgumentNotNull(persistenceManager, "persistenceManager");
     this.typesInfo = typesInfo;
     this.persistenceManager = persistenceManager;
     this.selectDataProvider = selectDataProvider;
     ParseCriteriaScope.Init(typesInfo);
 }
 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");
     }
 }
Ejemplo n.º 31
0
        public ModelApplicationBase GetMasterModel(bool tryToUseCurrentTypesInfo, Action <ITypesInfo> action = null)
        {
            if (!File.Exists(_moduleName))
            {
                throw new UserFriendlyException(_moduleName + " not found in path");
            }
            ModelApplicationBase masterModel = null;

            Retry.Do(() => {
                _typesInfo = TypesInfoBuilder.Create()
                             .FromModule(_moduleName)
                             .Build(tryToUseCurrentTypesInfo);
                _xafApplication = ApplicationBuilder.Create().
                                  UsingTypesInfo(s => _typesInfo).
                                  FromModule(_moduleName).
                                  Build();

                masterModel = GetMasterModel(_xafApplication, action);
            }, TimeSpan.FromTicks(1), 2);
            return(masterModel);
        }
Ejemplo n.º 32
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);

            typesInfo
            .RemoveXafViewsFromApplicationModel()
            .RemoveXpoViewsFromApplicationModel();

            var builder = ModelBuilder.Create <MailBaseObject>(typesInfo);

            builder.For(m => m.IsDeleted)
            .HasTooltip("");

            builder.Build();

            ModelBuilder.Create <MailBaseObject>(typesInfo).GenerateNoViews().Build();
            ModelBuilder.Create <MailBaseObjectId>(typesInfo).GenerateNoViews().Build();

            new MailClientBuilderManager(typesInfo)
            .Build();
        }
Ejemplo n.º 33
0
        public static XPMemberInfo CreateMember(this ITypesInfo typesInfo, Type typeToCreateOn, Type typeOfMember, string associationName, XPDictionary dictionary, string propertyName, bool refreshTypesInfo)
        {
            XPMemberInfo member = null;

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

                    if (refreshTypesInfo)
                    {
                        typesInfo.RefreshInfo(typeToCreateOn);
                    }
                }
            }
            return(member);
        }
Ejemplo n.º 34
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));
            }
        }
Ejemplo n.º 35
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));
        }
Ejemplo n.º 36
0
        public override void CustomizeTypesInfo(ITypesInfo typesInfo)
        {
            base.CustomizeTypesInfo(typesInfo);
            CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);

            var dsDefaultClassOptionsTypes =
                typesInfo.PersistentTypes.Where(t => t.Attributes.Any(a => a.GetType().Name.StartsWith("DS")));

            foreach (var dsDefaultClassOptionsType in dsDefaultClassOptionsTypes)
            {
                dsDefaultClassOptionsType.AddAttribute(new DefaultClassOptionsAttribute());
            }

            //typesInfo.FindTypeInfo(typeof(Policy)).AddAttribute(new DSDefaultClassOptionsAttribute());
            //typesInfo.FindTypeInfo(typeof(PolicyChld)).AddAttribute(new DSDefaultClassOptionsAttribute());
            //typesInfo.FindTypeInfo(typeof(Client)).AddAttribute(new DSDefaultClassOptionsAttribute());
            //typesInfo.FindTypeInfo(typeof(Organization)).AddAttribute(new DSDefaultClassOptionsAttribute());
            //typesInfo.FindTypeInfo(typeof(DoSoUser2)).AddAttribute(new DSDefaultClassOptionsAttribute());

            //var createdBy = typesInfo.FindTypeInfo(typeof(Client)).FindMember(nameof(Client.CreatedBy2));
            //Client.GetCreatedBy

            //createdBy.MemberType = typeof(SecuritySystemUser);

            //Mapper.Initialize(cfg => cfg.CreateMap<Policy, Policy2>());

            //createdBy.AddAttribute(new NonPersistentAttribute());
            //createdBy.AddAttribute(new PersistentAliasAttribute("CreatedBy2.Oid"));

            //Type type = typeof(Client);
            //PropertyInfo prop = type.GetProperty("CreatedBy");
            //prop.PropertyType = typeof(Client);

            //var createdBy2 = typesInfo.FindTypeInfo(typeof(Client)).CreateMember("CreatedBy2", typeof(Guid));
            //createdBy2.AddAttribute(new PersistentAttribute(nameof(Client.CreatedBy3)));

            Client.OnSavingEvent += client => client.SetMemberValue("CreatedBy3", client.Session.GetObjectByKey <DoSoUser2>(SecuritySystem.CurrentUserId));
        }
Ejemplo n.º 37
0
        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);
        }
Ejemplo n.º 38
0
        static XPMemberInfo CreateCollection(this ITypesInfo typeInfo, Type typeToCreateOn, Type typeOfCollection, string associationName, string collectionName, bool refreshTypesInfo,
                                             bool isManyToMany)
        {
            XPMemberInfo member = null;

            if (TypeIsRegister(typeInfo, typeToCreateOn))
            {
                XPClassInfo xpClassInfo = typeInfo.FindTypeInfo(typeToCreateOn).QueryXPClassInfo();
                member = xpClassInfo.FindMember(collectionName) ??
                         xpClassInfo.CreateMember(collectionName, typeof(XPCollection), true);
                if (member.FindAttributeInfo(typeof(AssociationAttribute)) == null)
                {
                    member.AddAttribute(new AssociationAttribute(associationName, typeOfCollection)
                    {
                        UseAssociationNameAsIntermediateTableName = isManyToMany
                    });
                }
                if (refreshTypesInfo)
                {
                    typeInfo.RefreshInfo(typeToCreateOn);
                }
            }
            return(member);
        }
Ejemplo n.º 39
0
        private void ApplySecurityOperations(ITypesInfo typesInfo)
        {
            var securityOperationInfos = typesInfo.PersistentTypes.Where(info => info.FindAttribute <SecurityOperationsAttribute>() != null);
            var roleInfos = typesInfo.DomainSealedInfos <ISecurityRole>().ToArray();

            foreach (var securityOperationInfo in securityOperationInfos)
            {
                var securityOperationsAttributes = securityOperationInfo.FindAttributes <SecurityOperationsAttribute>();
                foreach (var securityOperationsAttribute in securityOperationsAttributes)
                {
                    foreach (var roleInfo in roleInfos.Where(info => (!RuntimeMode || info.Type == RoleType) && !(((TypeInfo)info).Source is ReflectionTypeInfoSource)))
                    {
                        if (roleInfo.FindMember(securityOperationsAttribute.OperationProviderProperty) == null)
                        {
                            roleInfo.CreateMember(securityOperationsAttribute.OperationProviderProperty, typeof(SecurityOperationsEnum));
                        }
                        if (!RuntimeMode)
                        {
                            CreateWeaklyTypedCollection(typesInfo, roleInfo.Type, securityOperationsAttribute.CollectionName);
                        }
                    }
                }
            }
        }
Ejemplo n.º 40
0
 public static IEnumerable <ITypeInfo> DomainSealedInfos <T>(this ITypesInfo typesInfo)
 {
     return(typesInfo.DomainSealedInfos(typeof(T)));
 }
Ejemplo n.º 41
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo)
 {
     base.CustomizeTypesInfo(typesInfo);
     _typesInfoSubject.OnNext(typesInfo);
     _typesInfoSubject.OnCompleted();
 }
Ejemplo n.º 42
0
 public static ITypeInfo FindTypeInfo <T>(this ITypesInfo typesInfo)
 {
     return(typesInfo.FindTypeInfo(typeof(T)));
 }
Ejemplo n.º 43
0
 private static bool TypeIsRegister(ITypesInfo typeInfo, Type typeToCreateOn)
 {
     return(XafTypesInfo.Instance.FindTypeInfo(typeToCreateOn).IsDomainComponent ||
            typeInfo.PersistentTypes.FirstOrDefault(info => info.Type == typeToCreateOn) != null);
 }
 // register your application types here
 private static void RegisterBOTypes(ITypesInfo typesInfo)
 {
     typesInfo.RegisterEntity(typeof(Employee));
 }
Ejemplo n.º 45
0
 public static List <XPMemberInfo> CreateBothPartMembers(this ITypesInfo typesinfo, Type typeToCreateOn, Type otherPartMember, bool isManyToMany)
 {
     return(CreateBothPartMembers(typesinfo, typeToCreateOn, otherPartMember, isManyToMany, Guid.NewGuid().ToString()));
 }
Ejemplo n.º 46
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo)
 {
     base.CustomizeTypesInfo(typesInfo);
     typesInfo.RegisterEntity("SequenceGeneratorDCObject", typeof(ISequenceGeneratorObject));
 }
 public MainDemoBuilderManager(ITypesInfo typesInfo, IEnumerable <IBuilder> builders)
     : base(typesInfo, builders)
 {
 }
Ejemplo n.º 48
0
 static XPMemberInfo CreateCollection(this ITypesInfo typeInfo, Type typeToCreateOn, Type typeOfCollection, string associationName, bool refreshTypesInfo,
                                      string propertyName, bool isManyToMany)
 {
     return(CreateCollection(typeInfo, typeToCreateOn, typeOfCollection, associationName, propertyName, refreshTypesInfo, isManyToMany));
 }
Ejemplo n.º 49
0
 public static XPMemberInfo CreateCollection(this ITypesInfo typeInfo, Type typeToCreateOn, Type typeOfCollection, string associationName, string collectionName)
 {
     return(CreateCollection(typeInfo, typeToCreateOn, typeOfCollection, associationName, collectionName, true));
 }
Ejemplo n.º 50
0
 public static XPMemberInfo CreateMember(this ITypesInfo typesInfo, Type typeToCreateOn, Type typeOfMember, string associationName, string propertyName)
 {
     return(CreateMember(typesInfo, typeToCreateOn, typeOfMember, associationName, propertyName, true));
 }
Ejemplo n.º 51
0
 public static XPMemberInfo CreateMember(this ITypesInfo typesInfo, Type typeToCreateOn, Type typeOfMember, string associationName, bool refreshTypesInfo)
 {
     return(CreateMember(typesInfo, typeToCreateOn, typeOfMember, associationName, typeOfMember.Name, refreshTypesInfo));
 }
Ejemplo n.º 52
0
 public static Type FindBussinessObjectType <T>(this ITypesInfo typesInfo)
 {
     return(typesInfo.FindBussinessObjectType(typeof(T)));
 }
Ejemplo n.º 53
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo)
 {
     base.CustomizeTypesInfo(typesInfo);
 }
 public WorldCreatorObjectSpaceProvider(bool threadSafe, IXpoDataStoreProvider xpoDataStoreProvider, ITypesInfo typesInfo)
     : base(GetConnectionStringDataStoreProvider(xpoDataStoreProvider), typesInfo, WorldCreatorTypeInfoSource.Instance, threadSafe)
 {
 }
 /// <summary>
 /// Creates the specified types information.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="typesInfo">The types information.</param>
 /// <returns></returns>
 public static ModelBuilder <T> Create <T>(ITypesInfo typesInfo)
 => new ModelBuilder <T>(typesInfo.FindTypeInfo <T>());
Ejemplo n.º 56
0
 public static List <XPMemberInfo> CreateBothPartMembers(this ITypesInfo typesInfo, Type typeToCreateOn, Type otherPartType)
 {
     return(CreateBothPartMembers(typesInfo, typeToCreateOn, otherPartType, false));
 }
Ejemplo n.º 57
0
 public static XPMemberInfo CreateCollection(this ITypesInfo typeInfo, Type typeToCreateOn, Type typeOfCollection, string associationName, string collectionName, bool refreshTypesInfo)
 {
     return(CreateCollection(typeInfo, typeToCreateOn, typeOfCollection, associationName, collectionName, refreshTypesInfo, false));
 }
 /// <summary>
 /// Finds the type information.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="typesInfo">The types information.</param>
 /// <returns></returns>
 public static ITypeInfo FindTypeInfo <T>(this ITypesInfo typesInfo)
 => typesInfo.FindTypeInfo(typeof(T));
Ejemplo n.º 59
0
 public override void CustomizeTypesInfo(ITypesInfo typesInfo)
 {
     base.CustomizeTypesInfo(typesInfo);
     CalculatedPersistentAliasHelper.CustomizeTypesInfo(typesInfo);
 }
 /// <summary>
 /// Creates the specified types information.
 /// </summary>
 /// <typeparam name="TBuilder">The type of the builder.</typeparam>
 /// <typeparam name="T"></typeparam>
 /// <param name="typesInfo">The types information.</param>
 /// <returns></returns>
 public static TBuilder Create <TBuilder, T>(ITypesInfo typesInfo)
     where TBuilder : IModelBuilder <T>
 => (TBuilder)Activator.CreateInstance(typeof(TBuilder), typesInfo.FindTypeInfo <T>());