Add EF Core support and refactor IRepository interface
Updated project dependencies to include `Microsoft.EntityFrameworkCore.Abstractions` for multiple target frameworks (`net462`, `net7.0`, `net8.0`, `net9.0`). Added `Microsoft.Extensions.*` package references to the project file. Enhanced `IRepository` interface with methods for executing raw and interpolated SQL queries (`ExecuteSqlRawAsync`, `ExecuteSqlInterpolatedAsync`, etc.). Adjusted method declarations to support conditional compilation for `NET` and `NETFRAMEWORK`. Refactored namespace structure in `IRepository.cs` to simplify and remove unnecessary conditional compilation directives.
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="7.0.16" />
|
||||
@@ -52,24 +52,28 @@
|
||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="3.1.32" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
|
||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="7.0.20" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
|
||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="8.0.15" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
|
||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="9.0.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
#if NETFRAMEWORK
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -8,11 +9,29 @@ using System.Linq;
|
||||
#endif
|
||||
|
||||
namespace DigitalData.Core.Abstraction.Application.Repository
|
||||
#if NET
|
||||
;
|
||||
#elif NETFRAMEWORK
|
||||
{
|
||||
public interface IRepository
|
||||
{
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
Task<int> ExecuteSqlRawAsync([NotParameterized] string sql, IEnumerable<object> parameters, CancellationToken cancel = default);
|
||||
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
Task<int> ExecuteSqlInterpolatedAsync(FormattableString sql, CancellationToken cancel = default);
|
||||
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
int ExecuteSqlRaw([NotParameterized] string sql, params object[] parameters);
|
||||
|
||||
#if NET
|
||||
public
|
||||
#endif
|
||||
int ExecuteSqlInterpolated(FormattableString sql);
|
||||
}
|
||||
|
||||
public interface IRepository<TEntity>
|
||||
{
|
||||
@@ -108,6 +127,4 @@ namespace DigitalData.Core.Abstraction.Application.Repository
|
||||
IQueryable<TEntity> ReadOnly();
|
||||
#endregion
|
||||
}
|
||||
#if NETFRAMEWORK
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user