Closed ErikEJ closed 2 years ago
Hi Eric, this appears to work fine with .NET 6 as of 2.0 - have you tried the sample project?
No, but I tried a project like this: https://github.com/davidfowl/CommunityStandUpMinimalAPI/blob/main/TodoApi/Program.cs#L8
Maybe the issue is use of "AddSqlite" / "AddSqlServer" instead of the previous AddDbContext ?
That's interesting, I'll take a look. Thanks.
Have you added
app.MapDefaultControllerRoute();
To Program.cs?
Here is a working example with SQLLite in a branch - https://github.com/edandersen/core-admin/blob/sqllite/src/DotNetEd.CoreAdmin.DemoAppDotNet6/Program.cs
If you check the repo out and run the DemoAppDotNet6
project it should work.
Great - I will have a look
OMG, I was doing this:
builder.Services.AddCoreAdmin();
builder.Services.AddSqlServer<NorthwindContext>("Data Source=.\\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=true;");
Fixed with:
builder.Services.AddSqlServer<NorthwindContext>("Data Source=.\\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=true;");
builder.Services.AddCoreAdmin();
Wonder if the docs could be clearer?
Added a PR
@ErikEJ this fixed the issue for me too! I just had to add builder.Services.AddCoreAdmin()
AFTER builder.Services.AddDbContext
, not before.
(I didn't need app.MapDefaultControllerRoute()
btw)
I would like to blog about this great tool, but no DbContext seems to be found, maybe a duplicate of #17?