How do you pass a connection string into "dbcontext"?
Posted: Mon 27 Nov 2017 23:56
You can use Entity Framework as such, but how do you pass a connection string to "MyDbContext"?
Code: Select all
using (var context = new MyDbContext())
{
var myItem= new Item
{
Name = "hello"
};
context.Add(myItem);
context.SaveChanges();
}