Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflow-core SqlServer persistence currently doesn't work on EF core 3.0 #413

Closed
ThomasBergholdWieser opened this issue Oct 3, 2019 · 15 comments

Comments

@ThomasBergholdWieser
Copy link

ThomasBergholdWieser commented Oct 3, 2019

workflow-core uses

Microsoft.EntityFrameworkCore.Design 2.1.0

which has breaking changes going up to 3.0.0 version. When starting a fresh project using SqlServer as Persistency provider, the app will crash with:

System.AggregateException: One or more errors occurred. (Method not found: 'Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder`1.HasIndex(System.Linq.Expressions.Expression`1<System.Func`2<!0,System.Object>>)'.) ---> System.MissingMethodException: Method not found: 'Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder`1.HasIndex(System.Linq.Expressions.Expression`1<System.Func`2<!0,System.Object>>)'. at WorkflowCore.Persistence.EntityFramework.Services.WorkflowDbContext.OnModelCreating(ModelBuilder modelBuilder) at Microsoft.EntityFrameworkCore.Infrastructure.ModelCustomizer.Customize(ModelBuilder modelBuilder, DbContext context) at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.CreateModel(DbContext context, IConventionSetBuilder conventionSetBuilder) at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.<>c__DisplayClass5_0.<GetModel>b__1() at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy`1.CreateValue() at System.Lazy`1.get_Value() at Microsoft.EntityFrameworkCore.Infrastructure.ModelSource.GetModel(DbContext context, IConventionSetBuilder conventionSetBuilder) at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel() at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model() at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.<TryAddCoreServices>b__7_3(IServiceProvider p) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScopeCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies() at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider() at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance() at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance() at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.GetRelationalService[TService](IInfrastructure`1 databaseFacade) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade) at WorkflowCore.Persistence.EntityFramework.Services.EntityFrameworkPersistenceProvider.EnsureStoreExists() at WorkflowCore.Services.WorkflowHost.StartAsync(CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait()

The reason is this Breaking change:
https://github.com/aspnet/EntityFramework.Docs/blob/master/entity-framework/core/what-is-new/ef-core-3.0/breaking-changes.md#forsqlserverhasindex-replaced-with-hasindex

@ThomasBergholdWieser ThomasBergholdWieser changed the title workflow-core currently doesn't work on .net core 3.0 workflow-core sqlserver persistency currently doesn't work on .net core 3.0 Oct 3, 2019
@ThomasBergholdWieser ThomasBergholdWieser changed the title workflow-core sqlserver persistency currently doesn't work on .net core 3.0 workflow-core SqlServer persistency currently doesn't work on .net core 3.0 Oct 3, 2019
@ssm-dev
Copy link

ssm-dev commented Oct 11, 2019

the same problem :-(

@ericwp
Copy link

ericwp commented Oct 14, 2019

The same problem when we upgraded to .net core 3.0.
Is there any plan to upgrade workflow-core to core 3.0? If not we must to stop our upgrade :-(

@ThomasBergholdWieser
Copy link
Author

Just a heads up for you guys with the same problem, right now you can just clone the source and include the 2 needed projects directly into your source without needing any other adjustments until this gets fixed. As we are still in early development phase, this is a feasable workaround for us.

@ericwp
Copy link

ericwp commented Oct 14, 2019

@ThomasBergholdWieser Thanks for your feedback :-)

@danielgerlag danielgerlag changed the title workflow-core SqlServer persistency currently doesn't work on .net core 3.0 workflow-core SqlServer persistence currently doesn't work on EF core 3.0 Oct 15, 2019
@danielgerlag
Copy link
Owner

Just to be clear, this is not a .net core 3.0 issue... it is an EF core 3.0 issue. There is no reason you can't still use EF core 2 with .net core 3.

@ericwp
Copy link

ericwp commented Oct 15, 2019

@danielgerlag Thanks for your great work and feedback :-). As you point out, that caused by WorkflowCore.Persistence.SqlServer dependency “Microsoft.EntityFrameworkCore.SqlServer (>= 2.1.0)" which reference the latest packages(3.0) , same dependencies in WorkflowCore.Persistence.EntityFramework "Microsoft.EntityFrameworkCore (>= 2.1.0)" and "Microsoft.EntityFrameworkCore.Relational (>= 2.1.0)". That would be better you can limit the large version in packages. That would be a fast fix I guess. Also I can package it in my local to wait new version release.

@sev-g
Copy link

sev-g commented Nov 4, 2019

@danielgerlag Hi!
Could you please let us know if you have any plans to upgrade to .NET Core 3.0 (or 3.1)?
Thank you!

@danielgerlag
Copy link
Owner

@SevastianGioanca WorkflowCore does not target .Net Core, it targets .Net Standard 2 and .Net Standard 2 libraries can run on applications that target .Net Core 3.0

https://docs.microsoft.com/en-us/dotnet/standard/net-standard

@danielgerlag
Copy link
Owner

#445

@danielgerlag
Copy link
Owner

We will have to fork the EF providers for EF 3 and EF 2

@Viktor-36
Copy link

Just a heads up for you guys with the same problem, right now you can just clone the source and include the 2 needed projects directly into your source without needing any other adjustments until this gets fixed. As we are still in early development phase, this is a feasable workaround for us.

I used same solution for now and it works fine. You only need to update EF Core to version 3.0.

@olegkap
Copy link

olegkap commented Nov 18, 2019

Just a heads up for you guys with the same problem, right now you can just clone the source and include the 2 needed projects directly into your source without needing any other adjustments until this gets fixed. As we are still in early development phase, this is a feasable workaround for us.

I used same solution for now and it works fine. You only need to update EF Core to version 3.0.

Same for me, I copied WorkflowCore.Persistence.SqlServer and WorkflowCore.Persistence.EntityFramework projects to my solution and refernce them.
The only few updates I made is to change target ".NET Standart 2.1" and repalce UseSqlServerIdentityColumn with UseIdentityColumn

@cyyeap
Copy link

cyyeap commented Nov 27, 2019

@olegkap and @Viktor-36's solution works, wonder if we make a pull request with this solution. Would @danielgerlag accept it?

We have many microservices that are using EF core 3.0, downgrading and re-upgrading them will be painful.

@danielgerlag
Copy link
Owner

You can still use EF core 2 with .Net core 3. Are there specific features of EF core 3 you need?
The problem with upgrading the EF core 3, is that it will no longer be compatible with .NET framework (only .NET core). So we have to either fork all the EF projects to support both, or move away from EF to another ORM that has better cross platform support.

@danielgerlag
Copy link
Owner

It looks like there will be a release of EF Core 3 that targets .NET Standard 2.0...
dotnet/efcore#18141 (comment)
I think we should wait for that to be released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants