diff options
Diffstat (limited to 'dropped/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs')
-rw-r--r-- | dropped/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/dropped/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs b/dropped/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs deleted file mode 100644 index a7e5193..0000000 --- a/dropped/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs +++ /dev/null @@ -1,34 +0,0 @@ -using CrupestApi.Commons.Crud.Migrations; -using CrupestApi.Commons.Secrets; -using Microsoft.Extensions.DependencyInjection.Extensions; - -namespace CrupestApi.Commons.Crud; - -public static class CrudServiceCollectionExtensions -{ - public static IServiceCollection AddCrudCore(this IServiceCollection services) - { - services.TryAddSingleton<IDbConnectionFactory, SqliteConnectionFactory>(); - services.TryAddSingleton<IColumnTypeProvider, ColumnTypeProvider>(); - services.TryAddSingleton<ITableInfoFactory, TableInfoFactory>(); - services.TryAddSingleton<IDatabaseMigrator, SqliteDatabaseMigrator>(); - services.AddSecrets(); - return services; - } - - public static IServiceCollection AddCrud<TEntity, TCrudService>(this IServiceCollection services) where TEntity : class where TCrudService : CrudService<TEntity> - { - AddCrudCore(services); - - services.TryAddScoped<CrudService<TEntity>, TCrudService>(); - services.TryAddScoped<EntityJsonHelper<TEntity>>(); - - return services; - } - - public static IServiceCollection AddCrud<TEntity>(this IServiceCollection services) where TEntity : class - { - return services.AddCrud<TEntity, CrudService<TEntity>>(); - } - -} |