From 5c3db6886a47b98679a2bcb5c7fb3a9b29d102eb Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 18 Dec 2025 22:09:45 +0100 Subject: [PATCH] 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. --- ...alData.Core.Abstraction.Application.csproj | 6 +++- .../Repository/IRepository.cs | 29 +++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/DigitalData.Core.Abstraction.Application/DigitalData.Core.Abstraction.Application.csproj b/DigitalData.Core.Abstraction.Application/DigitalData.Core.Abstraction.Application.csproj index bdd0f55..5c57408 100644 --- a/DigitalData.Core.Abstraction.Application/DigitalData.Core.Abstraction.Application.csproj +++ b/DigitalData.Core.Abstraction.Application/DigitalData.Core.Abstraction.Application.csproj @@ -37,7 +37,7 @@ enable latest - + @@ -52,24 +52,28 @@ + + + + diff --git a/DigitalData.Core.Abstraction.Application/Repository/IRepository.cs b/DigitalData.Core.Abstraction.Application/Repository/IRepository.cs index 5433e71..200032d 100644 --- a/DigitalData.Core.Abstraction.Application/Repository/IRepository.cs +++ b/DigitalData.Core.Abstraction.Application/Repository/IRepository.cs @@ -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 ExecuteSqlRawAsync([NotParameterized] string sql, IEnumerable parameters, CancellationToken cancel = default); + +#if NET + public +#endif + Task 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 { @@ -108,6 +127,4 @@ namespace DigitalData.Core.Abstraction.Application.Repository IQueryable ReadOnly(); #endregion } -#if NETFRAMEWORK - } -#endif \ No newline at end of file +} \ No newline at end of file