| | | 1 | | using Elsa.Features.Attributes; |
| | | 2 | | using Elsa.Features.Services; |
| | | 3 | | using Elsa.Identity.Entities; |
| | | 4 | | using Elsa.Identity.Features; |
| | | 5 | | using JetBrains.Annotations; |
| | | 6 | | using Microsoft.Extensions.DependencyInjection; |
| | | 7 | | |
| | | 8 | | namespace Elsa.Persistence.EFCore.Modules.Identity; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// Configures the <see cref="IdentityFeature"/> feature with Entity Framework Core persistence providers. |
| | | 12 | | /// </summary> |
| | | 13 | | [DependsOn(typeof(IdentityFeature))] |
| | | 14 | | [PublicAPI] |
| | 1 | 15 | | public class EFCoreIdentityPersistenceFeature(IModule module) : PersistenceFeatureBase<EFCoreIdentityPersistenceFeature, |
| | | 16 | | { |
| | | 17 | | /// <inheritdoc /> |
| | | 18 | | public override void Configure() |
| | | 19 | | { |
| | 1 | 20 | | Module.Configure<IdentityFeature>(feature => |
| | 1 | 21 | | { |
| | 2 | 22 | | feature.UserStore = sp => sp.GetRequiredService<EFCoreUserStore>(); |
| | 2 | 23 | | feature.ApplicationStore = sp => sp.GetRequiredService<EFCoreApplicationStore>(); |
| | 2 | 24 | | feature.RoleStore = sp => sp.GetRequiredService<EFCoreRoleStore>(); |
| | 2 | 25 | | }); |
| | 1 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <inheritdoc /> |
| | | 29 | | public override void Apply() |
| | | 30 | | { |
| | 1 | 31 | | base.Apply(); |
| | 1 | 32 | | AddEntityStore<User, EFCoreUserStore>(); |
| | 1 | 33 | | AddEntityStore<Application, EFCoreApplicationStore>(); |
| | 1 | 34 | | AddEntityStore<Role, EFCoreRoleStore>(); |
| | 1 | 35 | | } |
| | | 36 | | } |