コード例 #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
ファイル: DbContextFactory.cs プロジェクト: mhzehl/Tasketeer
        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));
        }