Elsa workflow engine

Hi guys,

I'm trying to integrate Elsa Workflow Engine in a blazor server-side app. I have problems with assembly versions:

error NU1605:  TestElsa -> Elsa.Persistence.EntityFramework.Sqlite 2.3.0 -> Elsa.Persistence.EntityFramework.Core 2.3.0 -> Microsoft.EntityFrameworkCore (>= 5.0.10)

In .csproj file, assembly version is

<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.1" />

In another project outside Radzen I don't have this reference and is working fine:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Elsa" Version="2.3.0" />
    <PackageReference Include="Elsa.Activities.Http" Version="2.3.0" />
    <PackageReference Include="Elsa.Activities.Temporal.Quartz" Version="2.3.0" />
    <PackageReference Include="Elsa.Designer.Components.Web" Version="2.3.0" />
    <PackageReference Include="Elsa.Persistence.EntityFramework.Sqlite" Version="2.3.0" />
    <PackageReference Include="Elsa.Server.Api" Version="2.3.0" />
  </ItemGroup>

</Project>

How can I resolve this issue?

Thanks in advance

Did you try updating the version in the csproj?

Yes, I tried but new error occurs:

dotnet: C:\Labs\Radzen\TestElsa\server\Services\CrmService.cs(500,32): error CS0121: La llamada es ambigua entre los métodos o las propiedades siguientes: 'System.Linq.AsyncEnumerable.Where<TSource>(System.Collections.Generic.IAsyncEnumerable<TSource>, System.Func<TSource, bool>)' y 'System.Linq.Queryable.Where<TSource>(System.Linq.IQueryable<TSource>, System.Linq.Expressions.Expression<System.Func<TSource, bool>>)' [C:\Labs\Radzen\TestElsa\server\TestElsa.csproj]

I am afraid I can't reproduce such an error with a default Radzen application scaffolded from the Sample MSSQL database. Is this service created by Radzen? What is the code which generates the error?

Yes, is Radzen generated code.

I found this issue but I don't know what can be done to fix the error: https://github.com/dotnet/efcore/issues/18124

It seems to be incompatibility by System.Interactive.Async and Entity Framework. The former defines extension methods in System.Linq which Radzen services import by default. Those conflict with the extension methods of Entity Framework.

Thank for your response.

I will move Elsa workflow to an independent project using my workflows with an API layer. Then I will try to connect this API to Radzen.

Regards

You can try the solution in this comment: https://github.com/dotnet/efcore/issues/18124#issuecomment-538399013

That is to define your own extension methods in the same namespace as CrmService. The compiler should pick thtem up before the ones that cause the conflict:

namespace MyAppNamespace.Data
{
   public static class QueryableExtensions
   {
       public static IQueryable<TEntity> Where<TEntity>(this Microsoft.EntityFrameworkCore.DbSet<TEntity> obj, System.Linq.Expressions.Expression<Func<TEntity, bool>> predicate) where TEntity : class
       {
          return System.Linq.Queryable.Where(obj, predicate);
       }
   }
}

It's working with suggested workaround!

Thanks.