0

I am trying to create models from database using Firebird EF from Nuget packages. I am running this command:

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

I am getting this error:

`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, Binder binder, Object[] args, CultureInfo culture)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, 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.

`

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
mpp94
  • 23
  • 1
  • 6
  • you may [run into this issue](https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.x/breaking-changes#microsoftentityframeworkcoredesign-is-now-a-developmentdependency-package) – magicandre1981 Oct 28 '20 at 14:23
  • Solved with installing nuget package Microsoft.VisualStudio.Web.CodeGeneration.Design But now I have a problem with entity classes, because they are not generated after successful run of previous command. It's only generated context class. – mpp94 Oct 28 '20 at 14:30
  • ok, post what you did to fix it as answer and ask a new question on the new issue – magicandre1981 Oct 28 '20 at 16:54
  • I have installed from nuget this package Microsoft.VisualStudio.Web.CodeGeneration.Design. Now I just have Context file created in Models folder, but without any Entity classes. That's all. No error prompted. – mpp94 Oct 29 '20 at 07:24
  • right under this question is the [answer box, just type here what you did to fix it and later accept your own answer](https://stackoverflow.com/help/self-answer) – magicandre1981 Oct 29 '20 at 09:30
  • ok, but I am still not fixed my problem. I need to find a way to pull Entity classes into Models folder. Can someone help me? – mpp94 Oct 29 '20 at 09:38
  • there is still an [open issue about this in firebird tracker](http://tracker.firebirdsql.org/browse/DNET-798) – magicandre1981 Oct 29 '20 at 11:46
  • Regarding that, it will not be done soon. 3 years passed, and it is still open issue. – mpp94 Oct 29 '20 at 11:59
  • I know, comment there again and ask for the status about the issue – magicandre1981 Oct 29 '20 at 14:36

1 Answers1

0

I have installed from nuget this package Microsoft.VisualStudio.Web.CodeGeneration.Design.

mpp94
  • 23
  • 1
  • 6