Exemplo n.º 1
0
 public DefaultDbContext()
 {
     _option = new DbContextOption
     {
         ConnectionString  = DBConfig.Configuration["ConnectionString"],
         ModelAssemblyName = DBConfig.Configuration["ModelAssemblyName"],
         DbType            = DbType.MSSQLSERVER
     };
 }
Exemplo n.º 2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="option"></param>
 public DefaultDbContext(DbContextOption option)
 {
     if (option == null)
     {
         throw new ArgumentNullException(nameof(option));
     }
     if (string.IsNullOrEmpty(option.ConnectionString))
     {
         throw new ArgumentNullException(nameof(option.ConnectionString));
     }
     if (string.IsNullOrEmpty(option.ModelAssemblyName))
     {
         throw new ArgumentNullException(nameof(option.ModelAssemblyName));
     }
     _option = option;
 }