elsa-workflows / elsa-workflows/elsa-core
Elsa 3 - Elsa.EntityFrameworkCore depends on AspNetCore framework libraries
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
Elsa.EntityFrameworkCore (and subsequently Elsa.EntityFrameworkCore.SqlServer etc.) currently depend on Elsa.Identity which has dependencies on AspNetCore libraries,
This means database migrations can not be run without the AspNetCore runtime installed.
For background we don't run our EF Core migrations in process, but instead run them as part of a separate dotnet console application which is packaged into a docker container. We currently use the mcr.microsoft.com/dotnet/runtime image as the base for this, which does not include the AspNetCore runtime.
Elsa.EntityFrameworkCore depends on Elsa.Identity for the entities and some of the contracts and models.
The only one of those which has a dependency on AspNetCore is the ApiKey model (due to the IApiKey interface), which is not required by the Elsa.EntityFrameworkCore project.
My suggestion is to split the Elsa.Identity project, e.g. moving the entities, contracts and models (apart from ApiKey) into a separate project which both Elsa.Identity & Elsa.EntityFrameworkCore can then depend on.
E.g.:
Elsa.Identity.Entities
- Entities
- Models
- Contracts
Elsa.Identity (depends on Elsa.Identity.Entities & any required AspNetCore libraries)
- Endpoints
- Features
- Providers
- Services
...
Elsa.EntityFrameworkCore (depends on Elsa.Identity.Entities)
...
This however means breaking convention with all the other projects which have their contracts, entities & models in the same project as the feature, services etc. So I understand this may be a much larger change, if consistency is to be kept across the whole solution.
I'm happy to make the required changes, but am looking for feedback and suggestions on how/if the Elsa project would like to address this.
In the meantime, I can work around this by using the mcr.microsoft.com/dotnet/aspnet image as the base image for our database migrations.
Contributor guide
Research direction
Start by reviewing the dependencies of Elsa.EntityFrameworkCore, Elsa.EntityFrameworkCore.SqlServer, Elsa.Identity, and the proposed Elsa.Identity.Entities project. Check which entities, contracts, and models require AspNetCore, especially ApiKey and IApiKey. Done means migrations can run from a separate dotnet console application using the runtime image without AspNetCore, while Elsa.Identity retains its required functionality.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100