Browse Source

将UnitOfWork.SaveChangesAsync变更为UnitOfWork.CompleteAsync

pull/382/head
cKey 4 years ago
parent
commit
986a33cd15
  1. 2
      aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/RouteGroupAppService.cs
  2. 4
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/IdentityClaimTypeAppService.cs
  3. 10
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/IdentityRoleAppService.cs
  4. 16
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/IdentityUserAppService.cs
  5. 4
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/MyProfileAppService.cs
  6. 8
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/OrganizationUnitAppService.cs
  7. 6
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceAppService.cs
  8. 6
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiScopes/ApiScopeAppService.cs
  9. 8
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/Clients/ClientAppService.cs
  10. 2
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/Grants/PersistedGrantAppService.cs
  11. 4
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceAppService.cs
  12. 10
      aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Datas/DataAppService.cs
  13. 6
      aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs
  14. 4
      aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs
  15. 4
      aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingAppService.cs

2
aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/RouteGroupAppService.cs

@ -77,7 +77,7 @@ namespace LINGYUN.ApiGateway.Ocelot
router.SwitchApp(input.AppName, input.AppIpAddress);
await RouterRepository.UpdateAsync(router);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<RouteGroup, RouteGroupDto>(router);
}

4
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/IdentityClaimTypeAppService.cs

@ -41,7 +41,7 @@ namespace LINGYUN.Abp.Identity
input.ValueType
);
identityClaimType = await IdentityClaimTypeManager.CreateAsync(identityClaimType);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<IdentityClaimType, IdentityClaimTypeDto>(identityClaimType);
}
@ -105,7 +105,7 @@ namespace LINGYUN.Abp.Identity
}
identityClaimType = await IdentityClaimTypeManager.UpdateAsync(identityClaimType);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<IdentityClaimType, IdentityClaimTypeDto>(identityClaimType);
}

10
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/IdentityRoleAppService.cs

@ -53,7 +53,7 @@ namespace LINGYUN.Abp.Identity
origanzationUnit.RemoveRole(id);
}
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
[Authorize(IdentityPermissions.Roles.ManageOrganizationUnits)]
@ -61,7 +61,7 @@ namespace LINGYUN.Abp.Identity
{
await OrganizationUnitManager.RemoveRoleFromOrganizationUnitAsync(id, ouId);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
#endregion
@ -88,7 +88,7 @@ namespace LINGYUN.Abp.Identity
role.AddClaim(GuidGenerator, claim);
await IdentityRoleRepository.UpdateAsync(role);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
[Authorize(IdentityPermissions.Roles.ManageClaims)]
@ -103,7 +103,7 @@ namespace LINGYUN.Abp.Identity
await IdentityRoleRepository.UpdateAsync(role);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
}
@ -115,7 +115,7 @@ namespace LINGYUN.Abp.Identity
await IdentityRoleRepository.UpdateAsync(role);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
#endregion

16
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/IdentityUserAppService.cs

@ -46,7 +46,7 @@ namespace LINGYUN.Abp.Identity
await UserManager.SetOrganizationUnitsAsync(user, input.OrganizationUnitIds);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
[Authorize(IdentityPermissions.Users.ManageOrganizationUnits)]
@ -54,7 +54,7 @@ namespace LINGYUN.Abp.Identity
{
await UserManager.RemoveFromOrganizationUnitAsync(id, ouId);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
#endregion
@ -80,7 +80,7 @@ namespace LINGYUN.Abp.Identity
user.AddClaim(GuidGenerator, claim);
(await UserManager.UpdateAsync(user)).CheckErrors();
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
[Authorize(IdentityPermissions.Users.ManageClaims)]
@ -92,7 +92,7 @@ namespace LINGYUN.Abp.Identity
user.ReplaceClaim(oldClaim, newClaim);
(await UserManager.UpdateAsync(user)).CheckErrors();
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
[Authorize(IdentityPermissions.Users.ManageClaims)]
@ -102,7 +102,7 @@ namespace LINGYUN.Abp.Identity
user.RemoveClaim(new Claim(input.ClaimType, input.ClaimValue));
(await UserManager.UpdateAsync(user)).CheckErrors();
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
#endregion
@ -144,7 +144,7 @@ namespace LINGYUN.Abp.Identity
(await UserManager.SetTwoFactorEnabledWithAccountConfirmedAsync(user, input.Enabled)).CheckErrors();
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
[Authorize(Volo.Abp.Identity.IdentityPermissions.Users.Update)]
@ -158,7 +158,7 @@ namespace LINGYUN.Abp.Identity
var endDate = new DateTimeOffset(Clock.Now).AddSeconds(seconds);
(await UserManager.SetLockoutEndDateAsync(user, endDate)).CheckErrors();
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
[Authorize(Volo.Abp.Identity.IdentityPermissions.Users.Update)]
@ -167,7 +167,7 @@ namespace LINGYUN.Abp.Identity
var user = await GetUserAsync(id);
(await UserManager.SetLockoutEndDateAsync(user, null)).CheckErrors();
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
protected virtual async Task<IdentityUser> GetUserAsync(Guid id)

4
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/MyProfileAppService.cs

@ -48,7 +48,7 @@ namespace LINGYUN.Abp.Identity
(await UserManager.SetTwoFactorEnabledWithAccountConfirmedAsync(user, input.Enabled)).CheckErrors();
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
public virtual async Task SendChangePhoneNumberCodeAsync(SendChangePhoneNumberCodeDto input)
@ -94,7 +94,7 @@ namespace LINGYUN.Abp.Identity
// 更换手机号
(await UserManager.ChangePhoneNumberAsync(user, input.NewPhoneNumber, input.Code)).CheckErrors();
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
var securityTokenCacheKey = SmsSecurityTokenCacheItem.CalculateCacheKey(input.NewPhoneNumber, "SmsChangePhoneNumber");
await SecurityTokenCache.RemoveAsync(securityTokenCacheKey);

8
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/OrganizationUnitAppService.cs

@ -46,7 +46,7 @@ namespace LINGYUN.Abp.Identity
input.MapExtraPropertiesTo(origanizationUnit);
await OrganizationUnitManager.CreateAsync(origanizationUnit);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<OrganizationUnit, OrganizationUnitDto>(origanizationUnit);
}
@ -198,7 +198,7 @@ namespace LINGYUN.Abp.Identity
input.MapExtraPropertiesTo(origanizationUnit);
await OrganizationUnitManager.UpdateAsync(origanizationUnit);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<OrganizationUnit, OrganizationUnitDto>(origanizationUnit);
}
@ -215,7 +215,7 @@ namespace LINGYUN.Abp.Identity
await UserManager.AddToOrganizationUnitAsync(user, origanizationUnit);
}
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
[Authorize(IdentityPermissions.OrganizationUnits.ManageRoles)]
@ -230,7 +230,7 @@ namespace LINGYUN.Abp.Identity
await OrganizationUnitManager.AddRoleToOrganizationUnitAsync(role, origanizationUnit);
}
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
}
}

6
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceAppService.cs

@ -59,7 +59,7 @@ namespace LINGYUN.Abp.IdentityServer.ApiResources
apiResource = await ApiResourceRepository.InsertAsync(apiResource);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<ApiResource, ApiResourceDto>(apiResource);
}
@ -73,7 +73,7 @@ namespace LINGYUN.Abp.IdentityServer.ApiResources
apiResource = await ApiResourceRepository.UpdateAsync(apiResource);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<ApiResource, ApiResourceDto>(apiResource);
}
@ -84,7 +84,7 @@ namespace LINGYUN.Abp.IdentityServer.ApiResources
var apiResource = await ApiResourceRepository.GetAsync(id);
await ApiResourceRepository.DeleteAsync(apiResource);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
protected virtual async Task UpdateApiResourceByInputAsync(ApiResource apiResource, ApiResourceCreateOrUpdateDto input)

6
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiScopes/ApiScopeAppService.cs

@ -39,7 +39,7 @@ namespace LINGYUN.Abp.IdentityServer.ApiScopes
await UpdateApiScopeByInputAsync(apiScope, input);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
apiScope = await ApiScopeRepository.InsertAsync(apiScope);
@ -53,7 +53,7 @@ namespace LINGYUN.Abp.IdentityServer.ApiScopes
await ApiScopeRepository.DeleteAsync(apiScope);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
public virtual async Task<ApiScopeDto> GetAsync(Guid id)
@ -86,7 +86,7 @@ namespace LINGYUN.Abp.IdentityServer.ApiScopes
await UpdateApiScopeByInputAsync(apiScope, input);
apiScope = await ApiScopeRepository.UpdateAsync(apiScope);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<ApiScope, ApiScopeDto>(apiScope);
}

8
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/Clients/ClientAppService.cs

@ -51,7 +51,7 @@ namespace LINGYUN.Abp.IdentityServer.Clients
client = await ClientRepository.InsertAsync(client);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<Client, ClientDto>(client);
}
@ -62,7 +62,7 @@ namespace LINGYUN.Abp.IdentityServer.Clients
var client = await ClientRepository.GetAsync(id);
await ClientRepository.DeleteAsync(client);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
public virtual async Task<ClientDto> GetAsync(Guid id)
@ -312,7 +312,7 @@ namespace LINGYUN.Abp.IdentityServer.Clients
client = await ClientRepository.UpdateAsync(client);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<Client, ClientDto>(client);
}
@ -445,7 +445,7 @@ namespace LINGYUN.Abp.IdentityServer.Clients
}
client = await ClientRepository.InsertAsync(client);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<Client, ClientDto>(client);
}

2
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/Grants/PersistedGrantAppService.cs

@ -24,7 +24,7 @@ namespace LINGYUN.Abp.IdentityServer.Grants
var persistedGrant = await PersistentGrantRepository.GetAsync(id);
await PersistentGrantRepository.DeleteAsync(persistedGrant);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
public virtual async Task<PersistedGrantDto> GetAsync(Guid id)

4
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceAppService.cs

@ -51,7 +51,7 @@ namespace LINGYUN.Abp.IdentityServer.IdentityResources
input.ShowInDiscoveryDocument);
await UpdateApiResourceByInputAsync(identityResource, input);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
identityResource = await IdentityResourceRepository.InsertAsync(identityResource);
@ -65,7 +65,7 @@ namespace LINGYUN.Abp.IdentityServer.IdentityResources
await UpdateApiResourceByInputAsync(identityResource, input);
identityResource = await IdentityResourceRepository.UpdateAsync(identityResource);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<IdentityResource, IdentityResourceDto>(identityResource);
}

10
aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Datas/DataAppService.cs

@ -57,7 +57,7 @@ namespace LINGYUN.Platform.Datas
);
data = await DataRepository.InsertAsync(data);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<Data, DataDto>(data);
}
@ -129,7 +129,7 @@ namespace LINGYUN.Platform.Datas
}
data = await DataRepository.UpdateAsync(data);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<Data, DataDto>(data);
}
@ -159,7 +159,7 @@ namespace LINGYUN.Platform.Datas
dataItem.AllowBeNull = input.AllowBeNull;
await DataRepository.UpdateAsync(data);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
[Authorize(PlatformPermissions.DataDictionary.ManageItems)]
@ -182,7 +182,7 @@ namespace LINGYUN.Platform.Datas
input.AllowBeNull);
await DataRepository.UpdateAsync(data);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
[Authorize(PlatformPermissions.DataDictionary.ManageItems)]
@ -192,7 +192,7 @@ namespace LINGYUN.Platform.Datas
data.RemoveItem(name);
await DataRepository.UpdateAsync(data);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
}
}

6
aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs

@ -40,7 +40,7 @@ namespace LINGYUN.Platform.Layouts
CurrentTenant.Id);
layout = await LayoutRepository.InsertAsync(layout);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<Layout, LayoutDto>(layout);
}
@ -56,7 +56,7 @@ namespace LINGYUN.Platform.Layouts
//}
await LayoutRepository.DeleteAsync(layout);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
public virtual async Task<LayoutDto> GetAsync(Guid id)
@ -113,7 +113,7 @@ namespace LINGYUN.Platform.Layouts
layout.Redirect = input.Redirect;
}
layout = await LayoutRepository.UpdateAsync(layout);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<Layout, LayoutDto>(layout);
}

4
aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs

@ -121,7 +121,7 @@ namespace LINGYUN.Platform.Menus
}
}
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<Menu, MenuDto>(menu);
}
@ -188,7 +188,7 @@ namespace LINGYUN.Platform.Menus
menu.IsPublic = input.IsPublic;
await MenuManager.UpdateAsync(menu);
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
return ObjectMapper.Map<Menu, MenuDto>(menu);
}

4
aspnet-core/modules/settings/LINGYUN.Abp.SettingManagement.Application/LINGYUN/Abp/SettingManagement/SettingAppService.cs

@ -64,7 +64,7 @@ namespace LINGYUN.Abp.SettingManagement
await EventBus.PublishAsync(new CurrentApplicationConfigurationCacheResetEventData());
});
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
[Authorize(AbpSettingManagementPermissions.Settings.Manager)]
@ -86,7 +86,7 @@ namespace LINGYUN.Abp.SettingManagement
await EventBus.PublishAsync(new CurrentApplicationConfigurationCacheResetEventData());
});
await CurrentUnitOfWork.SaveChangesAsync();
await CurrentUnitOfWork.CompleteAsync();
}
}

Loading…
Cancel
Save