Class ServiceCollectionExtensions
- Namespace
- Savvyio.Extensions.DependencyInjection.Domain
- Assembly
- Savvyio.Extensions.DependencyInjection.dll
Extension methods for the IServiceCollection interface.
public static class ServiceCollectionExtensions
- Inheritance
-
ServiceCollectionExtensions
Methods
AddAggregateRepository<TService, TEntity, TKey>(IServiceCollection, Action<ServiceOptions>)
Adds an implementation of IAggregateRepository<TEntity, TKey> to the specified IServiceCollection.
public static IServiceCollection AddAggregateRepository<TService, TEntity, TKey>(this IServiceCollection services, Action<ServiceOptions> setup = null) where TService : class, IAggregateRepository<TEntity, TKey> where TEntity : class, IAggregateRoot<IDomainEvent, 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 configuration calls can be chained.
Type Parameters
TServiceThe type of the IAggregateRepository<TEntity, TKey> to add.
TEntityThe type of the entity.
TKeyThe type of the key that uniquely identifies the entity.
Remarks
If the underlying type of TService implements IDependencyInjectionMarker<TMarker> interface then this is automatically handled. Also, the implementation will be type forwarded accordingly.
Exceptions
- ArgumentNullException
servicescannot be null.
- See Also
-
IDependencyInjectionMarker<TMarker>IAggregateRepository<TEntity, TKey>IAggregateRepository<TEntity, TKey, TMarker>IPersistentRepository<TEntity, TKey>IPersistentRepository<TEntity, TKey, TMarker>
AddRepository<TService, TEntity, TKey>(IServiceCollection, Action<ServiceOptions>)
Adds an implementation of IPersistentRepository<TEntity, TKey> to the specified IServiceCollection.
public static IServiceCollection AddRepository<TService, TEntity, TKey>(this IServiceCollection services, Action<ServiceOptions> setup = null) where TService : class, IPersistentRepository<TEntity, TKey> 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 configuration calls can be chained.
Type Parameters
TServiceThe type of the IPersistentRepository<TEntity, TKey> to add.
TEntityThe type of the entity.
TKeyThe type of the key that uniquely identifies the entity.
Remarks
If the underlying type of TService implements IDependencyInjectionMarker<TMarker> interface then this is automatically handled. Also, the implementation will be type forwarded accordingly.
- See Also
-
IDependencyInjectionMarker<TMarker>IPersistentRepository<TEntity, TKey>IPersistentRepository<TEntity, TKey, TMarker>IWritableRepository<TEntity, TKey>IWritableRepository<TEntity, TKey, TMarker>IReadableRepository<TEntity, TKey>IReadableRepository<TEntity, TKey, TMarker>ISearchableRepository<TEntity, TKey>ISearchableRepository<TEntity, TKey, TMarker>IDeletableRepository<TEntity, TKey>IDeletableRepository<TEntity, TKey, TMarker>
AddUnitOfWork<TService>(IServiceCollection, Action<ServiceOptions>)
Adds an implementation of IUnitOfWork to the specified IServiceCollection.
public static IServiceCollection AddUnitOfWork<TService>(this IServiceCollection services, Action<ServiceOptions> setup = null) where TService : class, IUnitOfWork
Parameters
servicesIServiceCollectionThe IServiceCollection to add the service to.
setupAction<ServiceOptions>The ServiceOptions which may be configured.
Returns
- IServiceCollection
A reference to
servicesso that additional configuration calls can be chained.
Type Parameters
TServiceThe type of the IUnitOfWork to add.
Remarks
If the underlying type of TService implements IDependencyInjectionMarker<TMarker> interface then this is automatically handled. Also, the implementation will be type forwarded accordingly.
- See Also
-
IDependencyInjectionMarker<TMarker>IUnitOfWork<TMarker>