public DefaultDbContext() { _option = new DbContextOption { ConnectionString = DBConfig.Configuration["ConnectionString"], ModelAssemblyName = DBConfig.Configuration["ModelAssemblyName"], DbType = DbType.MSSQLSERVER }; }
/// <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; }