Liebe Community,
ich versuche mir grade ASP.NET Core beizubringen und komme grade nicht weiter, Fehler in meinem Controller lautet:
'Der Zugriff auf "ApplicationDbContext.ProductTypes" ist aufgrund des Schutzgrads nicht möglich.
Hier der Code:
hier noch das Model:
und hier der Context:
leider verstehe ich diesen Fehler nicht. Vielleicht gibt es jemand der mir den Fehler erklären kann.
Liebe Grüße und dank im Voraus
ich versuche mir grade ASP.NET Core beizubringen und komme grade nicht weiter, Fehler in meinem Controller lautet:
'Der Zugriff auf "ApplicationDbContext.ProductTypes" ist aufgrund des Schutzgrads nicht möglich.
Hier der Code:
C#-Quellcode
- using BuchShop.Data;
- using Microsoft.AspNetCore.Mvc;
- using BuchShop.Models;
- namespace BuchShop.Areas.Admin.Controllers
- {
- [Area("Admin")]
- public class ProductTypesController : Controller
- {
- private ApplicationDbContext _db;
- public ProductTypesController(ApplicationDbContext db)
- {
- _db = db;
- }
- public IActionResult Index()
- {
- return View(_db.ProductTypes.ToList());
- }
- }
- }
hier noch das Model:
und hier der Context:
C#-Quellcode
- using BuchShop.Areas.Admin.Controllers;
- using BuchShop.Models;
- using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore;
- namespace BuchShop.Data
- {
- public class ApplicationDbContext : IdentityDbContext
- {
- public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
- : base(options)
- {
- }
- DbSet<ProductTypes> ProductTypes { get; set; }
- }
- }
leider verstehe ich diesen Fehler nicht. Vielleicht gibt es jemand der mir den Fehler erklären kann.
Liebe Grüße und dank im Voraus