Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. public class Startup
  2. {
  3. public void ConfigureServices(IServiceCollection services)
  4. {
  5. services.AddDbContext<TodoContext>(opt => opt.UseSqlServer("Server=se00217210\\sqlexpress;Database=WebAPIDB;Trusted_Connection=True;"));
  6. services.AddMvc();
  7. }
  8.  
  9. public void Configure(IApplicationBuilder app, TodoContext context)
  10. {
  11. context.Database.EnsureCreated(); //This should create the database automatically
  12. app.UseMvc();
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement