feat(DbRepositoryFactory): implement IRepositoryFactory
This commit is contained in:
parent
272650d991
commit
84cd52cc45
16
DigitalData.Core.Infrastructure/DbRepositoryFactory.cs
Normal file
16
DigitalData.Core.Infrastructure/DbRepositoryFactory.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using DigitalData.Core.Abstraction.Application.Repository;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
namespace DigitalData.Core.Infrastructure;
|
||||||
|
|
||||||
|
public class DbRepositoryFactory : IRepositoryFactory
|
||||||
|
{
|
||||||
|
private readonly IServiceProvider _provider;
|
||||||
|
|
||||||
|
public DbRepositoryFactory(IServiceProvider provider)
|
||||||
|
{
|
||||||
|
_provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IRepository<TEntity> Get<TEntity>() => _provider.GetRequiredService<IRepository<TEntity>>();
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user