public MultiDataStoreProxy(IDataStore dataStore, string connectionString,XPDictionary dictionary=null) : base(dataStore){ if (dictionary==null) dictionary=XpandModuleBase.Dictiorary; _dataStoreManager = new DataStoreManager(connectionString); FillDictionaries(dictionary); }
public JsonSerializationContractResolver() { dictionary = new ReflectionDictionary(); dictionary.GetDataStoreSchema(new Type[] { typeof(Employee) }); }
public List <XPDataObject> GetObjectsFromDataSource() { if (DataSource == null) { throw new InvalidOperationException("DataSource Is null"); } DataSource.Fill(null); XPDictionary xpDictionary = DevExpress.ExpressApp.Xpo.XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary; var newClass = xpDictionary.CreateClass($"NewClass{ID}", new NonPersistentAttribute()); if (ExcelDataSource != null) { foreach (var item in ExcelDataSource.Schema) { newClass.CreateMember(item.Name, Type.GetType(item.Type.ToString())); } } if (SqlDataSource != null) { foreach (var item in SqlDataSource.Result.FirstOrDefault().Columns) { newClass.CreateMember(item.Name, item.Type); } } XafTypesInfo.Instance.RefreshInfo(newClass.ClassType); return(ExcelDataSource != null?GetListFromExcelDataSource(newClass) : GetListFromSqlDatasource(newClass)); }
public static void AddFields(DictionaryNode rootNode, XPDictionary dictionary) { foreach (PropertyInfoNodeWrapper customFieldInfo in GetCustomFields(rootNode)) try { Type classType = ReflectionHelper.GetType(customFieldInfo.Class.Name); var typeInfo = dictionary.GetClassInfo(classType); lock (typeInfo) { if (typeInfo.FindMember(customFieldInfo.Name) == null) { Type memberType = ReflectionHelper.GetType(customFieldInfo.Type); XPCustomMemberInfo memberInfo = typeInfo.CreateMember(customFieldInfo.Name, memberType); if (customFieldInfo.Size != 0) memberInfo.AddAttribute(new DevExpress.Xpo.SizeAttribute(customFieldInfo.Size)); XafTypesInfo.Instance.RefreshInfo(classType); } } } catch (Exception exception) { throw new Exception( ExceptionLocalizerTemplate<SystemExceptionResourceLocalizer, ExceptionId>.GetExceptionMessage( ExceptionId.ErrorOccursWhileAddingTheCustomProperty, customFieldInfo.Type, customFieldInfo.Class.Name, customFieldInfo.Name, exception.Message)); } }
static void AddRuntimeMembers(IModelApplication model, XPDictionary dictionary) { foreach (IModelRuntimeMember modelRuntimeMember in GetCustomFields(model)) { try { Type classType = modelRuntimeMember.ModelClass.TypeInfo.Type; XPClassInfo typeInfo = dictionary.GetClassInfo(classType); lock (typeInfo) { if (typeInfo.FindMember(modelRuntimeMember.Name) == null) { XpandCustomMemberInfo memberInfo = GetMemberInfo(modelRuntimeMember, typeInfo); AddAttributes(modelRuntimeMember, memberInfo); XafTypesInfo.Instance.RefreshInfo(classType); } } } catch (Exception exception) { throw new Exception( ExceptionLocalizerTemplate <SystemExceptionResourceLocalizer, ExceptionId> .GetExceptionMessage( ExceptionId.ErrorOccursWhileAddingTheCustomProperty, modelRuntimeMember.MemberInfo.MemberType, ((IModelClass)modelRuntimeMember.Parent).Name, modelRuntimeMember.Name, exception.Message)); } } }
/// <summary> /// Initializes the proxy. /// </summary> /// <param name="dictionary">The dictionary.</param> /// <param name="appConnectionString">The app connection string.</param> /// <param name="secondStorageConnectionString">The replication storage connection string.</param> /// <param name="secondStorageTypes">The second storage types.</param> public void Initialize(XPDictionary dictionary, string appConnectionString, string secondStorageConnectionString, IEnumerable<Type> secondStorageTypes) { var secondStorageClasses = secondStorageTypes.Select(currentType => dictionary.GetClassInfo(currentType)) .Where(classInfo => classInfo != null).ToList(); Initialize(dictionary, appConnectionString, secondStorageConnectionString, secondStorageClasses); }
void FillDictionaries(XPDictionary xpDictionary) { foreach (XPClassInfo queryClassInfo in xpDictionary.Classes.OfType<XPClassInfo>().Where(info => !(info is IntermediateClassInfo))) { ReflectionDictionary reflectionDictionary = _dataStoreManager.GetDictionary(queryClassInfo); reflectionDictionary.QueryClassInfo(queryClassInfo.ClassType); } }
public JsonResolver() { dictionary = new ReflectionDictionary(); dictionary.GetDataStoreSchema( typeof(Employee) , typeof(Departments) ); }
/// <summary> /// Initializes the proxy. /// </summary> /// <param name="dictionary">The dictionary.</param> /// <param name="appConnectionString">The app connection string.</param> /// <param name="secondStorageConnectionString">The replication storage connection string.</param> /// <param name="secondStorageTypes">The second storage types.</param> public void Initialize(XPDictionary dictionary, string appConnectionString, string secondStorageConnectionString, IEnumerable <Type> secondStorageTypes) { var secondStorageClasses = secondStorageTypes.Select(currentType => dictionary.GetClassInfo(currentType)) .Where(classInfo => classInfo != null).ToList(); Initialize(dictionary, appConnectionString, secondStorageConnectionString, secondStorageClasses); }
public static XPClassInfo AddClass(this XPDictionary xpDictionary, IPersistentClassInfo info) { var builder = PersistentClassTypeBuilder.BuildClass(); XPClassInfo xpClassInfo = CreateClass(xpDictionary, info, builder); CreateMembers(info, xpClassInfo.ClassType); return(xpClassInfo); }
void FillDictionaries(XPDictionary xpDictionary) { foreach (XPClassInfo queryClassInfo in xpDictionary.Classes.OfType <XPClassInfo>().Where(info => !(info is IntermediateClassInfo))) { ReflectionDictionary reflectionDictionary = _dataStoreManager.GetDictionary(queryClassInfo); reflectionDictionary.QueryClassInfo(queryClassInfo.ClassType); } }
public DxSampleModelJsonSerializationContractResolver() { dictionary = new ReflectionDictionary(); dictionary.GetDataStoreSchema(new Type[] { typeof(Task), typeof(EventLog) }); }
void CreateMembers(XPDictionary dictionary) { XPClassInfo ci = dictionary.GetClassInfo(AssemblyName, Name); foreach (PersistentMemberInfo mi in OwnMembers) { mi.CreateMember(ci); } }
public MultiDataStoreProxy(IDataStore dataStore, string connectionString, XPDictionary dictionary = null) : base(dataStore) { if (dictionary == null) { dictionary = XpandModuleBase.Dictiorary; } _dataStoreManager = new DataStoreManager(connectionString); FillDictionaries(dictionary); }
private static XPClassInfo CreateClass(XPDictionary xpDictionary, IPersistentClassInfo info, IClassAssemblyNameBuilder builder) { XPClassInfo result = xpDictionary.QueryClassInfo(info.AssemblyName, info.Name); if (result == null){ var type = builder.WithAssemblyName(info.AssemblyName).Define(info); result = new ReflectionClassInfo(type, xpDictionary); CreateAttributes(result, info); } return result; }
public static InputInfo CreateInputClassInfo(XPDictionary outputDictionary, string inputPutClass, params ColumnInfo[] columnInfos) { var table = CreateDbTable(inputPutClass, columnInfos); var dataSet = new DataSet(); var inputUnitOfWork = new UnitOfWork(new SimpleDataLayer(new DataSetDataStore(dataSet, AutoCreateOption.DatabaseAndSchema))); var dictionaryMapper = new DictionaryMapper(new[] { table }); dictionaryMapper.Map(outputDictionary, inputUnitOfWork.Dictionary); var classInfo = inputUnitOfWork.Dictionary.QueryClassInfo(null, inputPutClass); return new InputInfo(classInfo, inputUnitOfWork, dataSet); }
public MultiDataStoreProxy(IDataStore dataStore, string connectionString, XPDictionary dictionary = null) : base(dataStore) { if (dictionary == null) { dictionary = XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary; } _dataStoreManager = new DataStoreManager(connectionString); FillDictionaries(dictionary); }
void createExcludeXPObjectTypeArgs(IEnumerable<SelectStatement> selectStatements, XPDictionary xpDictionary){ var typeNames = xpDictionary.Classes.OfType<XPClassInfo>().Where(classInfo => classInfo.ClassType != null).Select(info => info.ClassType.FullName); foreach (var selectStatement in selectStatements.Where(statement => statement.TableName == "XPObjectType")){ List<string> values = typeNames.ToList(); var criteriaOperator = new GroupOperator(GroupOperatorType.Or); foreach (var value in values){ criteriaOperator.Operands.Add(new QueryOperand("TypeName", selectStatement.Alias) == value); } selectStatement.Condition = criteriaOperator; } }
public static void FillDictionary(XPDictionary dictionary, ICollection <PersistentClassInfo> data) { foreach (PersistentClassInfo twc in data) { twc.CreateClass(dictionary); } foreach (PersistentClassInfo twc in data) { twc.CreateMembers(dictionary); } }
private static IDataLayer CreateDataLayer() { XPDictionary dictionary = CreateDictionary(); CustomCreateDataLayerEventArgs args = new CustomCreateDataLayerEventArgs(dictionary, dataStore); CustomCreateDataLayer?.Invoke(null, args); return(args.DataLayer ?? (UseThreadSafeDataLayer ? (IDataLayer) new ThreadSafeDataLayer(dictionary, dataStore) : new SimpleDataLayer(dictionary, dataStore))); }
void CreateIntermediateClassInfo(XPDictionary outputDictionary, XPDictionary inputDictionary, string className, InitialDataAttribute importDataAttribute, XPMemberInfo memberInfo) { var info = new IntermediateClassInfo(inputDictionary, className); info.CreateMember("Oid_" + importDataAttribute.DataProviderQueryColumnName, typeof(int)).AddAttribute(new KeyAttribute(true)); info.CreateMember(importDataAttribute.DataProviderQueryColumnName, memberInfo.Owner.KeyProperty.MemberType); var collectionElementType = memberInfo.CollectionElementType.ClassType; var memberType = outputDictionary.QueryClassInfo(collectionElementType).KeyProperty.MemberType; info.CreateMember(importDataAttribute.DataProviderResultColumnName, memberType); }
public void Map(XPDictionary outputDictionary, XPDictionary inputDictionary) { _outputClassInfos = outputDictionary.Classes.OfType <XPClassInfo>().Where(info => info.HasAttribute(typeof(InitialDataAttribute))).ToList(); foreach (var classInfo in _outputClassInfos) { var initialDataAttribute = (InitialDataAttribute)classInfo.FindAttributeInfo(typeof(InitialDataAttribute)); var objectClassInfo = new InputObjectClassInfo(inputDictionary, initialDataAttribute.Name ?? classInfo.ClassType.Name, classInfo); _inputClassInfos.Add(objectClassInfo); MapManyToMany(outputDictionary, inputDictionary, classInfo); } }
public static List<XPCustomMemberInfo> CreateBothPartMembers(this ITypesInfo typesinfo, Type typeToCreateOn, Type otherPartMember, XPDictionary xpDictionary, bool isManyToMany, string association) { var infos = new List<XPCustomMemberInfo>(); XPCustomMemberInfo collection = CreateCollection(typesinfo, typeToCreateOn, otherPartMember, association, xpDictionary); if (collection!= null){ infos.Add(collection); collection = CreateCollection(typesinfo, otherPartMember, typeToCreateOn, association, xpDictionary); if (collection!= null) infos.Add(collection); } return infos; }
public static XPCustomMemberInfo CreateMember(this ITypesInfo typesInfo, Type typeToCreateOn, Type typeOfMember, string associationName, XPDictionary dictionary, string propertyName) { XPCustomMemberInfo member = null; if (typeIsRegister(typesInfo, typeToCreateOn)) { XPClassInfo xpClassInfo = dictionary.GetClassInfo(typeToCreateOn); member = xpClassInfo.CreateMember(propertyName, typeOfMember); member.AddAttribute(new AssociationAttribute(associationName)); typesInfo.RefreshInfo(typeToCreateOn); } return member; }
private static XPClassInfo CreateClass(XPDictionary xpDictionary, IPersistentClassInfo info, IClassAssemblyNameBuilder builder) { XPClassInfo result = xpDictionary.QueryClassInfo(info.AssemblyName, info.Name); if (result == null) { var type = builder.WithAssemblyName(info.AssemblyName).Define(info); result = new ReflectionClassInfo(type, xpDictionary); CreateAttributes(result, info); } return(result); }
private static IDataLayer GetDataLayer(string connectionName, XPDictionary databaseSchema) { IDataStore connectionProvider = GetConnectionProvider(connectionName); IDataLayer dataLayer = new SimpleDataLayer(databaseSchema, connectionProvider); if (DontLoadClassInfoFromDatabase) { ConfigureDataLayerNotToLoadClassInfoFromDatabase(dataLayer); } return(dataLayer); }
void MapManyToMany(XPDictionary outputDictionary, XPDictionary inputDictionary, XPClassInfo classInfo) { foreach (var memberInfo in ManyToManyMemberInfos(classInfo)) { var initialDataAttribute = (InitialDataAttribute)memberInfo.FindAttributeInfo(typeof(InitialDataAttribute)); var className = initialDataAttribute.DataProviderTableName; if (initialDataAttribute.DataProvider && inputDictionary.QueryClassInfo(null, className) == null) { CreateIntermediateClassInfo(outputDictionary, inputDictionary, className, initialDataAttribute, memberInfo); } } }
public static void AddClasses(this XPDictionary xpDictionary, List <IPersistentClassInfo> persistentClassInfos) { var builder = PersistentClassTypeBuilder.BuildClass(); foreach (IPersistentClassInfo persistentClassInfo in persistentClassInfos) { CreateClass(xpDictionary, persistentClassInfo, builder); } foreach (IPersistentClassInfo classInfo in persistentClassInfos) { CreateMembers(classInfo, classInfo.PersistentTypeClassInfo.ClassType); } }
public static List<XPCustomMemberInfo> CreateBothPartMembers(this ITypesInfo typesInfo, Type otherPartType, Type typeOfMember, string associationName, XPDictionary dictionary){ var customMemberInfos = new List<XPCustomMemberInfo>(); XPCustomMemberInfo members = CreateMember(typesInfo, otherPartType, typeOfMember, associationName,dictionary); if (members!= null) { customMemberInfos.Add(members); members = CreateCollection(typesInfo, typeOfMember, otherPartType, associationName, dictionary); if (members!= null) customMemberInfos.Add(members); } return customMemberInfos; }
public static InputInfo CreateInputClassInfo(XPDictionary outputDictionary, string inputPutClass, params ColumnInfo[] columnInfos) { var table = CreateDbTable(inputPutClass, columnInfos); var dataSet = new DataSet(); var inputUnitOfWork = new UnitOfWork(new SimpleDataLayer(new DataSetDataStore(dataSet, AutoCreateOption.DatabaseAndSchema))); var dictionaryMapper = new DictionaryMapper(new[] { table }); dictionaryMapper.Map(outputDictionary, inputUnitOfWork.Dictionary); var classInfo = inputUnitOfWork.Dictionary.QueryClassInfo(null, inputPutClass); return(new InputInfo(classInfo, inputUnitOfWork, dataSet)); }
protected override void CustomizeTypesInfo() { base.CustomizeTypesInfo(); TypesInfo xafTypesInfo = (TypesInfo)TypesInfo; var xpotis = xafTypesInfo.EntityStores.OfType <XpoTypeInfoSource>().FirstOrDefault(); XPDictionary dict = XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary; xafTypesInfo.RegisterEntities(xpotis.XPDictionary.Classes .OfType <XPClassInfo>() .Where(ci => ci.IsPersistent) .Select(ci => ci.ClassType) .ToArray()); }
public SimpleDataLayer GetDataLayer(XPDictionary xpDictionary, MultiDataStore multiDataStore,Type type) { string connectionString = multiDataStore.DataStoreManager.GetConnectionString(type); var xpoDataStoreProxy = new DataStoreProxy(connectionString); xpoDataStoreProxy.DataStoreModifyData+=(o, eventArgs) => multiDataStore.ModifyData(eventArgs); xpoDataStoreProxy.DataStoreSelectData+=(sender1, dataEventArgs) => { if (multiDataStore.DataStoreManager.SimpleDataLayers.Count>1&&IsQueryingXPObjectType(dataEventArgs)) { createExcludeXPObjectTypeArgs(dataEventArgs.SelectStatements,xpDictionary); } multiDataStore.SelectData(dataEventArgs); }; xpoDataStoreProxy.DataStoreUpdateSchema +=(o1, schemaEventArgs) => multiDataStore.UpdateSchema(schemaEventArgs); return new SimpleDataLayer(xpDictionary, xpoDataStoreProxy); }
public static XPCustomMemberInfo CreateCollection(this ITypesInfo typeInfo, Type typeToCreateOn, Type typeOfCollection, string associationName, XPDictionary dictionary, string collectionName) { XPCustomMemberInfo member = null; if (typeIsRegister(typeInfo, typeToCreateOn)) { XPClassInfo xpClassInfo = dictionary.GetClassInfo(typeToCreateOn); if (xpClassInfo.FindMember(collectionName)== null){ member = xpClassInfo.CreateMember(collectionName, typeof(XPCollection), true); member.AddAttribute(new AssociationAttribute(associationName, typeOfCollection)); typeInfo.RefreshInfo(typeToCreateOn); } } return member; }
public sistemafacturaJsonSerializationContractResolver() { dictionary = new ReflectionDictionary(); dictionary.GetDataStoreSchema(new Type[] { typeof(Cat_ProductosServicios), typeof(CFDIs), typeof(Empresas), typeof(Plantilla), typeof(Series), typeof(Status), typeof(Usuarios), typeof(Clientes) }); }
public static void Seed() { string conn = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; XPDictionary dict = DatabaseSchemaHelper.GetDefaultDatabaseSchema(); IDataLayer dal = XpoDefault.GetDataLayer(conn, dict, AutoCreateOption.DatabaseAndSchema); UnitOfWork uow = new UnitOfWork(dal); uow.UpdateSchema(); uow.CreateObjectTypeRecords(); XPClassInfo classInfo = uow.GetClassInfo("", "Order"); int ordersCnt = (int)uow.Evaluate(classInfo, CriteriaOperator.Parse("count"), null); if (ordersCnt > 0) { return; } var rnd = new Random(DateTime.Now.Millisecond); var alphabet = "abcdefghijklmnopqrstuvwxyz"; var getRandomName = new Func <string>(() => { var result = new StringBuilder(); for (int i = 0; i < 5; i++) { result.Append(alphabet[rnd.Next(26)]); } return(result.ToString()); }); int ordersCount = 1000; int customersCount = 100; List <string> customerNames = new List <string>(); for (int i = 0; i < customersCount; i++) { customerNames.Add(getRandomName()); } for (int i = 0; i < ordersCount; i++) { object order = classInfo.CreateNewObject(uow); classInfo.GetMember("ID").SetValue(order, i + 1); classInfo.GetMember("ProductName").SetValue(order, getRandomName()); classInfo.GetMember("CustomerName").SetValue(order, customerNames[rnd.Next(customersCount)]); classInfo.GetMember("OrderDate").SetValue(order, new DateTime(rnd.Next(2012, 2022), rnd.Next(1, 12), rnd.Next(1, 28))); classInfo.GetMember("Freight").SetValue(order, rnd.Next(1000) / 100m); } uow.CommitChanges(); dal.Dispose(); }
public void Map(XPDictionary outputDictionary, XPDictionary inputDictionary) { var classMapper = new ClassMapper(); classMapper.Map(outputDictionary, inputDictionary); _inputClassInfos = classMapper.InputClassInfos; foreach (var classInfo in _inputClassInfos) { var dbTable = GetTable(classInfo); if (dbTable != null) { var memberMapper = new MemberMapper(dbTable); memberMapper.Map(classInfo.OutputClassInfo, classInfo); } } }
public TimetableJsonSerializationContractResolver() { dictionary = new ReflectionDictionary(); dictionary.GetDataStoreSchema(new Type[] { typeof(P__EFMigrationsHistory), typeof(AppConfigs), typeof(AppRoleClaims), typeof(AppRoles), typeof(AppUserClaims), typeof(AppUserLogins), typeof(AppUserRoles), typeof(AppUsers), typeof(AppUserTokens), typeof(Works) }); }
public SimpleDataLayer GetDataLayer(XPDictionary xpDictionary, MultiDataStore multiDataStore, Type type) { string connectionString = multiDataStore.DataStoreManager.GetConnectionString(type); var xpoDataStoreProxy = new DataStoreProxy(connectionString); xpoDataStoreProxy.DataStoreModifyData += (o, eventArgs) => multiDataStore.ModifyData(eventArgs); xpoDataStoreProxy.DataStoreSelectData += (sender1, dataEventArgs) => { if (multiDataStore.DataStoreManager.SimpleDataLayers.Count > 1 && IsQueryingXPObjectType(dataEventArgs)) { createExcludeXPObjectTypeArgs(dataEventArgs.SelectStatements, xpDictionary); } multiDataStore.SelectData(dataEventArgs); }; xpoDataStoreProxy.DataStoreUpdateSchema += (o1, schemaEventArgs) => multiDataStore.UpdateSchema(schemaEventArgs); return(new SimpleDataLayer(xpDictionary, xpoDataStoreProxy)); }
private PartialViewResult OrdersCustomBindingCore(GridViewModel viewModel) { XPDictionary databaseSchema = DatabaseSchemaHelper.GetDefaultDatabaseSchema(); DevExpress.Xpo.Session session = XpoHelper.GetNewSession("DefaultConnection", databaseSchema); XPClassInfo classInfo = session.GetClassInfo("", "Order"); XpoBindingHandlers bindingHandlers = new XpoBindingHandlers(session, classInfo); viewModel.ProcessCustomBinding( bindingHandlers.GetDataRowCount, bindingHandlers.GetData, bindingHandlers.GetSummaryValues, bindingHandlers.GetGroupingInfo, bindingHandlers.GetUniqueHeaderFilterValues ); return(PartialView("GridViewPartial", viewModel)); }
public XpoInitializer(IDataStore DataStore, DataLayerType DataLayerType, params Type[] entityTypes) { this.entityTypes = entityTypes; this.dataLayerType = DataLayerType; this.dataStore = DataStore; dictionary = this.PrepareDictionary(entityTypes); switch (DataLayerType) { case DataLayerType.Simple: this.WorkindDal = new SimpleDataLayer(dictionary, DataStore); break; case DataLayerType.ThreadSafe: this.WorkindDal = new ThreadSafeDataLayer(dictionary, DataStore); break; } }
public XPClassInfo CreateClass(XPDictionary dictionary) { XPClassInfo result = dictionary.QueryClassInfo(AssemblyName, Name); if (result == null) { XPClassInfo baseClassInfo; if (BaseClass != null) { baseClassInfo = BaseClass.CreateClass(dictionary); } else { baseClassInfo = dictionary.GetClassInfo(GetDefaultBaseClass()); } result = dictionary.CreateClass(baseClassInfo, Name); CreateAttributes(result); } return(result); }
/// <summary> /// Initializes the proxy. /// </summary> /// <param name="dictionary">The dictionary.</param> /// <param name="appConnectionString">The app connection string.</param> /// <param name="secondStorageConnectionString">The replication storage connection string.</param> /// <param name="secondStorageClasses">The second storage classes.</param> public void Initialize(XPDictionary dictionary, string appConnectionString, string secondStorageConnectionString, IEnumerable<XPClassInfo> secondStorageClasses) { var appDictionary = new ReflectionDictionary(); secondStorageDictionary = new ReflectionDictionary(); secondStorageClasses.ToList().ForEach(x => secondStorageTableNames.Add(x.TableName)); foreach(XPClassInfo ci in dictionary.Classes) { if (secondStorageTableNames.Contains(ci.TableName)) secondStorageDictionary.QueryClassInfo(ci.ClassType); appDictionary.QueryClassInfo(ci.ClassType); } appDataStore = XpoDefault.GetConnectionProvider(appConnectionString, AutoCreateOption.DatabaseAndSchema); appDataLayer = new SimpleDataLayer(appDictionary, appDataStore); secondStorageConnStr = secondStorageConnectionString; }
public DynamicDataTableClassInfo(XPDictionary dictionary, DataTable table) : base(dictionary) { if (table.PrimaryKey.Length != 1) { throw new NotSupportedException(); } baseClassCore = dictionary.QueryClassInfo(typeof(XPDataTableObject)); tableNameCore = table.TableName; foreach (DataColumn column in table.Columns) { XPCustomMemberInfo member = CreateMember(column.Caption, column.DataType); member.AddAttribute(new PersistentAttribute(column.ColumnName)); member.AddAttribute(new DisplayNameAttribute(column.Caption)); if (table.PrimaryKey[0] == column) { member.AddAttribute(new KeyAttribute(column.AutoIncrement)); } } dictionary.AddClassInfo(this); }
static void AddRuntimeMembers(IModelApplication model, XPDictionary dictionary) { foreach (IModelRuntimeMember modelRuntimeMember in GetCustomFields(model)) try { Type classType = modelRuntimeMember.ModelClass.TypeInfo.Type; XPClassInfo typeInfo = dictionary.GetClassInfo(classType); lock (typeInfo) { if (typeInfo.FindMember(modelRuntimeMember.Name) == null) { XpandCustomMemberInfo memberInfo = GetMemberInfo(modelRuntimeMember, typeInfo); AddAttributes(modelRuntimeMember, memberInfo); XafTypesInfo.Instance.RefreshInfo(classType); } } } catch (Exception exception) { throw new Exception( ExceptionLocalizerTemplate<SystemExceptionResourceLocalizer, ExceptionId>.GetExceptionMessage( ExceptionId.ErrorOccursWhileAddingTheCustomProperty, modelRuntimeMember.MemberInfo.MemberType, ((IModelClass)modelRuntimeMember.Parent).Name, modelRuntimeMember.Name, exception.Message)); } }
/// <summary> /// Регистрация поставщика метаданных в список информатора /// </summary> /// <param name="dictionary">Поставщик метаданных, типы которого требуют дополнительной информации</param> /// <param name="systemAssembly">Системная сборка, содержащая атрибуты схем для базовых типов DevExpress</param> public static void Register(XPDictionary dictionary, Assembly systemAssembly) { // Регистрация системной сборки, включающей атрибуты схем для DevExpress if (systemAssembly != null) instance.dictionary.ResolveSchemaName(systemAssembly, null); // Добавление уже существующих классов foreach (XPClassInfo info in dictionary.Classes) instance.AddInfo(info); dictionary.ClassInfoChanged += new ClassInfoEventHandler(instance.OnClassInfoChanged); }
public void Map(XPDictionary outputDictionary, XPDictionary inputDictionary) { _outputClassInfos = outputDictionary.Classes.OfType<XPClassInfo>().Where(info => info.HasAttribute(typeof(InitialDataAttribute))).ToList(); foreach (var classInfo in _outputClassInfos) { var initialDataAttribute = (InitialDataAttribute)classInfo.FindAttributeInfo(typeof(InitialDataAttribute)); var objectClassInfo = new InputObjectClassInfo(inputDictionary, initialDataAttribute.Name ?? classInfo.ClassType.Name, classInfo); _inputClassInfos.Add(objectClassInfo); MapManyToMany(outputDictionary, inputDictionary, classInfo); } }
public IntermediateClassInfo(XPDictionary dictionary, string className) : base(dictionary, null, className, GetAttributes()) { }
public XpandThreadSafeDataLayer(XPDictionary xpDictionary, IDataStore dataStore) : base(xpDictionary, dataStore){ }
/// <summary> /// Initializes the specified dictionary. /// </summary> /// <param name="dictionary">The dictionary.</param> /// <param name="appConnectionString">The app connection string.</param> /// <param name="secondStorageConnectionString">The second storagea connection string.</param> /// <param name="secondStorageTypes">The second storage types.</param> public void Initialize(XPDictionary dictionary, string appConnectionString, string secondStorageConnectionString, Type[] secondStorageTypes) { proxy.Initialize(dictionary, appConnectionString, secondStorageConnectionString, secondStorageTypes); IsInitialized = true; }
public DataStoreManagerSimpleDataLayer(XPDictionary dictionary, IDataStore provider, bool isMainLayer, bool isLegacy) : base(dictionary, provider) { _isMainLayer = isMainLayer; _isLegacy = isLegacy; }
public InputObjectClassInfo(XPDictionary dictionary, string className, XPClassInfo outputClassInfo) : base(dictionary, null, className, GetAttributes()) { Guard.ArgumentNotNull(outputClassInfo, "outputClassInfo"); _outputClassInfo = outputClassInfo; }
XpoMultiDataStoreProxy(string connectionString, XPDictionary xpDictionary):base(connectionString) { _dataStoreManager = new DataStoreManager(connectionString); FillDictionaries(xpDictionary); }
public static SimpleDataLayer GetDataLayer(string connectionString, XPDictionary xpDictionary, Type type) { var dummyProxy = new XpoMultiDataStoreProxy(connectionString,xpDictionary); connectionString = dummyProxy.DataStoreManager.GetConnectionString(type); var xpoDataStoreProxy = new XpoDataStoreProxy(connectionString); xpoDataStoreProxy.DataStoreModifyData += (o, eventArgs) => dummyProxy.ModifyData(eventArgs.ModificationStatements); xpoDataStoreProxy.DataStoreSelectData += (sender1, dataEventArgs) => { if (dummyProxy.DataStoreManager.SimpleDataLayers.Count > 1 && dummyProxy.IsQueryingXPObjectType(dataEventArgs)){ dummyProxy.CreateExcludeXPObjectTypeArgs(dataEventArgs.SelectStatements, xpDictionary); } dummyProxy.SelectData(dataEventArgs.SelectStatements); }; xpoDataStoreProxy.DataStoreUpdateSchema += (o1, schemaEventArgs) => dummyProxy.UpdateSchema(schemaEventArgs.DontCreateIfFirstTableNotExist, schemaEventArgs.Tables); return new SimpleDataLayer(xpDictionary, xpoDataStoreProxy); }
public XpandUnitOfWork(XPDictionary dictionary) : base(dictionary) { }
/// <summary> /// Конструктор /// </summary> /// <param name="dic">Справочник метаданных</param> /// <param name="securities">Системы</param> public ComplexRuleProvider(XPDictionary dic, ISelectDataSecurity[] securities) { ISecurityRule[] rules = securities.Select(security => SecurityStrategy.TraceLevel != TraceLevel.Off ? new SecurityRuleLogger(dic, security, new FilterLogger(Logger.ConvertToLogLevel(SecurityStrategy.TraceLevel), Logger.Instance)) : new SecurityRule(dic, security)).ToArray(); complexRule = new ComplexRule(rules); }
/// <summary> /// Исключение поставщика метаданных из списка ифнорматора /// </summary> /// <param name="dictionary">Поставщик метаданных, типы которого больше не требуют дополнительной информации</param> public static void Unregister(XPDictionary dictionary) { dictionary.ClassInfoChanged -= new ClassInfoEventHandler(instance.OnClassInfoChanged); }
/// <summary> /// Регистрация поставщика метаданных в список информатора /// </summary> /// <param name="dictionary">Поставщик метаданных, типы которого требуют дополнительной информации</param> public static void Register(XPDictionary dictionary) { Register(dictionary, null); }