EntityFrameworkCore.OpenEdge
EntityFrameworkCore.OpenEdge copied to clipboard
Scaffold-DbContext doesn't work
Hi,
I have running an OpenEdge V12.1 database called stb. I have started VS2019, made 1 solution with some projects and I have done some Install-Package statements in the Nuget packagemanager, so far so good no problem.
I want to generate automatically the classes for my tables in database stb. I run the following in Package Manager console:
Scaffold-DbContext "Driver=Progress OpenEdge 12.1 Driver;HOST=localhost;port=12000;UID=GEERTJ01;PWD=JG1312;DIL=1;Database=stb" EntityFrameworkCore.OpenEdge -OutputDir Models
The following output appears:
Build started...
Build succeeded.
System.TypeLoadException: Method 'Create' in type 'EntityFrameworkCore.OpenEdge.Scaffolding.Internal.OpenEdgeDatabaseModelFactory' from assembly 'EntityFrameworkCore.OpenEdge, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b11b5ededc51fdb3' does not have an implementation.
at EntityFrameworkCore.OpenEdge.Design.Internal.OpenEdgeDesignTimeServices.ConfigureDesignTimeServices(IServiceCollection serviceCollection)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.ConfigureDesignTimeServices(Type designTimeServicesType, IServiceCollection services)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.ConfigureProviderServices(String provider, IServiceCollection services, Boolean throwOnError)
at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.Build(String provider)
at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluralize)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluarlize)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
**Method 'Create' in type 'EntityFrameworkCore.OpenEdge.Scaffolding.Internal.OpenEdgeDatabaseModelFactory' from assembly 'EntityFrameworkCore.OpenEdge, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b11b5ededc51fdb3' does not have an implementation.**
PM>
What is wrong here? Do I have forgotten something?
The project .cproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EntityFrameworkCore.OpenEdge" Version="1.0.12-rc3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
Thanks in advance.
Johan Geerts Progress Developer Axians
@geertsj the provider currently does not support EF Core 5.0.3 Sorry but I simply haven't had time to update it and moving from 2.x to 3.x there were some big changes that I need to address. Feel free to submit a PR to update to 5.x but in the meantime you can only use EF Core 2.x
Hi Alex,
Clear! With the packages EntityFrameworkCore.OpenEdge 1.0.12-rc3 and Microsoft.EntityFrameworkCore.Design 2.1.14 it is succeeded to scaffold my Progess database to classes.