-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve Business.EntityFramework for UnitOfWorkGeneric v3.8.0
- Loading branch information
1 parent
7d84e8a
commit 753b505
Showing
11 changed files
with
49 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
MFramework.Services.Business.EntityFramework/EFManagerWithUnitOfWorkGeneric.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using AutoMapper; | ||
using MFramework.Services.Business.EntityFramework.Abstract; | ||
using MFramework.Services.DataAccess.UnitOfWork; | ||
using MFramework.Services.Entities.Abstract; | ||
using System.Threading.Tasks; | ||
|
||
namespace MFramework.Services.Business.EntityFramework | ||
{ | ||
public partial class EFManagerWithUnitOfWorkGeneric<TEntity, TKey, TRepository, TUnitOfWork> : | ||
EFManager<TEntity, TKey, TRepository>, | ||
IEFManager<TEntity, TKey> | ||
where TEntity : EntityBase<TKey> | ||
where TRepository : class | ||
where TUnitOfWork : IUnitOfWorkGeneric | ||
{ | ||
protected readonly TUnitOfWork unitOfWork; | ||
|
||
public EFManagerWithUnitOfWorkGeneric(TUnitOfWork uow) : | ||
base(uow.GetRepository<TRepository>()) | ||
{ | ||
unitOfWork = uow; | ||
} | ||
|
||
public EFManagerWithUnitOfWorkGeneric(TUnitOfWork uow, IMapper mapper) : | ||
base(uow.GetRepository<TRepository>(), mapper) | ||
{ | ||
} | ||
|
||
public new virtual int Save() | ||
{ | ||
return unitOfWork.Commit(); | ||
} | ||
|
||
public new virtual async Task<int> SaveAsync() | ||
{ | ||
return await unitOfWork.CommitAsync(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters