diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs index 6bd6aae029..6e97c1ad76 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs @@ -101,8 +101,8 @@ namespace Volo.Abp.Identity public virtual async Task IsInOrganizationUnitAsync(Guid userId, Guid ouId) { return await IsInOrganizationUnitAsync( - await GetByIdAsync(userId).ConfigureAwait(false), - await OrganizationUnitRepository.GetAsync(ouId).ConfigureAwait(false) + await GetByIdAsync(userId), + await OrganizationUnitRepository.GetAsync(ouId) ); } @@ -114,14 +114,14 @@ namespace Volo.Abp.Identity public virtual async Task AddToOrganizationUnitAsync(Guid userId, Guid ouId) { await AddToOrganizationUnitAsync( - await IdentityUserRepository.GetAsync(userId, true).ConfigureAwait(false), - await OrganizationUnitRepository.GetAsync(ouId).ConfigureAwait(false) + await IdentityUserRepository.GetAsync(userId, true), + await OrganizationUnitRepository.GetAsync(ouId) ); } public virtual async Task AddToOrganizationUnitAsync(IdentityUser user, OrganizationUnit ou) { - await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token).ConfigureAwait(false); + await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token); var currentOus = user.OrganizationUnits; @@ -138,14 +138,14 @@ namespace Volo.Abp.Identity public virtual async Task RemoveFromOrganizationUnitAsync(Guid userId, Guid ouId) { await RemoveFromOrganizationUnitAsync( - await IdentityUserRepository.GetAsync(userId, true).ConfigureAwait(false), - await OrganizationUnitRepository.GetAsync(ouId).ConfigureAwait(false) + await IdentityUserRepository.GetAsync(userId, true), + await OrganizationUnitRepository.GetAsync(ouId) ); } public virtual async Task RemoveFromOrganizationUnitAsync(IdentityUser user, OrganizationUnit ou) { - await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token).ConfigureAwait(false); + await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token); user.RemoveOrganizationUnit(ou.Id); } @@ -153,7 +153,7 @@ namespace Volo.Abp.Identity public virtual async Task SetOrganizationUnitsAsync(Guid userId, params Guid[] organizationUnitIds) { await SetOrganizationUnitsAsync( - await IdentityUserRepository.GetAsync(userId, true).ConfigureAwait(false), + await IdentityUserRepository.GetAsync(userId, true), organizationUnitIds ); } @@ -165,14 +165,14 @@ namespace Volo.Abp.Identity await CheckMaxUserOrganizationUnitMembershipCountAsync(user.TenantId, organizationUnitIds.Length); - var currentOus = await IdentityUserRepository.GetOrganizationUnitsAsync(user.Id).ConfigureAwait(false); + var currentOus = await IdentityUserRepository.GetOrganizationUnitsAsync(user.Id); //Remove from removed OUs foreach (var currentOu in currentOus) { if (!organizationUnitIds.Contains(currentOu.Id)) { - await RemoveFromOrganizationUnitAsync(user.Id, currentOu.Id).ConfigureAwait(false); + await RemoveFromOrganizationUnitAsync(user.Id, currentOu.Id); } } @@ -183,7 +183,7 @@ namespace Volo.Abp.Identity { await AddToOrganizationUnitAsync( user, - await OrganizationUnitRepository.GetAsync(organizationUnitId).ConfigureAwait(false) + await OrganizationUnitRepository.GetAsync(organizationUnitId) ); } } @@ -191,7 +191,7 @@ namespace Volo.Abp.Identity private async Task CheckMaxUserOrganizationUnitMembershipCountAsync(Guid? tenantId, int requestedCount) { - var maxCount = await SettingProvider.GetAsync(IdentitySettingNames.OrganizationUnit.MaxUserMembershipCount).ConfigureAwait(false); + var maxCount = await SettingProvider.GetAsync(IdentitySettingNames.OrganizationUnit.MaxUserMembershipCount); if (requestedCount > maxCount) { throw new AbpException(string.Format("Can not set more than {0} organization unit for a user!", maxCount)); @@ -201,11 +201,11 @@ namespace Volo.Abp.Identity [UnitOfWork] public virtual async Task> GetOrganizationUnitsAsync(IdentityUser user) { - await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token).ConfigureAwait(false); + await IdentityUserRepository.EnsureCollectionLoadedAsync(user, u => u.OrganizationUnits, CancellationTokenProvider.Token); var ouOfUser = user.OrganizationUnits; - return await OrganizationUnitRepository.GetListAsync(ouOfUser.Select(t => t.OrganizationUnitId)).ConfigureAwait(false); + return await OrganizationUnitRepository.GetListAsync(ouOfUser.Select(t => t.OrganizationUnitId)); } [UnitOfWork] @@ -216,13 +216,13 @@ namespace Volo.Abp.Identity { return await IdentityUserRepository .GetUsersInOrganizationUnitWithChildrenAsync(organizationUnit.Code) - .ConfigureAwait(false); + ; } else { return await IdentityUserRepository .GetUsersInOrganizationUnitAsync(organizationUnit.Id) - .ConfigureAwait(false); + ; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/OrganizationUnitManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/OrganizationUnitManager.cs index fac2ef743a..f4062a4d6c 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/OrganizationUnitManager.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Organizations/OrganizationUnitManager.cs @@ -40,13 +40,13 @@ namespace Volo.Abp.Identity.Organizations { organizationUnit.Code = await GetNextChildCodeAsync(organizationUnit.ParentId); await ValidateOrganizationUnitAsync(organizationUnit); - await _organizationUnitRepository.InsertAsync(organizationUnit).ConfigureAwait(false); + await _organizationUnitRepository.InsertAsync(organizationUnit); } public virtual async Task UpdateAsync(OrganizationUnit organizationUnit) { await ValidateOrganizationUnitAsync(organizationUnit); - await _organizationUnitRepository.UpdateAsync(organizationUnit).ConfigureAwait(false); + await _organizationUnitRepository.UpdateAsync(organizationUnit); } public virtual async Task GetNextChildCodeAsync(Guid? parentId) @@ -74,16 +74,16 @@ namespace Volo.Abp.Identity.Organizations foreach (var child in children) { - await _organizationUnitRepository.DeleteAsync(child).ConfigureAwait(false); + await _organizationUnitRepository.DeleteAsync(child); } - await _organizationUnitRepository.DeleteAsync(id).ConfigureAwait(false); + await _organizationUnitRepository.DeleteAsync(id); } [UnitOfWork] public virtual async Task MoveAsync(Guid id, Guid? parentId) { - var organizationUnit = await _organizationUnitRepository.GetAsync(id).ConfigureAwait(false); + var organizationUnit = await _organizationUnitRepository.GetAsync(id); if (organizationUnit.ParentId == parentId) { return; @@ -110,7 +110,7 @@ namespace Volo.Abp.Identity.Organizations public virtual async Task GetCodeOrDefaultAsync(Guid id) { - var ou = await _organizationUnitRepository.GetAsync(id).ConfigureAwait(false); + var ou = await _organizationUnitRepository.GetAsync(id); return ou?.Code; } @@ -130,12 +130,12 @@ namespace Volo.Abp.Identity.Organizations { if (!recursive) { - return await _organizationUnitRepository.GetChildrenAsync(parentId).ConfigureAwait(false); + return await _organizationUnitRepository.GetChildrenAsync(parentId); } if (!parentId.HasValue) { - return await _organizationUnitRepository.GetListAsync().ConfigureAwait(false); + return await _organizationUnitRepository.GetListAsync(); } var code = await GetCodeOrDefaultAsync(parentId.Value); @@ -151,8 +151,8 @@ namespace Volo.Abp.Identity.Organizations public virtual async Task AddRoleToOrganizationUnitAsync(Guid roleId, Guid ouId) { await AddRoleToOrganizationUnitAsync( - await _identityRoleRepository.GetAsync(roleId).ConfigureAwait(false), - await _organizationUnitRepository.GetAsync(ouId, true).ConfigureAwait(false) + await _identityRoleRepository.GetAsync(roleId), + await _organizationUnitRepository.GetAsync(ouId, true) ); } 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 2b5f249e77..39386fc5bd 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 @@ -54,7 +54,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore where userOu.UserId == id select userOuRoles.Name; - return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await query.ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task FindByLoginAsync( @@ -167,7 +167,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore where userOU.UserId == id select ou; - return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await query.ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetUsersInOrganizationUnitAsync( @@ -179,7 +179,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore join user in DbSet on userOu.UserId equals user.Id where userOu.OrganizationUnitId == organizationUnitId select user; - return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await query.ToListAsync(GetCancellationToken(cancellationToken)); } @@ -193,7 +193,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore join ou in DbContext.Set() on userOu.OrganizationUnitId equals ou.Id where ou.Code.StartsWith(code) select user; - return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await query.ToListAsync(GetCancellationToken(cancellationToken)); } public override IQueryable WithDetails() diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs index 0c4a486481..f3e0eac922 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreOrganizationUnitRepository.cs @@ -21,25 +21,25 @@ namespace Volo.Abp.Identity.EntityFrameworkCore public async Task> GetChildrenAsync(Guid? parentId, CancellationToken cancellationToken = default) { return await DbSet.Where(x => x.ParentId == parentId) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetAllChildrenWithParentCodeAsync(string code, Guid? parentId, CancellationToken cancellationToken = default) { return await DbSet.Where(ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) { - return await DbSet.Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await DbSet.Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken)); } public override async Task> GetListAsync(bool includeDetails = true, CancellationToken cancellationToken = default) { return await DbSet .IncludeDetails(includeDetails) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task GetOrganizationUnitAsync(string displayName, bool includeDetails = false, CancellationToken cancellationToken = default) @@ -49,7 +49,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .FirstOrDefaultAsync( ou => ou.DisplayName == displayName, GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); } public override IQueryable WithDetails() 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 2171299e8f..6c23f2ad3b 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 @@ -48,11 +48,11 @@ namespace Volo.Abp.Identity.MongoDB Guid id, CancellationToken cancellationToken = default) { - var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)).ConfigureAwait(false); + var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)); var organizationUnitIds = user.OrganizationUnits.Select(r => r.OrganizationUnitId); var organizationUnits = DbContext.OrganizationUnits.AsQueryable().Where(ou => organizationUnitIds.Contains(ou.Id)); var roleIds = organizationUnits.SelectMany(x => x.Roles.Select(r => r.RoleId)); - return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).Select(r => r.Name).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).Select(r => r.Name).ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task FindByLoginAsync( @@ -137,12 +137,12 @@ namespace Volo.Abp.Identity.MongoDB bool includeDetails = false, CancellationToken cancellationToken = default) { - var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)).ConfigureAwait(false); + var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)); var organizationUnitIds = user.OrganizationUnits.Select(r => r.OrganizationUnitId); return await DbContext.OrganizationUnits.AsQueryable() .Where(ou => organizationUnitIds.Contains(ou.Id)) .ToListAsync(GetCancellationToken(cancellationToken)) - .ConfigureAwait(false); + ; } public virtual async Task GetCountAsync( @@ -166,7 +166,7 @@ namespace Volo.Abp.Identity.MongoDB var result = await GetMongoQueryable() .Where(u => u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == organizationUnitId)) .ToListAsync(GetCancellationToken(cancellationToken)) - .ConfigureAwait(false); + ; return result; } @@ -178,12 +178,12 @@ namespace Volo.Abp.Identity.MongoDB .Where(ou => ou.Code.StartsWith(code)) .Select(ou => ou.Id) .ToListAsync(GetCancellationToken(cancellationToken)) - .ConfigureAwait(false); + ; return await GetMongoQueryable() .Where(u => u.OrganizationUnits.Any(uou => organizationUnitIds.Contains(uou.OrganizationUnitId))) .ToListAsync(GetCancellationToken(cancellationToken)) - .ConfigureAwait(false); + ; } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs index cede5e46de..d11a180c46 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs @@ -28,20 +28,20 @@ namespace Volo.Abp.Identity.MongoDB public async Task> GetChildrenAsync(Guid? parentId, CancellationToken cancellationToken = default) { return await DbContext.OrganizationUnits.AsQueryable().Where(ou => ou.ParentId == parentId) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetAllChildrenWithParentCodeAsync(string code, Guid? parentId, CancellationToken cancellationToken = default) { return await DbContext.OrganizationUnits.AsQueryable() .Where(ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) { return await DbContext.OrganizationUnits.AsQueryable() - .Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken)); } public async Task GetOrganizationUnitAsync(string displayName, bool includeDetails = false, CancellationToken cancellationToken = default) @@ -50,7 +50,7 @@ namespace Volo.Abp.Identity.MongoDB .FirstOrDefaultAsync( ou => ou.DisplayName == displayName, GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs index 2d259b0859..467597ad65 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs @@ -98,24 +98,24 @@ namespace Volo.Abp.Identity using (var uow = _unitOfWorkManager.Begin()) { var user = await _identityUserRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.NormalizeName("david")).ConfigureAwait(false); + _lookupNormalizer.NormalizeName("david")); user.ShouldNotBeNull(); var ou = await _organizationUnitRepository.GetOrganizationUnitAsync( - _lookupNormalizer.NormalizeName("OU11")).ConfigureAwait(false); + _lookupNormalizer.NormalizeName("OU11")); ou.ShouldNotBeNull(); await _identityUserManager.SetOrganizationUnitsAsync(user, new Guid[] { ou.Id - }).ConfigureAwait(false); + }); user = await _identityUserRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.NormalizeName("david")).ConfigureAwait(false); + _lookupNormalizer.NormalizeName("david")); user.OrganizationUnits.Count.ShouldBeGreaterThan(0); user.OrganizationUnits.FirstOrDefault(uou => uou.OrganizationUnitId == ou.Id).ShouldNotBeNull(); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } @@ -155,25 +155,25 @@ namespace Volo.Abp.Identity using (var uow = _unitOfWorkManager.Begin()) { var ou = await _organizationUnitRepository.GetOrganizationUnitAsync( - _lookupNormalizer.NormalizeName("OU111")).ConfigureAwait(false); + _lookupNormalizer.NormalizeName("OU111")); ou.ShouldNotBeNull(); var user = await _identityUserRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + _lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var ouNew = await _organizationUnitRepository.GetOrganizationUnitAsync( - _lookupNormalizer.NormalizeName("OU2")).ConfigureAwait(false); + _lookupNormalizer.NormalizeName("OU2")); ouNew.ShouldNotBeNull(); await _identityUserManager.SetOrganizationUnitsAsync(user, new Guid[] { ouNew.Id - }).ConfigureAwait(false); + }); user.OrganizationUnits.ShouldNotContain(x => x.OrganizationUnitId == ou.Id); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/OrganizationUnitManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/OrganizationUnitManager_Tests.cs index 7c6c2582ad..67795268ff 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/OrganizationUnitManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/OrganizationUnitManager_Tests.cs @@ -31,55 +31,55 @@ namespace Volo.Abp.Identity { await _organizationUnitManager.CreateAsync(new OrganizationUnit(null, "Root 1")); - var root1 = await _organizationUnitRepository.GetOrganizationUnitAsync("Root 1").ConfigureAwait(false); + var root1 = await _organizationUnitRepository.GetOrganizationUnitAsync("Root 1"); root1.ShouldNotBeNull(); } [Fact] public async Task UpdateAsync() { - var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111").ConfigureAwait(false); + var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111"); ou.Code = OrganizationUnit.CreateCode(123); await _organizationUnitManager.UpdateAsync(ou); - var ouAfterChange = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111").ConfigureAwait(false); + var ouAfterChange = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111"); ouAfterChange.Code.ShouldContain("123"); } [Fact] public async Task DeleteAsync() { - var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU11").ConfigureAwait(false); + var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU11"); await _organizationUnitManager.DeleteAsync(ou.Id); - (await _organizationUnitRepository.GetOrganizationUnitAsync("OU11").ConfigureAwait(false)).ShouldBeNull(); + (await _organizationUnitRepository.GetOrganizationUnitAsync("OU11")).ShouldBeNull(); } [Fact] public async Task MoveAsync() { - var ou1 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1").ConfigureAwait(false); - var ou2 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU2").ConfigureAwait(false); + var ou1 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1"); + var ou2 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU2"); await _organizationUnitManager.MoveAsync(ou1.Id, ou2.Id); - ou1 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1").ConfigureAwait(false); + ou1 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1"); ou1.ParentId.ShouldBe(ou2.Id); ou1.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2)); - var ou11 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU11").ConfigureAwait(false); + var ou11 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU11"); ou11.ParentId.ShouldBe(ou1.Id); ou11.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 1)); - var ou111 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111").ConfigureAwait(false); + var ou111 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU111"); ou111.ParentId.ShouldBe(ou11.Id); ou111.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 1, 1)); - var ou112 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU112").ConfigureAwait(false); + var ou112 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU112"); ou112.ParentId.ShouldBe(ou11.Id); ou112.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 1, 2)); - var ou12 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU12").ConfigureAwait(false); + var ou12 = await _organizationUnitRepository.GetOrganizationUnitAsync("OU12"); ou12.ParentId.ShouldBe(ou1.Id); ou12.Code.ShouldBe(OrganizationUnit.CreateCode(2, 2, 2)); } @@ -87,24 +87,24 @@ namespace Volo.Abp.Identity [Fact] public async Task AddRoleToOrganizationUnitAsync() { - var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", true).ConfigureAwait(false); - var adminRole = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false); + var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", true); + var adminRole = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")); await _organizationUnitManager.AddRoleToOrganizationUnitAsync(adminRole, ou); //TODO: This method has a bug: add role not work - ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", includeDetails: true).ConfigureAwait(false); + ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", includeDetails: true); ou.Roles.FirstOrDefault().RoleId.ShouldBe(adminRole.Id); } [Fact] public async Task RemoveRoleFromOrganizationUnitAsync() { - var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", true).ConfigureAwait(false); - var adminRole = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false); + var ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", true); + var adminRole = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")); await _organizationUnitManager.AddRoleToOrganizationUnitAsync(adminRole.Id, ou.Id); await _organizationUnitManager.RemoveRoleFromOrganizationUnitAsync(adminRole.Id, ou.Id); - ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", includeDetails: true).ConfigureAwait(false); + ou = await _organizationUnitRepository.GetOrganizationUnitAsync("OU1", includeDetails: true); ou.Roles.FirstOrDefault(r => r.RoleId == adminRole.Id).ShouldBeNull(); } } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs index 11c968de3f..bd06c55d6c 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs @@ -47,10 +47,10 @@ namespace Volo.Abp.Identity public async Task Build() { - await AddRoles().ConfigureAwait(false); - await AddOrganizationUnits().ConfigureAwait(false); - await AddUsers().ConfigureAwait(false); - await AddClaimTypes().ConfigureAwait(false); + await AddRoles(); + await AddOrganizationUnits(); + await AddUsers(); + await AddClaimTypes(); } private async Task AddRoles() @@ -77,17 +77,17 @@ namespace Volo.Abp.Identity */ private async Task AddOrganizationUnits() { - var ou1 = await CreateOU("OU1", OrganizationUnit.CreateCode(1)).ConfigureAwait(false); - var ou11 = await CreateOU("OU11", OrganizationUnit.CreateCode(1, 1), ou1.Id).ConfigureAwait(false); - _ou112 = await CreateOU("OU112", OrganizationUnit.CreateCode(1, 1, 2), ou11.Id).ConfigureAwait(false); - var ou12 = await CreateOU("OU12", OrganizationUnit.CreateCode(1, 2), ou1.Id).ConfigureAwait(false); - var ou2 = await CreateOU("OU2", OrganizationUnit.CreateCode(2)).ConfigureAwait(false); - var ou21 = await CreateOU("OU21", OrganizationUnit.CreateCode(2, 1), ou2.Id).ConfigureAwait(false); + var ou1 = await CreateOU("OU1", OrganizationUnit.CreateCode(1)); + var ou11 = await CreateOU("OU11", OrganizationUnit.CreateCode(1, 1), ou1.Id); + _ou112 = await CreateOU("OU112", OrganizationUnit.CreateCode(1, 1, 2), ou11.Id); + var ou12 = await CreateOU("OU12", OrganizationUnit.CreateCode(1, 2), ou1.Id); + var ou2 = await CreateOU("OU2", OrganizationUnit.CreateCode(2)); + var ou21 = await CreateOU("OU21", OrganizationUnit.CreateCode(2, 1), ou2.Id); _ou111 = new OrganizationUnit(null, "OU111", ou11.Id); _ou111.Code = OrganizationUnit.CreateCode(1, 1, 1); _ou111.AddRole(_moderator.Id); - await _organizationUnitRepository.InsertAsync(_ou111).ConfigureAwait(false); + await _organizationUnitRepository.InsertAsync(_ou111); } private async Task AddUsers() @@ -121,7 +121,7 @@ namespace Volo.Abp.Identity private async Task AddClaimTypes() { var ageClaim = new IdentityClaimType(_testData.AgeClaimId, "Age", false, false, null, null, null, IdentityClaimValueType.Int); - await _identityClaimTypeRepository.InsertAsync(ageClaim).ConfigureAwait(false); + await _identityClaimTypeRepository.InsertAsync(ageClaim); var educationClaim = new IdentityClaimType(_testData.EducationClaimId, "Education", true, false, null, null, null); await _identityClaimTypeRepository.InsertAsync(educationClaim); @@ -129,7 +129,7 @@ namespace Volo.Abp.Identity private async Task CreateOU(string displayName, string code, Guid? parentId = null) { - var ou = await _organizationUnitRepository.InsertAsync(new OrganizationUnit(null, displayName, parentId) { Code = code }).ConfigureAwait(false); + var ou = await _organizationUnitRepository.InsertAsync(new OrganizationUnit(null, displayName, parentId) { Code = code }); return ou; } } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs index 114d7e37a2..f7fe17c2e7 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs @@ -134,7 +134,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetUsersInOrganizationUnitAsync() { - var users = await UserRepository.GetUsersInOrganizationUnitAsync((await GetOU("OU111").ConfigureAwait(false)).Id).ConfigureAwait(false); + var users = await UserRepository.GetUsersInOrganizationUnitAsync((await GetOU("OU111")).Id); users.ShouldNotBeNull(); users.Count.ShouldBeGreaterThan(0); } @@ -142,7 +142,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetUsersInOrganizationUnitWithChildrenAsync() { - var users = await UserRepository.GetUsersInOrganizationUnitWithChildrenAsync((await GetOU("OU111").ConfigureAwait(false)).Code).ConfigureAwait(false); + var users = await UserRepository.GetUsersInOrganizationUnitWithChildrenAsync((await GetOU("OU111")).Code); users.ShouldNotBeNull(); users.Count.ShouldBeGreaterThan(0); } @@ -170,7 +170,7 @@ namespace Volo.Abp.Identity private async Task GetOU(string diplayName) { - var organizationUnit = await OrganizationUnitRepository.GetOrganizationUnitAsync(diplayName).ConfigureAwait(false); + var organizationUnit = await OrganizationUnitRepository.GetOrganizationUnitAsync(diplayName); organizationUnit.ShouldNotBeNull(); return organizationUnit; } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs index a832b5024d..43a570ec16 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs @@ -61,7 +61,7 @@ namespace Volo.Abp.Identity john.OrganizationUnits.ShouldNotBeNull(); john.OrganizationUnits.Any().ShouldBeTrue(); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -70,11 +70,11 @@ namespace Volo.Abp.Identity { using (var uow = GetRequiredService().Begin()) { - var ou = await OrganizationUnitRepository.GetOrganizationUnitAsync(LookupNormalizer.NormalizeName("OU111"), includeDetails: false).ConfigureAwait(false); + var ou = await OrganizationUnitRepository.GetOrganizationUnitAsync(LookupNormalizer.NormalizeName("OU111"), includeDetails: false); ou.Roles.ShouldNotBeNull(); //? ou.Roles.Any().ShouldBeTrue(); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs index 20452a90f5..8dc81ceb5e 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/OrganizationUnitRepository_Tests.cs @@ -32,21 +32,21 @@ namespace Volo.Abp.Identity [Fact] public async Task GetChildrenAsync() { - (await OrganizationUnitRepository.GetChildrenAsync(_testData.RoleModeratorId).ConfigureAwait(false)).ShouldNotBeNull(); + (await OrganizationUnitRepository.GetChildrenAsync(_testData.RoleModeratorId)).ShouldNotBeNull(); } [Fact] public async Task GetAllChildrenWithParentCodeAsync() { - (await OrganizationUnitRepository.GetAllChildrenWithParentCodeAsync(OrganizationUnit.CreateCode(0), _guidGenerator.Create()).ConfigureAwait(false)).ShouldNotBeNull(); + (await OrganizationUnitRepository.GetAllChildrenWithParentCodeAsync(OrganizationUnit.CreateCode(0), _guidGenerator.Create())).ShouldNotBeNull(); } [Fact] public async Task GetListAsync() { - var ouIds = (await OrganizationUnitRepository.GetListAsync().ConfigureAwait(false)) + var ouIds = (await OrganizationUnitRepository.GetListAsync()) .Select(ou => ou.Id).Take(2); - var ous = await OrganizationUnitRepository.GetListAsync(ouIds).ConfigureAwait(false); + var ous = await OrganizationUnitRepository.GetListAsync(ouIds); ous.Count.ShouldBe(2); ous.ShouldContain(ou => ou.Id == ouIds.First()); } @@ -54,20 +54,20 @@ namespace Volo.Abp.Identity [Fact] public async Task GetOrganizationUnitAsync() { - var organizationUnit = await OrganizationUnitRepository.GetOrganizationUnitAsync("OU111").ConfigureAwait(false); + var organizationUnit = await OrganizationUnitRepository.GetOrganizationUnitAsync("OU111"); organizationUnit.ShouldNotBeNull(); } [Fact] public async Task GetCountAsync() { - (await OrganizationUnitRepository.GetCountAsync().ConfigureAwait(false)).ShouldBeGreaterThan(0); + (await OrganizationUnitRepository.GetCountAsync()).ShouldBeGreaterThan(0); } [Fact] public async Task Should_Eager_Load_OrganizationUnit_Collections() { - var ou = (await OrganizationUnitRepository.GetListAsync(true).ConfigureAwait(false)) + var ou = (await OrganizationUnitRepository.GetListAsync(true)) .FirstOrDefault(ou => ou.DisplayName == "OU111"); ou.Roles.ShouldNotBeNull(); ou.Roles.Any().ShouldBeTrue();