private UnitOfWork CreateUnitOfWork() { DesignTimeDbContextFactory designTimeDbContextFactory = new DesignTimeDbContextFactory(); context = designTimeDbContextFactory.CreateDbContext(new string[] { }); return(new UnitOfWork(context)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { DesignTimeDbContextFactory designTimeDbContextFactory = new DesignTimeDbContextFactory(); HangoutsContext context = designTimeDbContextFactory.CreateDbContext(new String[] { }); DbInitializer.Initialize(context); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()); app.UseMvc(); }
static void Main(string[] args) { DesignTimeDbContextFactory designTimeDbContextFactory = new DesignTimeDbContextFactory(); HangoutsContext context = designTimeDbContextFactory.CreateDbContext(args); using (var db = context) { DbInitializer.Initialize(db); UnitOfWork unitOfWork = new UnitOfWork(context); ConsoleUI console = new ConsoleUI(unitOfWork); console.start(); Console.ReadLine(); } }
public AbstractRepository(HangoutsContext context) { this.context = context; dbSet = context.Set <E>(); }
public UnitOfWork(HangoutsContext context) { this.context = context; }