Exemplo n.º 1
0
        /// <summary>
        /// 根据db类型和db名称获取执行content
        /// </summary>
        public static DbContext <EmptyEntity> EmptyDb(string _dbMappingName)
        {
            var dbProvider = AntData.ORM.Common.Configuration.DBSettings.DatabaseSettings.FirstOrDefault(r => r.Name.Equals(_dbMappingName));
            var _dbType    = dbProvider?.Provider;

            if (string.IsNullOrEmpty(_dbType))
            {
                return(null);
            }

            DbContext <EmptyEntity> db;

            if (_dbType.ToLower().Contains("mysql"))
            {
                db = new MysqlDbContext <EmptyEntity>(_dbMappingName);
            }
            else
            {
                db = new SqlServerlDbContext <EmptyEntity>(_dbMappingName);
            }

#if DEBUG
            db.IsEnableLogTrace = true;
            db.OnLogTrace       = OnCustomerTraceConnection;
#endif
            return(db);
        }
Exemplo n.º 2
0
 public static void MyClassInitialize(TestContext testContext)
 {
     DB = new SqlServerlDbContext <Entitys>("testorm_sqlserver");
     AntData.ORM.Common.Configuration.Linq.AllowMultipleQuery = true;
     //Insert的时候 忽略Null的字段
     AntData.ORM.Common.Configuration.Linq.IgnoreNullInsert = true;
     DB.IsEnableLogTrace = true;
     DB.OnLogTrace       = OnCustomerTraceConnection;
     DB.IsNoLock         = true;
 }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            DB = new SqlServerlDbContext <Entitys>("testorm_sqlserver");
            AntData.ORM.Common.Configuration.Linq.AllowMultipleQuery = true;
            //Insert的时候 忽略Null的字段
            AntData.ORM.Common.Configuration.Linq.IgnoreNullInsert = true;
            DB.IsEnableLogTrace = true;
            DB.OnLogTrace       = OnCustomerTraceConnection;
            DB.IsNoLock         = true;

            var p = DB.Tables.People.FirstOrDefault();

            Console.WriteLine(p.Name);
            Console.ReadLine();
        }