public EntityFrameworkSourceContext GetContext() { EntityFrameworkSourceContext sourceContext = new EntityFrameworkSourceContext(); if (key == "InventoryContext") { sourceContext.DbContext = new InventoryContext(); } return(sourceContext); }
public EntityFrameworkSourceContext GetContext() { EntityFrameworkSourceContext sourceContext = new EntityFrameworkSourceContext(); var builder = new ConfigurationBuilder().AddJsonFile("appsettings.json"); IConfigurationRoot Configuration = builder.Build(); if (typeof(T).Equals(typeof(Models.Customer))) { string connection = Configuration["InventoryContext"]; sourceContext.DbContext = new InventoryContext(connection); } return(sourceContext); }