implement IRepository
This commit is contained in:
parent
453a0ccdf0
commit
7d3d3b5ae9
@ -1,6 +1,7 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace DigitalData.Core.Infrastructure;
|
||||
@ -74,4 +75,16 @@ public class DbRepository<TDbContext, TEntity> : IRepository<TEntity> where TDbC
|
||||
[Obsolete("Use IRepository<TEntity>.Get")]
|
||||
public IQueryable<TEntity> ReadOnly() => Entities.AsNoTracking();
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class DbRepository : IRepository
|
||||
{
|
||||
private readonly IServiceProvider _provider;
|
||||
|
||||
public DbRepository(IServiceProvider provider)
|
||||
{
|
||||
_provider = provider;
|
||||
}
|
||||
|
||||
public IRepository<TEntity> Entity<TEntity>() => _provider.GetRequiredService<IRepository<TEntity>>();
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user