The entity framework course is finished
This commit is contained in:
@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user