Browse Source

Merge branch 'dev' into IsChangeTrackingEnabled

pull/17491/head
Halil İbrahim Kalkan 3 years ago
parent
commit
2091b7970f
  1. 4
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/ISupportsExplicitLoading.cs
  2. 16
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs
  3. 2
      framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs

4
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; namespace Volo.Abp.Domain.Repositories;
public interface ISupportsExplicitLoading<TEntity, TKey> public interface ISupportsExplicitLoading<TEntity>
where TEntity : class, IEntity<TKey> where TEntity : class, IEntity
{ {
Task EnsureCollectionLoadedAsync<TProperty>( Task EnsureCollectionLoadedAsync<TProperty>(
TEntity entity, TEntity entity,

16
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 static class RepositoryExtensions
{ {
public async static Task EnsureCollectionLoadedAsync<TEntity, TKey, TProperty>( public async static Task EnsureCollectionLoadedAsync<TEntity, TProperty>(
this IBasicRepository<TEntity, TKey> repository, this IBasicRepository<TEntity> repository,
TEntity entity, TEntity entity,
Expression<Func<TEntity, IEnumerable<TProperty>>> propertyExpression, Expression<Func<TEntity, IEnumerable<TProperty>>> propertyExpression,
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
) )
where TEntity : class, IEntity<TKey> where TEntity : class, IEntity
where TProperty : class where TProperty : class
{ {
var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading<TEntity, TKey>; var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading<TEntity>;
if (repo != null) if (repo != null)
{ {
await repo.EnsureCollectionLoadedAsync(entity, propertyExpression, cancellationToken); await repo.EnsureCollectionLoadedAsync(entity, propertyExpression, cancellationToken);
@ -40,7 +40,7 @@ public static class RepositoryExtensions
where TEntity : class, IEntity<TKey> where TEntity : class, IEntity<TKey>
where TProperty : class where TProperty : class
{ {
var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading<TEntity, TKey>; var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading<TEntity>;
if (repo != null) if (repo != null)
{ {
await repo.EnsurePropertyLoadedAsync(entity, propertyExpression, cancellationToken); await repo.EnsurePropertyLoadedAsync(entity, propertyExpression, cancellationToken);
@ -60,12 +60,12 @@ public static class RepositoryExtensions
} }
} }
public async static Task EnsureExistsAsync<TEntity, TKey>( public async static Task EnsureExistsAsync<TEntity>(
this IRepository<TEntity, TKey> repository, this IRepository<TEntity> repository,
Expression<Func<TEntity, bool>> expression, Expression<Func<TEntity, bool>> expression,
CancellationToken cancellationToken = default CancellationToken cancellationToken = default
) )
where TEntity : class, IEntity<TKey> where TEntity : class, IEntity
{ {
if (!await repository.AnyAsync(expression, cancellationToken)) if (!await repository.AnyAsync(expression, cancellationToken))
{ {

2
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs

@ -441,7 +441,7 @@ public class EfCoreRepository<TDbContext, TEntity> : RepositoryBase<TEntity>, IE
public class EfCoreRepository<TDbContext, TEntity, TKey> : EfCoreRepository<TDbContext, TEntity>, public class EfCoreRepository<TDbContext, TEntity, TKey> : EfCoreRepository<TDbContext, TEntity>,
IEfCoreRepository<TEntity, TKey>, IEfCoreRepository<TEntity, TKey>,
ISupportsExplicitLoading<TEntity, TKey> ISupportsExplicitLoading<TEntity>
where TDbContext : IEfCoreDbContext where TDbContext : IEfCoreDbContext
where TEntity : class, IEntity<TKey> where TEntity : class, IEntity<TKey>

Loading…
Cancel
Save