The entity framework course is finished

This commit is contained in:
2020-01-22 23:02:33 +01:00
parent cc8eb0302e
commit 8d11b258bd
6 changed files with 25 additions and 10 deletions

View File

@ -6,10 +6,23 @@ namespace EntityFrameworkBasics.Controllers
{
public class HomeController : Controller
{
#region Protected members
protected ApplicationDBContext context;
#endregion
/// <summary>
/// Default constructor
/// </summary>
/// <param name="_context">the injected context</param>
public HomeController(ApplicationDBContext _context)
{
context = _context;
}
public IActionResult Index()
{
// No using statement because of the DI and IoC
var context = IoC.ApplicationDbContext;
context.Database.EnsureCreated();