public void Create(IPersistentAssemblyInfo persistentAssemblyInfo, IDataStoreLogonObject dataStoreLogonObject) { if (persistentAssemblyInfo.PersistentClassInfos.Any()) { var persistentAssemblyDataStoreAttributeInfo = _objectSpace.CreateWCObject <IPersistentAssemblyDataStoreAttributeInfo>(); persistentAssemblyDataStoreAttributeInfo.DataStoreLogon = dataStoreLogonObject; persistentAssemblyDataStoreAttributeInfo.PersistentClassInfo = persistentAssemblyInfo.PersistentClassInfos[0]; persistentAssemblyInfo.Attributes.Add(persistentAssemblyDataStoreAttributeInfo); } }
static Dictionary<string, string> GetParamsDict(IDataStoreLogonObject dataStoreLogonObject) { var parameters = new Dictionary<string, string>(); if (dataStoreLogonObject.UserName != null) parameters.Add(ProviderFactory.UserIDParamID, dataStoreLogonObject.UserName); if (dataStoreLogonObject.PassWord != null) parameters.Add(ProviderFactory.PasswordParamID, dataStoreLogonObject.PassWord); parameters.Add(ProviderFactory.ReadOnlyParamID, "1"); parameters.Add(ProviderFactory.ServerParamID, dataStoreLogonObject.ServerName); if (dataStoreLogonObject.DataBase != null) parameters.Add(ProviderFactory.DatabaseParamID, dataStoreLogonObject.DataBase.Name); parameters.Add(ProviderFactory.UseIntegratedSecurityParamID, (dataStoreLogonObject.Authentication == DataStoreAuthentication.Windows) ? "true" : "false"); return parameters; }
public void Map(Database database, IMapperInfo mapperInfo) { var attributeMapper = new AttributeMapper(_objectSpace); var tableMapper = new TableMapper(_objectSpace, database, attributeMapper); var dataTypeMapper = new DataTypeMapper(); var columnMapper = new ColumnMapper(dataTypeMapper, attributeMapper); Tracing.Tracer.LogSeparator("DBMapper Start mapping database " + database.Name); foreach (Table table in database.Tables.OfType<Table>().Where(table => !(table.IsSystemObject))) { Tracing.Tracer.LogValue("Table", table.Name); IPersistentClassInfo persistentClassInfo = tableMapper.Create(table, _persistentAssemblyInfo, mapperInfo); foreach (Column column in table.Columns) { columnMapper.Create(column, persistentClassInfo); } } _dataStoreLogonObject = (IDataStoreLogonObject)ReflectionHelper.CreateObject(XafTypesInfo.Instance.FindBussinessObjectType<IDataStoreLogonObject>(), new object[] { _persistentAssemblyInfo.Session, _dataStoreLogonObject }); attributeMapper.Create(_persistentAssemblyInfo, _dataStoreLogonObject); Func<ITemplateInfo, bool> templateInfoPredicate = info => info.Name == ExtraInfoBuilder.SupportPersistentObjectsAsAPartOfACompositeKey; CodeEngine.SupportCompositeKeyPersistentObjects(_persistentAssemblyInfo, templateInfoPredicate); }
static Dictionary <string, string> GetParamsDict(IDataStoreLogonObject dataStoreLogonObject) { var parameters = new Dictionary <string, string>(); if (dataStoreLogonObject.UserName != null) { parameters.Add(ProviderFactory.UserIDParamID, dataStoreLogonObject.UserName); } if (dataStoreLogonObject.PassWord != null) { parameters.Add(ProviderFactory.PasswordParamID, dataStoreLogonObject.PassWord); } parameters.Add(ProviderFactory.ReadOnlyParamID, "1"); parameters.Add(ProviderFactory.ServerParamID, dataStoreLogonObject.ServerName); if (dataStoreLogonObject.DataBase != null) { parameters.Add(ProviderFactory.DatabaseParamID, dataStoreLogonObject.DataBase.Name); } parameters.Add(ProviderFactory.UseIntegratedSecurityParamID, (dataStoreLogonObject.Authentication == DataStoreAuthentication.Windows) ? "true" : "false"); return(parameters); }
public void Map(Database database, IMapperInfo mapperInfo) { var attributeMapper = new AttributeMapper(_objectSpace); var tableMapper = new TableMapper(_objectSpace, database, attributeMapper); var dataTypeMapper = new DataTypeMapper(); var columnMapper = new ColumnMapper(dataTypeMapper, attributeMapper); Tracing.Tracer.LogSeparator("DBMapper Start mapping database " + database.Name); foreach (Table table in database.Tables.OfType <Table>().Where(table => !(table.IsSystemObject))) { Tracing.Tracer.LogValue("Table", table.Name); IPersistentClassInfo persistentClassInfo = tableMapper.Create(table, _persistentAssemblyInfo, mapperInfo); foreach (Column column in table.Columns) { columnMapper.Create(column, persistentClassInfo); } } _dataStoreLogonObject = (IDataStoreLogonObject)XafTypesInfo.Instance.FindBussinessObjectType <IDataStoreLogonObject>().CreateInstance(new object[] { _persistentAssemblyInfo.Session, _dataStoreLogonObject }); attributeMapper.Create(_persistentAssemblyInfo, _dataStoreLogonObject); Func <ITemplateInfo, bool> templateInfoPredicate = info => info.Name == ExtraInfoBuilder.SupportPersistentObjectsAsAPartOfACompositeKey; CodeEngine.SupportCompositeKeyPersistentObjects(_persistentAssemblyInfo, templateInfoPredicate); }
public DbMapper(XPObjectSpace objectSpace, IPersistentAssemblyInfo persistentAssemblyInfo, IDataStoreLogonObject dataStoreLogonObject) { _objectSpace = objectSpace; _persistentAssemblyInfo = persistentAssemblyInfo; _dataStoreLogonObject = dataStoreLogonObject; }
public static string GetConnectionString(this IDataStoreLogonObject dataStoreLogonObject) { return(new MSSqlProviderFactory().GetConnectionString(GetParamsDict(dataStoreLogonObject))); }
public void Create(IPersistentAssemblyInfo persistentAssemblyInfo, IDataStoreLogonObject dataStoreLogonObject) { if (persistentAssemblyInfo.PersistentClassInfos.Any()) { var persistentAssemblyDataStoreAttributeInfo = _objectSpace.CreateWCObject<IPersistentAssemblyDataStoreAttributeInfo>(); persistentAssemblyDataStoreAttributeInfo.DataStoreLogon = dataStoreLogonObject; persistentAssemblyDataStoreAttributeInfo.PersistentClassInfo = persistentAssemblyInfo.PersistentClassInfos[0]; persistentAssemblyInfo.Attributes.Add(persistentAssemblyDataStoreAttributeInfo); } }