| | | 1 | | using CShells.Features; |
| | | 2 | | using Elsa.Common.Multitenancy; |
| | | 3 | | using Elsa.Extensions; |
| | | 4 | | using Elsa.Platform.PackageManifest.Generator.Hints; |
| | | 5 | | using JetBrains.Annotations; |
| | | 6 | | using Microsoft.Extensions.DependencyInjection; |
| | | 7 | | |
| | | 8 | | namespace Elsa.Tenants.ShellFeatures; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// Enables tenant management capabilities. |
| | | 12 | | /// </summary> |
| | | 13 | | [ManifestFeatureCategory("Tenancy")] |
| | | 14 | | [ShellFeature( |
| | | 15 | | DisplayName = "Tenant Management", |
| | | 16 | | Description = "Provides tenant store and management capabilities")] |
| | | 17 | | [UsedImplicitly] |
| | | 18 | | public class TenantManagementFeature : IShellFeature |
| | | 19 | | { |
| | | 20 | | /// <summary> |
| | | 21 | | /// A factory that instantiates an <see cref="ITenantStore"/>. |
| | | 22 | | /// </summary> |
| | 0 | 23 | | public Func<IServiceProvider, ITenantStore> TenantStoreFactory { get; set; } = sp => sp.GetRequiredService<MemoryTen |
| | | 24 | | |
| | | 25 | | public void ConfigureServices(IServiceCollection services) |
| | | 26 | | { |
| | 0 | 27 | | services |
| | 0 | 28 | | .AddMemoryStore<Tenant, MemoryTenantStore>() |
| | 0 | 29 | | .AddScoped(TenantStoreFactory); |
| | 0 | 30 | | } |
| | | 31 | | } |
| | | 32 | | |