@@ -71,23 +71,9 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||
bool autoSave = false, bool ignoreQueryFilter = false) where T : Entity;
|
||||
}
|
||||
|
||||
public class Repository : IRepository
|
||||
public class Repository(IRaCISDBContext _dbContext, IMapper _mapper, IUserInfo _userInfo) : IRepository
|
||||
{
|
||||
#region 构造 基本
|
||||
private IRaCISDBContext _dbContext { get; }
|
||||
public IMapper _mapper { get; set; }
|
||||
|
||||
public IUserInfo _userInfo { get; set; }
|
||||
|
||||
public IStringLocalizer _localizer { get; set; }
|
||||
|
||||
public Repository(IRaCISDBContext dbContext, IMapper mapper, IUserInfo userInfo, IStringLocalizer localizer)
|
||||
{
|
||||
_localizer = localizer;
|
||||
_dbContext = dbContext;
|
||||
_mapper = mapper;
|
||||
_userInfo = userInfo;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置是使用哪个仓储 默认不跟踪
|
||||
@@ -171,7 +157,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||
if (dbEntity == null)
|
||||
{
|
||||
|
||||
throw new BusinessValidationFailedException(_localizer["Repository_UpdateError"]);
|
||||
throw new BusinessValidationFailedException(I18n.T("Repository_UpdateError"));
|
||||
}
|
||||
|
||||
var dbBeforEntity = dbEntity.Clone();
|
||||
@@ -450,7 +436,6 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||
if (dbEntity == null)
|
||||
{
|
||||
|
||||
throw new BusinessValidationFailedException(_localizer["Repository_UpdateError"]);
|
||||
throw new BusinessValidationFailedException(I18n.T("Repository_UpdateError"));
|
||||
}
|
||||
|
||||
var dbBeforEntity = dbEntity.Clone();
|
||||
@@ -156,7 +156,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||
|
||||
if (searchEntity == null)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["Repository_UpdateError"]);
|
||||
throw new BusinessValidationFailedException(I18n.T("Repository_UpdateError"));
|
||||
}
|
||||
|
||||
_dbContext.EntityModifyPartialFiled(searchEntity, updateFactory);
|
||||
@@ -208,7 +208,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||
|
||||
if (waitDelete == null)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["Repository_DeleteError"]);
|
||||
throw new BusinessValidationFailedException(I18n.T("Repository_DeleteError"));
|
||||
}
|
||||
|
||||
await DeleteAsync(waitDelete, autoSave);
|
||||
|
||||
Reference in New Issue
Block a user