SqlServerCompact EFCore Model Generation

57 Views Asked by At

I want to generate a EF Model in a C# WindowsForm project (under .NET6 ) from a SQLServerCompact file.

Using Scaffold-DbContext command (see below) I receive an error:

Method ‘Create’ in type ‘EFCore.SqlCe.Scaffolding.Internal.SqlCeDatabaseModelFactory’ from assembly ‘EntityFrameworkCore.SqlServerCompact40, Version=2.2.0.0, Culture=neutral, PublicKeyToken=9af395b34ac99006’ does not have an implementation.

this is the command executed

Scaffold-DbContext -Connection “Data Source= C:\temp\TestModelEFCore\TestModelEFCore\dbsqlcompact\gsdata.sdf;” -Provider EntityFrameworkCore.SqlServerCompact40 -OutputDir dbsqlcompact/Entities -ContextDir DatabaseModel -Context MyContext -UseDatabaseNames -f -Verbose

enter image description here

Any suggestion? I saw this is a deprecated package: EntityFrameworkCore.SqlServerCompact40.

thank you

1

There are 1 best solutions below

4
ErikEJ On

You cannot mix major versions, if you really MUST use that deprecated provider, your must use EF Core 2.2 everywhere.