public static IDbProvider CreateInstance(string name) { IDbProvider _instance = new SQLDbProvider(name); return _instance; }
/// <summary> /// Defines your MDBContext Connection String /// </summary> /// <param name="services"></param> /// <param name="connectionString">Connection String</param> /// <param name="provider">Specify SQL Provider, default provider is MSSQL</param> /// <returns></returns> public static IServiceCollection AddContextConnection(this IServiceCollection services, string connectionString, SQLDbProvider provider = SQLDbProvider.MSSQL) { if (string.IsNullOrEmpty(connectionString)) { throw new Exception("Please define your connection string."); } services.AddDbContext <MDbContext>(options => { if (provider == SQLDbProvider.MSSQL) { options.UseSqlServer(connectionString); } }); return(services); }