If I set up an empty view, and link to it, it gets there just fine. Once I add database info, then it fails.
UPDATE:
So I have added this since, but I am faced with another error.
private ApplicationDbContext db = new ApplicationDbContext();
public ActionResult Index()
{
return View(db.Hikers);
}
Error reads:
An unhandled exception occurred while processing the request.
InvalidOperationException: No database provider has been configured for this DbContext. A provider can be configured by overriding the DbContext.OnConfiguring method or by using AddDbContext on the application service provider. If AddDbContext is used, then also ensure that your DbContext type accepts a DbContextOptions<TContext> object in its constructor and passes it to the base constructor for DbContext.
Microsoft.EntityFrameworkCore.Internal.DbContextServices.Initialize(IServiceProvider scopedProvider, IDbContextOptions contextOptions, DbContext context)
Glad you fixed the issue with the model. Unfortunately I'm not going to be able to help with the latter issue but I'd imagine the best place to start is the Entity Framework Core docs: docs.microsoft.com/en-us/ef/core/
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It’s a little hard to tell but the only thing I can think of is that your view is expecting a model but you’re not providing one.
What I have for the Hikers view, which should display all of the hikers. Shouldn't that first line do the trick?
If I set up an empty view, and link to it, it gets there just fine. Once I add database info, then it fails.
UPDATE:
So I have added this since, but I am faced with another error.
Error reads:
Glad you fixed the issue with the model. Unfortunately I'm not going to be able to help with the latter issue but I'd imagine the best place to start is the Entity Framework Core docs: docs.microsoft.com/en-us/ef/core/