You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
christiannagel
changed the title
Scaffolding API endpoints with primary constructors
Scaffolding API endpoints is not working with primary constructors
Nov 9, 2023
Using Visual Studio, scaffolding API endpoints with read/write endpoints, using EF Core fails when using primary constructors using C# 12.
I've already reported this with the Visual Studio Developer Community, but I think this GitHub repo is a better place: https://developercommunity.visualstudio.com/t/NET-8:-scaffolding-API-endpoints-with-r/10505296
Versions:
.NET: 8.0.100-rc.2.23502.2
Visual Studio: 17.8.0 Preview 6.0
This results in an exception, error creating the DbContext, CS1514, expects
{
instead of the primary constructor.As refactoring methods are available to use this new constructor, I expect this constructor to work with scaffolding.
See the project https://github.com/christiannagel/issues-scaffoldingapi/tree/main/PrimaryConstructor for a simple test.
Using an EF Core context with a primary constructor
When adding an EF Core context with a primary constructor, another error occurs:
See this project as a start with EF Core primary constructor: https://github.com/christiannagel/issues-scaffoldingapi/tree/main/PrimaryConstructor2
Again, I would expect this to work with primary constructors.
The text was updated successfully, but these errors were encountered: