예제 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var connectionString = Configuration.GetConnectionString("DefaultConnection");

            services.AddDbContext <TodoContext>(options => DbContextConfigurer.Configure(options, connectionString));
            services.AddMvc();
        }
예제 #2
0
        public TodoContext CreateDbContext(string[] args)
        {
            var builder = new DbContextOptionsBuilder <TodoContext>();

            var connectionString = "Server=.\\SQLEXPRESS; Database=tasketeer; Trusted_Connecitdono=True;";

            DbContextConfigurer.Configure(builder, connectionString);

            return(new TodoContext(builder.Options));
        }