Пример #1
0
 public SqlDbContext(string connectionString_Read, string connectionString_ReadWrite, DataBaseType dataBaseType) : base(dataBaseType)
 {
     DbHelper.ConnString_R  = connectionString_Read;
     DbHelper.ConnString_RW = connectionString_ReadWrite;
     DbHelper.DbType        = dataBaseType;
     DataBaseName           = DataBaseAttribute.GetName(typeof(TDataBase));
 }
Пример #2
0
        protected OracleDbContext(string connectionString_Write, params string[] connectionString_Read) : base(connectionString_Write, connectionString_Read)
        {
            //add write connection to cache
            GetDbConnection(connectionString_Write);

            this.DataBaseType = CoffeeSql.Core.Configs.DataBaseType.Oracle;
            this.DataBaseName = DataBaseAttribute.GetName(typeof(TDataBase));
        }
Пример #3
0
        protected NoSqlDbContext(DataBaseType dataBaseType, string connectionString) : base(dataBaseType)
        {
            switch (dataBaseType)
            {
            case DataBaseType.MongoDB:
                Client = new MongoClient(connectionString);
                break;

            default:
                break;
            }
            DataBaseName = DataBaseAttribute.GetName(typeof(TDataBase));
        }
Пример #4
0
 protected SqlServerDbContext(string connectionString_Write, params string[] connectionStrings_Read) : base(connectionString_Write, connectionStrings_Read)
 {
     DataBaseType = DataBaseType.SqlServer;
     DataBaseName = DataBaseAttribute.GetName(typeof(TDataBase));
 }
Пример #5
0
 protected NoSqlDbContext(MongoClientSettings mongoClientSettings) : base(DataBaseType.MongoDB)
 {
     Client       = new MongoClient(mongoClientSettings);
     DataBaseName = DataBaseAttribute.GetName(typeof(TDataBase));
 }
Пример #6
0
 /// <summary>
 /// 上下文赋值
 /// </summary>
 private void SetContext()
 {
     DataBaseType = DataBaseType.MongoDB;
     DataBaseName = DataBaseAttribute.GetName(typeof(TDataBase));
 }
Пример #7
0
 protected MysqlDbContext(string connectionString_Write, params string[] connectionString_Read) : base(connectionString_Write, connectionString_Read)
 {
     this.DataBaseType = CoffeeSql.Core.Configs.DataBaseType.MySql;
     this.DataBaseName = DataBaseAttribute.GetName(typeof(TDataBase));
 }