Class ServiceCollectionExtensions
- Namespace
- Savvyio.Extensions.DependencyInjection.EFCore
- Assembly
- Savvyio.Extensions.DependencyInjection.EFCore.dll
Extension methods for the IServiceCollection interface.
public static class ServiceCollectionExtensions
- Inheritance
-
ServiceCollectionExtensions
Methods
AddEfCoreDataSource(IServiceCollection, Action<EfCoreDataSourceOptions>, Action<ServiceOptions>)
Adds an EfCoreDataSource implementation to the specified IServiceCollection.
public static IServiceCollection AddEfCoreDataSource(this IServiceCollection services, Action<EfCoreDataSourceOptions> dataSourceSetup, Action<ServiceOptions> serviceSetup = null)
Parameters
servicesIServiceCollectionThe IServiceCollection to extend.
dataSourceSetupAction<EfCoreDataSourceOptions>The EfCoreDataSourceOptions which need to be configured.
serviceSetupAction<ServiceOptions>The ServiceOptions which may be configured.
Returns
- IServiceCollection
A reference to
servicesso that additional calls can be chained.
Remarks
The implementation will be type forwarded accordingly.
Exceptions
- ArgumentNullException
servicescannot be null.
AddEfCoreDataSource<TMarker>(IServiceCollection, Action<EfCoreDataSourceOptions<TMarker>>, Action<ServiceOptions>)
Adds an EfCoreDataSource<TMarker> implementation to the specified IServiceCollection.
public static IServiceCollection AddEfCoreDataSource<TMarker>(this IServiceCollection services, Action<EfCoreDataSourceOptions<TMarker>> dataSourceSetup, Action<ServiceOptions> serviceSetup = null)
Parameters
servicesIServiceCollectionThe IServiceCollection to extend.
dataSourceSetupAction<EfCoreDataSourceOptions<TMarker>>The EfCoreDataSourceOptions<TMarker> which need to be configured.
serviceSetupAction<ServiceOptions>The ServiceOptions which may be configured.
Returns
- IServiceCollection
A reference to
servicesso that additional calls can be chained.
Type Parameters
TMarkerThe type used to mark the implementation that this data source represents. Optimized for Microsoft Dependency Injection.
Remarks
The implementation will be type forwarded accordingly.
Exceptions
- ArgumentNullException
servicescannot be null.
AddEfCoreDataStore<T>(IServiceCollection, Action<ServiceOptions>)
Adds an implementation of EfCoreDataStore<T> to the specified IServiceCollection.
public static IServiceCollection AddEfCoreDataStore<T>(this IServiceCollection services, Action<ServiceOptions> setup = null) where T : class
Parameters
servicesIServiceCollectionThe IServiceCollection to add the service to.
setupAction<ServiceOptions>The ServiceOptions which may be configured.
Returns
- IServiceCollection
A reference to
servicesso that additional calls can be chained.
Type Parameters
TThe type of the DTO.
Exceptions
- ArgumentNullException
servicescannot be null.
AddEfCoreDataStore<T, TMarker>(IServiceCollection, Action<ServiceOptions>)
Adds an implementation of EfCoreDataStore<T> to the specified IServiceCollection.
public static IServiceCollection AddEfCoreDataStore<T, TMarker>(this IServiceCollection services, Action<ServiceOptions> setup = null) where T : class
Parameters
servicesIServiceCollectionThe IServiceCollection to add the service to.
setupAction<ServiceOptions>The ServiceOptions which may be configured.
Returns
- IServiceCollection
A reference to
servicesso that additional calls can be chained.
Type Parameters
TThe type of the DTO.
TMarkerThe type used to mark the implementation that this data access object represents. Optimized for Microsoft Dependency Injection.
Exceptions
- ArgumentNullException
servicescannot be null.
AddEfCoreRepository<TEntity, TKey>(IServiceCollection, Action<ServiceOptions>)
Adds an EfCoreRepository<TEntity, TKey> to the specified IServiceCollection.
public static IServiceCollection AddEfCoreRepository<TEntity, TKey>(this IServiceCollection services, Action<ServiceOptions> setup = null) where TEntity : class, IIdentity<TKey>
Parameters
servicesIServiceCollectionThe IServiceCollection to add the service to.
setupAction<ServiceOptions>The ServiceOptions which may be configured.
Returns
- IServiceCollection
A reference to
servicesso that additional calls can be chained.
Type Parameters
TEntityThe type of the entity.
TKeyThe type of the key that uniquely identifies the entity.
Remarks
The EfCoreRepository<TEntity, TKey> will be type forwarded to: IWritableRepository<TEntity, TKey>, IReadableRepository<TEntity, TKey>, ISearchableRepository<TEntity, TKey> and IDeletableRepository<TEntity, TKey>.
Exceptions
- ArgumentNullException
servicescannot be null.
- See Also
-
EfCoreRepository<TEntity, TKey>
AddEfCoreRepository<TEntity, TKey, TMarker>(IServiceCollection, Action<ServiceOptions>)
Adds an EfCoreRepository<TEntity, TKey, TMarker> to the specified IServiceCollection.
public static IServiceCollection AddEfCoreRepository<TEntity, TKey, TMarker>(this IServiceCollection services, Action<ServiceOptions> setup = null) where TEntity : class, IIdentity<TKey>
Parameters
servicesIServiceCollectionThe IServiceCollection to add the service to.
setupAction<ServiceOptions>The ServiceOptions which may be configured.
Returns
- IServiceCollection
A reference to
servicesso that additional calls can be chained.
Type Parameters
TEntityThe type of the entity.
TKeyThe type of the key that uniquely identifies the entity.
TMarkerThe type used to mark the implementation that this repository represents. Optimized for Microsoft Dependency Injection.
Remarks
The EfCoreRepository<TEntity, TKey, TMarker> will be type forwarded to: IWritableRepository<TEntity, TKey, TMarker>, IReadableRepository<TEntity, TKey, TMarker>, ISearchableRepository<TEntity, TKey, TMarker> and IDeletableRepository<TEntity, TKey, TMarker>.
Exceptions
- ArgumentNullException
servicescannot be null.
- See Also
-
EfCoreRepository<TEntity, TKey, TMarker>