Ejemplo n.º 1
0
 public DbModelBuilder(EntityModel entityModel, DbModelConfig config)
 {
     _entityModel = entityModel;
     _config      = config;
     _log         = entityModel.App.SystemLog;
     _driver      = _config.Driver;
 }
Ejemplo n.º 2
0
        int _tableKeyIndex; //is used to generate unique index names

        #endregion Fields

        #region Constructors

        public DbModelBuilder(EntityModel entityModel, DbModelConfig config, MemoryLog log)
        {
            _entityModel = entityModel;
              _config = config;
              _log = log;
              _driver = _config.Driver;
        }
Ejemplo n.º 3
0
        public virtual string GetDbTableViewName(EntityInfo entity, DbModelConfig config)
        {
            var name = entity.TableName;

            if (!string.IsNullOrWhiteSpace(name))
            {
                return(name);
            }
            switch (entity.Kind)
            {
            case EntityKind.View:
                name = this.ViewPrefix + entity.Name;
                break;

            case EntityKind.Table:
            default:
                name = this.TablePrefix + entity.Name;
                break;
            }
            if (config.Options.IsSet(DbOptions.AddSchemaToTableNames))
            {
                name = entity.Area.Name + "_" + name;
            }
            return(name);
        } //method
Ejemplo n.º 4
0
 public DbModelBuilder(EntityModel entityModel, DbModelConfig config, IActivationLog log)
 {
     _entityModel   = entityModel;
     _dbModelConfig = config;
     _namingPolicy  = _dbModelConfig.NamingPolicy;
     _log           = log;
     _driver        = _dbModelConfig.Driver;
 }
Ejemplo n.º 5
0
 public DbVersionInfo(EntityApp app, DbModelConfig config)
 {
     Version = app.Version;
       foreach (var m in app.Modules) {
     var schema = config.GetSchema(m.Area);
     Modules.Add(new ModuleDbVersionInfo(schema, m.Name, m.Version));
       }
 }
Ejemplo n.º 6
0
 public DbVersionInfo(EntityApp app, DbModelConfig config)
 {
     Version = app.Version;
     foreach (var m in app.Modules)
     {
         var schema = config.GetSchema(m.Area);
         Modules.Add(new ModuleDbVersionInfo(schema, m.Name, m.Version));
     }
 }
Ejemplo n.º 7
0
 /// <summary>Constructs DbModel from EntityModel.</summary>
 /// <param name="entityApp"></param>
 /// <param name="config"></param>
 internal DbModel(EntityApp entityApp, DbModelConfig config)
 {
     Util.Check(entityApp != null, "entityApp parameter may not be null.");
     EntityApp = entityApp;
     Config    = config;
     //Add schemas
     foreach (var area in entityApp.Areas)
     {
         Schemas.Add(new DbSchemaInfo(this, area, config.GetSchema(area)));
     }
     VersionInfo = new DbVersionInfo(EntityApp, Config);
 }
Ejemplo n.º 8
0
 /// <summary>Constructs DbModel from EntityModel.</summary>
 /// <param name="entityApp"></param>
 /// <param name="config"></param>
 public DbModel(EntityApp entityApp, DbModelConfig config) : this(config) {
     Util.Check(entityApp != null, "entityApp parameter may not be null.");
     EntityApp = entityApp;
     //Add schemas
     foreach (var area in entityApp.Areas)
     {
         Schemas.Add(new DbSchemaInfo(this, config.GetSchema(area)));
     }
     VersionInfo = new DbVersionInfo(EntityApp, Config);
     var nullEnt = EntityApp.Model.NullEntityInfo;
     _nullTable = new DbTableInfo(this, null, "!!NullTable", nullEnt);
 }
Ejemplo n.º 9
0
 // Use this constructor for shared db model (multi-tenant app aganst multiple identical databases)
 public DbSettings(DbModelConfig modelConfig, 
     string connectionString,
     string schemaManagementConnectionString = null,
     DbUpgradeMode upgradeMode = DbUpgradeMode.NonProductionOnly,
     DbUpgradeOptions upgradeOptions = DbUpgradeOptions.Default,
     IDbInfoService dbInfoProvider = null,
     string dataSourceName = null)
 {
     ModelConfig = modelConfig;
       ConnectionString = connectionString;
       SchemaManagementConnectionString = schemaManagementConnectionString ?? connectionString;
       UpgradeMode = upgradeMode;
       UpgradeOptions = upgradeOptions;
       DbInfoProvider = dbInfoProvider;
       DataSourceName = dataSourceName ?? DataSource.DefaultName;
 }
Ejemplo n.º 10
0
 /// <summary>Constructs an empty DbModel. This constructor is used for models loaded from database. </summary>
 /// <param name="config">DB model config object.</param>
 internal DbModel(DbModelConfig config)
 {
     Config = config;
 }
Ejemplo n.º 11
0
 /// <summary>Constructs an empty DbModel. This constructor is used for models loaded from database. </summary>
 /// <param name="config">DB model config object.</param>
 public DbModel(DbModelConfig config)
 {
     Config = config;
 }