AspNetCoreGraphQL-MyHotel icon indicating copy to clipboard operation
AspNetCoreGraphQL-MyHotel copied to clipboard

Move database configuration to config file instead of hardcoding

Open StefH opened this issue 4 years ago • 0 comments

Use:

services.AddDbContext<MyHotelDbContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:MyHotelDb"]));

And define appsettings .Development.json like:

"ConnectionStrings": {
    "MyHotelDb": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=MyHoteDbl;Trusted_Connection=True;MultipleActiveResultSets=true"
  },

StefH avatar Aug 03 '19 15:08 StefH