refactor(DbRepositoryFactory): remvoed
This commit is contained in:
@@ -4,6 +4,8 @@ using DigitalData.Core.Abstractions.Interfaces;
|
||||
using DigitalData.Core.Infrastructure.Factory;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
#if NETFRAMEWORK
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
@@ -130,14 +132,14 @@ public class DbRepository<TDbContext, TEntity> : IRepository<TEntity> where TDbC
|
||||
|
||||
public class DbRepository : IRepository
|
||||
{
|
||||
private readonly IRepositoryFactory _factory;
|
||||
private readonly IServiceProvider _provider;
|
||||
|
||||
public DbRepository(IRepositoryFactory factory)
|
||||
public DbRepository(IServiceProvider provider)
|
||||
{
|
||||
_factory = factory;
|
||||
_provider = provider;
|
||||
}
|
||||
|
||||
public IRepository<TEntity> Entity<TEntity>() where TEntity : IEntity => _factory.Get<TEntity>();
|
||||
public IRepository<TEntity> Entity<TEntity>() where TEntity : IEntity => _provider.GetRequiredService<IRepository<TEntity>>();
|
||||
}
|
||||
|
||||
#if NETFRAMEWORK
|
||||
|
||||
Reference in New Issue
Block a user