From 47cd7268d0a9e7b1b3b35290d4f12ef7895f0453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sun, 3 Sep 2023 14:11:25 +0300 Subject: [PATCH] Remove unnecessary TKey restriction --- .../Repositories/ISupportsExplicitLoading.cs | 4 ++-- .../Domain/Repositories/RepositoryExtensions.cs | 16 ++++++++-------- .../EntityFrameworkCore/EfCoreRepository.cs | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/ISupportsExplicitLoading.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/ISupportsExplicitLoading.cs index 1c51954f57..5131486c1e 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/ISupportsExplicitLoading.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/ISupportsExplicitLoading.cs @@ -7,8 +7,8 @@ using Volo.Abp.Domain.Entities; namespace Volo.Abp.Domain.Repositories; -public interface ISupportsExplicitLoading - where TEntity : class, IEntity +public interface ISupportsExplicitLoading + where TEntity : class, IEntity { Task EnsureCollectionLoadedAsync( TEntity entity, diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs index cbebf62196..e5c2eb9a3f 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs @@ -15,16 +15,16 @@ namespace Volo.Abp.Domain.Repositories; public static class RepositoryExtensions { - public async static Task EnsureCollectionLoadedAsync( - this IBasicRepository repository, + public async static Task EnsureCollectionLoadedAsync( + this IBasicRepository repository, TEntity entity, Expression>> propertyExpression, CancellationToken cancellationToken = default ) - where TEntity : class, IEntity + where TEntity : class, IEntity where TProperty : class { - var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading; + var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading; if (repo != null) { await repo.EnsureCollectionLoadedAsync(entity, propertyExpression, cancellationToken); @@ -40,7 +40,7 @@ public static class RepositoryExtensions where TEntity : class, IEntity where TProperty : class { - var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading; + var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading; if (repo != null) { await repo.EnsurePropertyLoadedAsync(entity, propertyExpression, cancellationToken); @@ -60,12 +60,12 @@ public static class RepositoryExtensions } } - public async static Task EnsureExistsAsync( - this IRepository repository, + public async static Task EnsureExistsAsync( + this IRepository repository, Expression> expression, CancellationToken cancellationToken = default ) - where TEntity : class, IEntity + where TEntity : class, IEntity { if (!await repository.AnyAsync(expression, cancellationToken)) { diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs index 325ba8345d..581396a390 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs @@ -464,7 +464,7 @@ public class EfCoreRepository : RepositoryBase, IE public class EfCoreRepository : EfCoreRepository, IEfCoreRepository, - ISupportsExplicitLoading + ISupportsExplicitLoading where TDbContext : IEfCoreDbContext where TEntity : class, IEntity