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); } }
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)); } }
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)); }
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()); }
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); }
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(); }
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()); }
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; }
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); }
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)); }
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)); } }
/// <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)}"); }
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)); }
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)); }
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); } } }
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)); } }
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); } }
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)); } } }
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); }
public override void CustomizeTypesInfo(ITypesInfo typesInfo) { base.CustomizeTypesInfo(typesInfo); ITypeInfo typeInfo = typesInfo.FindTypeInfo(typeof(T)); typeInfo.AddAttribute(Expression(), new TypeConverterAttribute(typeof(TReferenceConverter))); }
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); }
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()); } }
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)); } } }
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)); } } }
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))); }
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); }
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")); } } }
private void SetAdditionalExportedTypesProperties(ITypesInfo typesInfo) { foreach (var type in AdditionalExportedTypes) { var typeInfo = (TypeInfo)typesInfo.FindTypeInfo(type); typeInfo.IsDomainComponent = true; } }
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); }
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)); } }
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(); } }
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); } }
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"); } }
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); } }
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); } }
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(); } }
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); } }
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); } }
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)); } }
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")); } } }
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)); } } }
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); } }
public ObjectMemberValueCriteriaProcessor(ITypesInfo typesInfo, Type objectType) : base() { this.typesInfo = typesInfo; objectTypeInfo = typesInfo.FindTypeInfo(objectType); }
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); } }
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); }
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)); } }