EntityFramework Firebird数据库优先

问题描述

我正在尝试使用Nuget软件包中的Firebird EF从数据库创建模型。我正在运行以下命令:

Scaffold-DbContext "User=SYSDBA;Password=xxxxxxx;Database=XXXXXXXXX;DataSource=XXXXXXXXXX;Port=3050;Dialect=3;Charset=NONE;Role=;Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0;" Firebirdsql.EntityFramework.Firebird -OutputDir Models

我收到此错误

`System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.TypeLoadException: Could not load type 'Microsoft.EntityFrameworkCore.Internal.ProductInfo' from assembly 'Microsoft.EntityFrameworkCore,Version=3.1.1.0,Culture=neutral,PublicKeyToken=adb9793829ddae60'.
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor..ctor(Object reportHandler,IDictionary args)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target,Object[] arguments,Signature sig,Boolean constructor,Boolean wrapExceptions)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr,Binder binder,Object[] parameters,CultureInfo culture)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,Object[] args,CultureInfo culture)
   at System.Activator.CreateInstance(Type type,BindingFlags bindingAttr,CultureInfo culture,Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type,Object[] args)
   at Microsoft.EntityFrameworkCore.Tools.ReflectionoperationExecutor..ctor(String assembly,String startupAssembly,String projectDir,String dataDirectory,String rootNamespace,String language)
   at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor()
   at Microsoft.EntityFrameworkCore.Tools.Commands.DbContextScaffoldCommand.Execute()
   at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__displayClass0_0.<Configure>b__0()
   at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Exception has been thrown by the target of an invocation.

`

解决方法

我已经从nuget包中安装了Microsoft.VisualStudio.Web.CodeGeneration.Design。