From 1c0baa6ca64ac6db9686a13964f71e4edc5332df Mon Sep 17 00:00:00 2001 From: Mladen Macanovic Date: Wed, 28 Oct 2020 15:23:58 +0100 Subject: [PATCH 1/5] Remove OnOpenedCreateModalAsync --- .../src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs index f1563947c0..35b436565d 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs @@ -294,8 +294,6 @@ namespace Volo.Abp.BlazoriseUI await InvokeAsync(() => StateHasChanged()); CreateModal.Show(); - - await OnOpeningCreateModalAsync(); } protected virtual Task OnOpeningCreateModalAsync() @@ -303,11 +301,6 @@ namespace Volo.Abp.BlazoriseUI return Task.CompletedTask; } - protected virtual Task OnOpenedCreateModalAsync() - { - return Task.CompletedTask; - } - protected virtual Task CloseCreateModalAsync() { CreateModal.Hide(); @@ -330,8 +323,6 @@ namespace Volo.Abp.BlazoriseUI await InvokeAsync(() => StateHasChanged()); EditModal.Show(); - - await OnOpenedEditModalAsync(id); } protected virtual Task OnOpeningEditModalAsync(TKey id) @@ -339,11 +330,6 @@ namespace Volo.Abp.BlazoriseUI return Task.CompletedTask; } - protected virtual Task OnOpenedEditModalAsync(TKey id) - { - return Task.CompletedTask; - } - protected virtual TUpdateViewModel MapToEditingEntity(TGetOutputDto entityDto) { return ObjectMapper.Map(entityDto); From 66d60024ed8bd597c134a0e4f5a90dea3eed7b5c Mon Sep 17 00:00:00 2001 From: Mladen Macanovic Date: Wed, 28 Oct 2020 15:26:20 +0100 Subject: [PATCH 2/5] Remove ResetState and ApplyState temporary helpers --- .../System/AbpObjectExtensions.cs | 57 ------------------- 1 file changed, 57 deletions(-) diff --git a/framework/src/Volo.Abp.Core/System/AbpObjectExtensions.cs b/framework/src/Volo.Abp.Core/System/AbpObjectExtensions.cs index a173c2a95d..a3fd87188f 100644 --- a/framework/src/Volo.Abp.Core/System/AbpObjectExtensions.cs +++ b/framework/src/Volo.Abp.Core/System/AbpObjectExtensions.cs @@ -106,62 +106,5 @@ namespace System return obj; } - - /// - /// Resets all fields of a given object to their default values. - /// - /// Type of the object. - /// An object - /// Alternative custom method to reset the values. - /// Returns the original object. - public static T ResetState(this T obj, Action customReset = null) - { - if (customReset != null) - { - customReset(obj); - } - else - { - var properties = typeof(T).GetProperties(); - - foreach (var property in properties) - { - if (!property.CanWrite) - { - continue; - } - - property.SetValue(obj, null); - } - } - - return obj; - } - - /// - /// Applies all fields of a given object from it's counterpart. - /// - /// Type of the object. - /// An object. - /// An object from which we copy the values. - /// Returns the original object. - public static T ApplyState(this T obj, T other) - { - // This code is not production ready and it should be removed once - // the proper validation in Blazorise is done! - var properties = typeof(T).GetProperties(); - - foreach (var property in properties) - { - if (!property.CanWrite) - { - continue; - } - - property.SetValue(obj, typeof(T).GetProperty(property.Name).GetValue(other)); - } - - return obj; - } } } From 18a3c6271675713cd99af64247a7b9034029ca84 Mon Sep 17 00:00:00 2001 From: Mladen Macanovic Date: Wed, 28 Oct 2020 15:34:33 +0100 Subject: [PATCH 3/5] Use stringLocalizer default formater --- .../AbpIdentityBlazorMessageLocalizerExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorMessageLocalizerExtensions.cs b/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorMessageLocalizerExtensions.cs index 18a6242bab..a8aa779151 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorMessageLocalizerExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorMessageLocalizerExtensions.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.Identity.Blazor try { return arguments?.Count() > 0 - ? string.Format(stringLocalizer[format], LocalizeMessageArguments(stringLocalizer, arguments)?.ToArray()) + ? stringLocalizer[format, LocalizeMessageArguments(stringLocalizer, arguments)?.ToArray()] : stringLocalizer[format]; } catch From 26d54f693283f31f44c0ec664bc68196f19ad6c0 Mon Sep 17 00:00:00 2001 From: Mladen Macanovic Date: Wed, 28 Oct 2020 15:35:38 +0100 Subject: [PATCH 4/5] Rename format parameter to message --- .../AbpIdentityBlazorMessageLocalizerExtensions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorMessageLocalizerExtensions.cs b/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorMessageLocalizerExtensions.cs index a8aa779151..72328eb86d 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorMessageLocalizerExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorMessageLocalizerExtensions.cs @@ -7,17 +7,17 @@ namespace Volo.Abp.Identity.Blazor { public static class AbpIdentityBlazorMessageLocalizerExtensions { - public static string Localize(this IStringLocalizer stringLocalizer, string format, IEnumerable arguments) + public static string Localize(this IStringLocalizer stringLocalizer, string message, IEnumerable arguments) { try { return arguments?.Count() > 0 - ? stringLocalizer[format, LocalizeMessageArguments(stringLocalizer, arguments)?.ToArray()] - : stringLocalizer[format]; + ? stringLocalizer[message, LocalizeMessageArguments(stringLocalizer, arguments)?.ToArray()] + : stringLocalizer[message]; } catch { - return stringLocalizer[format]; + return stringLocalizer[message]; } } From 11c9daf11a0f0af8e9d8315bc6bc72e5a490ca9f Mon Sep 17 00:00:00 2001 From: Mladen Macanovic Date: Wed, 28 Oct 2020 15:37:01 +0100 Subject: [PATCH 5/5] Fix formating --- .../Pages/Identity/RoleManagement.razor | 2 +- .../Pages/Identity/UserManagement.razor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor index ac40aca83d..97001ee6ec 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor +++ b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor @@ -1,5 +1,5 @@ @page "/identity/roles" -@attribute [Authorize( IdentityPermissions.Roles.Default )] +@attribute [Authorize(IdentityPermissions.Roles.Default)] @using Volo.Abp.Identity @using Microsoft.AspNetCore.Authorization @using Microsoft.Extensions.Localization diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor index 6f33181f8a..0a61fc70ab 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor +++ b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor @@ -1,5 +1,5 @@ @page "/identity/users" -@attribute [Authorize( IdentityPermissions.Users.Default )] +@attribute [Authorize(IdentityPermissions.Users.Default)] @using Microsoft.AspNetCore.Authorization @using Microsoft.Extensions.Localization @using Volo.Abp.Identity.Localization