public static TDbContext CreateFactoryDbContext(params object[] parameters) { var buildParameters = new List <object> { DbContextFactoryBuilder.BuildOptions <TBaseDbContext>() }; buildParameters.AddRange(parameters); TDbContext context = null; try { context = (TDbContext)Activator.CreateInstance(typeof(TDbContext), buildParameters.ToArray()); } catch (Exception e) { Console.WriteLine(e); } return(context); }
public static TDbContext CreateFactoryDbContext() { var context = (TDbContext)Activator.CreateInstance(typeof(TDbContext), DbContextFactoryBuilder.BuildOptions <TBaseDbContext>()); return(context); }