AddEfCoreRepository Method
Definition
- Namespace
- Savvyio.Extensions.DependencyInjection.EFCore
- Assemblies
- Savvyio.Extensions.DependencyInjection.EFCore.dll
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>