diff options
author | crupest <crupest@outlook.com> | 2022-12-14 15:58:41 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-12-20 20:32:53 +0800 |
commit | 94d39ea715ae81ef93e1bc289762b7500db197f9 (patch) | |
tree | 5a2ee9b099b72f15df1384f6b095b2b9d301d587 /docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs | |
parent | 799170d34c8b59116895f07328412c4b2236b39e (diff) | |
download | crupest-94d39ea715ae81ef93e1bc289762b7500db197f9.tar.gz crupest-94d39ea715ae81ef93e1bc289762b7500db197f9.tar.bz2 crupest-94d39ea715ae81ef93e1bc289762b7500db197f9.zip |
Develop secret api. v38
Diffstat (limited to 'docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs')
-rw-r--r-- | docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs index 29504f4..8854976 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs +++ b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/CrudServiceCollectionExtensions.cs @@ -4,11 +4,21 @@ namespace CrupestApi.Commons.Crud; public static class CrudServiceCollectionExtensions { - public static IServiceCollection UseCrud(this IServiceCollection services) + public static IServiceCollection AddCrudCore(this IServiceCollection services) { services.TryAddSingleton<IDbConnectionFactory, SqliteConnectionFactory>(); services.TryAddSingleton<IColumnTypeProvider, ColumnTypeProvider>(); services.TryAddSingleton<ITableInfoFactory, TableInfoFactory>(); return services; } + + public static IServiceCollection AddCrud<TEntity>(this IServiceCollection services) where TEntity : class + { + AddCrudCore(services); + + services.TryAddScoped<CrudService<TEntity>>(); + services.TryAddScoped<EntityJsonHelper<TEntity>>(); + + return services; + } } |