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:
@@ -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