Skip to content

Commit

Permalink
improve Business.EntityFramework for UnitOfWorkGeneric v3.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
muratbaseren committed May 23, 2024
1 parent 7d84e8a commit 753b505
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using AutoMapper;
using MFramework.Services.Business.EntityFramework.Abstract;
using MFramework.Services.Common.Extensions;
using MFramework.Services.DataAccess.Abstract;
using MFramework.Services.DataAccess.UnitOfWork;
using MFramework.Services.Entities.Abstract;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MFramework.Services.Business.EntityFramework
Expand All @@ -27,7 +23,7 @@ public EFManagerWithUnitOfWork(TUnitOfWork uow) :
}

public EFManagerWithUnitOfWork(TUnitOfWork uow, IMapper mapper) :
this(uow)
base(uow.GetType().GetProperty<TRepository>().GetValue(uow) as TRepository, mapper)
{
}

Expand Down
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();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageProjectUrl>https://github.com/muratbaseren/MFramework.Services</PackageProjectUrl>
<RepositoryUrl>https://github.com/muratbaseren/MFramework.Services</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>3.7.0</Version>
<Version>3.8.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Version>3.7.0</Version>
<Version>3.8.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Version>3.7.0</Version>
<Version>3.8.0</Version>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Version>3.7.0</Version>
<Version>3.8.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageProjectUrl>https://github.com/muratbaseren/MFramework.Services</PackageProjectUrl>
<RepositoryUrl>https://github.com/muratbaseren/MFramework.Services</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>3.7.0</Version>
<Version>3.8.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageProjectUrl>https://github.com/muratbaseren/MFramework.Services</PackageProjectUrl>
<RepositoryUrl>https://github.com/muratbaseren/MFramework.Services</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Version>3.7.0</Version>
<Version>3.8.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/muratbaseren/MFramework.Services</RepositoryUrl>
<PackageProjectUrl>https://github.com/muratbaseren/MFramework.Services</PackageProjectUrl>
<Version>3.7.0</Version>
<Version>3.8.0</Version>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Authors>muratbaseren</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Version>3.7.0</Version>
<Version>3.8.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Version>3.7.0</Version>
<Version>3.8.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 753b505

Please sign in to comment.