diff --git a/docs/en/Repositories.md b/docs/en/Repositories.md index 23ed2371dd..61383898e6 100644 --- a/docs/en/Repositories.md +++ b/docs/en/Repositories.md @@ -140,9 +140,9 @@ public async Task> GetListAsync(string filter) Any standard LINQ method can be used over the `IQueryable` returned from the repository. -> This sample uses `ToList()` method, but it is **strongly suggested to use the asynchronous methods** to perform database queries, like `ToListAsync()` for this example. -> -> See the **IQueryable & Async Operations** section to learn how you can do it. +> This sample uses `ToList()` method, but it is **strongly suggested to use the asynchronous methods** to perform database queries, like `ToListAsync()` for this example. See the **`IQueryable` & Async Operations** section to learn how you can do it. + +> **Exposing `IQueryable` to outside of a repository** class may leak your data access logic to the application layer. If you want to strictly follow the **layered architecture** principles, you can consider to implement a custom repository class and wrap your data access logic inside your repository class. You can see the ***Custom Repositories*** section to learn how to create custom repository classes for your application. ### Bulk Operations diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs index 60abbb3054..2dc1963505 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs @@ -252,10 +252,10 @@ public class EfCoreIdentityUserRepository : EfCoreRepository x.Email == emailAddress) .WhereIf(!string.IsNullOrWhiteSpace(name), x => x.Name == name) .WhereIf(!string.IsNullOrWhiteSpace(surname), x => x.Surname == surname) - .WhereIf(isLockedOut.HasValue, x => x.LockoutEnabled && x.LockoutEnd.Value.CompareTo(DateTime.UtcNow) > 0) - .WhereIf(notActive.HasValue, x => !x.IsActive) - .WhereIf(emailConfirmed.HasValue, x => x.EmailConfirmed) - .WhereIf(isExternal.HasValue, x => x.IsExternal) + .WhereIf(isLockedOut.HasValue, x => (x.LockoutEnabled && x.LockoutEnd.HasValue && x.LockoutEnd.Value.CompareTo(DateTime.UtcNow) > 0) == isLockedOut.Value) + .WhereIf(notActive.HasValue, x => x.IsActive == !notActive.Value) + .WhereIf(emailConfirmed.HasValue, x => x.EmailConfirmed == emailConfirmed.Value) + .WhereIf(isExternal.HasValue, x => x.IsExternal == isExternal.Value) .WhereIf(maxCreationTime != null, p => p.CreationTime <= maxCreationTime) .WhereIf(minCreationTime != null, p => p.CreationTime >= minCreationTime) .WhereIf(maxModifitionTime != null, p => p.LastModificationTime <= maxModifitionTime) diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs index ae805d9a03..552e22afbe 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs @@ -257,10 +257,11 @@ public class MongoIdentityUserRepository : MongoDbRepository>(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) .WhereIf>(!string.IsNullOrWhiteSpace(name), x => x.Name == name) .WhereIf>(!string.IsNullOrWhiteSpace(surname), x => x.Surname == surname) - .WhereIf>(isLockedOut.HasValue, x => x.LockoutEnabled && x.LockoutEnd > DateTimeOffset.UtcNow) - .WhereIf>(notActive.HasValue, x => !x.IsActive) - .WhereIf>(emailConfirmed.HasValue, x => x.EmailConfirmed) - .WhereIf>(isExternal.HasValue, x => x.IsExternal) + .WhereIf>(isLockedOut.HasValue && isLockedOut.Value, x => x.LockoutEnabled && x.LockoutEnd != null && x.LockoutEnd > DateTimeOffset.UtcNow) + .WhereIf>(isLockedOut.HasValue && !isLockedOut.Value, x => !(x.LockoutEnabled && x.LockoutEnd != null && x.LockoutEnd > DateTimeOffset.UtcNow)) + .WhereIf>(notActive.HasValue, x => x.IsActive == !notActive.Value) + .WhereIf>(emailConfirmed.HasValue, x => x.EmailConfirmed == emailConfirmed.Value) + .WhereIf>(isExternal.HasValue, x => x.IsExternal == isExternal.Value) .WhereIf>(maxCreationTime != null, p => p.CreationTime <= maxCreationTime) .WhereIf>(minCreationTime != null, p => p.CreationTime >= minCreationTime) .WhereIf>(maxModifitionTime != null, p => p.LastModificationTime <= maxModifitionTime)