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
Trying to generate a .dgml model diagram. When I select the option, I get an error that DbContext must have a parameterless constructor.
System.ArgumentException: Error:
Microsoft.EntityFrameworkCore.Design.OperationException: Unable to create an object of type 'CampaignContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
---> System.MissingMethodException: No parameterless constructor defined for type 'Repository.CampaignContext'.
at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.<>c__DisplayClass13_3.<FindContextTypes>b__13()
--- End of inner exception stack trace ---
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.<>c__DisplayClass13_3.<FindContextTypes>b__13()
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(Func`1 factory)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
at ReverseEngineer20.EfCoreModelBuilder.BuildResult(String outputPath, Boolean generateDdl) in C:\Code\EFCorePowerTools\src\GUI\efpt\EFCoreModelBuilder.cs:line 39
at ReverseEngineer20.Program.Main(String[] args) in C:\Code\EFCorePowerTools\src\GUI\efpt\Program.cs:line 44
Parameter name: processResult
at EFCorePowerTools.Handlers.ModelAnalyzerHandler.Generate(String outputPath, Project project, GenerationType generationType) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ModelAnalyzerHandler.cs:line 72
The parameterless constructor also requires that I set a connection to the database. This is probably because I use that connection string in the
I would think that 'Add DbContext Model Diagram' wouldn't require connection to the database or parameterless constructor but just look at the model configuration.
The link provided in the exception message does say that the tools require a parameterless constructor but I wonder if there a workaround for this? I don't want to introduce code (parameterless constructor with a connection) that isn't required for my application.
Steps to reproduce
Right-click on a project that contains DbContext
Select Add DbContext Model Diagram
Further technical details
EF Core Power Tools version: 2.3.92.0
Database engine:
MySQL
Using package - Pomelo EF for MySql
Visual Studio version: (e.g. Visual Studio 2019 16.4.2)
The text was updated successfully, but these errors were encountered:
Trying to generate a .dgml model diagram. When I select the option, I get an error that DbContext must have a parameterless constructor.
The parameterless constructor also requires that I set a connection to the database. This is probably because I use that connection string in the
I would think that 'Add DbContext Model Diagram' wouldn't require connection to the database or parameterless constructor but just look at the model configuration.
The link provided in the exception message does say that the tools require a parameterless constructor but I wonder if there a workaround for this? I don't want to introduce code (parameterless constructor with a connection) that isn't required for my application.
Steps to reproduce
Further technical details
EF Core Power Tools version: 2.3.92.0
Database engine:
MySQL
Using package - Pomelo EF for MySql
Visual Studio version: (e.g. Visual Studio 2019 16.4.2)
The text was updated successfully, but these errors were encountered: