diff --git a/docs/en/Multi-Lingual-Entities.md b/docs/en/Multi-Lingual-Entities.md index 85746a3fea..8a707b24d0 100644 --- a/docs/en/Multi-Lingual-Entities.md +++ b/docs/en/Multi-Lingual-Entities.md @@ -1,100 +1,6 @@ # Multi Lingual Entities -ABP Framework defines two basic interfaces for Multi-Lingual entity definitions to provide a standard model for translating entities. +This feature is still under development. +Follow the below link to get information about the development status -## IHasMultiLingual - -`IHasMultiLingual` interface is used to mark multi lingual entities. The entities marked with `IHasMultiLingual` interface must define language-neutral information. The entities marked with `IHasMultiLingual` contains a collection of Translations which contains language-dependent information. - -Example: - -```csharp -public class Product : Entity, IMultiLingualEntity -{ - public decimal Price { get; set; } - - public ICollection Translations { get; set; } -} -``` - -## IMultiLingualTranslation - -`IMultiLingualTranslation` interface is used to mark translation of a Multi-Lingual entity. The entities marked with `IMultiLingualTranslation` interface must define language dependent information. The entities marked with `IMultiLingualTranslation` contains Language field which contains a language code for the translation. - -Example: - -```csharp -public class ProductTranslation : Entity, IMultiLingualTranslation -{ - public string Name { get; set; } - - public string Language { get; set; } -} -``` - -## Map to DTO object - -ABP provdies the [Object To Object Mapping](Object-To-Object-Mapping.md) system, you can implement the `IObjectMapper` interface to map multi lingual entities to DTOs. - -Example: - -```csharp -public class MultiLingualProductObjectMapper : IObjectMapper, ITransientDependency -{ - private readonly IMultiLingualObjectManager _multiLingualObjectManager; - - public MultiLingualProductObjectMapper(IMultiLingualObjectManager multiLingualObjectManager) - { - _multiLingualObjectManager = multiLingualObjectManager; - } - - public ProductDto Map(Product source) - { - var translation = _multiLingualObjectManager.GetTranslation(source); - - return new ProductDto - { - Price = source.Price, - Id = source.Id, - Name = translation?.Name - }; - } - - public ProductDto Map(Product source, ProductDto destination) - { - return default; - } -} - -``` - -### AutoMapper integration - -ABP provides the `CreateMultiLingualMap` extension method for mapping multilingual entities to DTOs. - -Example: - -```csharp -public class ProductProfile : Profile -{ - public ProductProfile() - { - var mapResult = this.CreateMultiLingualMap(); - } -} -``` - -`CreateMultiLingualMap` extension method returns an object of type `CreateMultiLingualMapResult` which contains `EntityMap` and `TranslationMap` fields. These fields can be used to customize multi lingual mapping. - -Example: - -```csharp -this.CreateMultiLingualMap(context) - .EntityMap.ForMember(dest => dest.ProductCount, opt => opt.MapFrom(src => src.Products.Count)); -``` - -## IMultiLingualObjectManager - -`IMultiLingualObjectManager` interface defines `GetTranslation` and `GetTranslationAsync` method to get the translation object of the entity. - -The default implementation of the `IMultiLingualObjectManager` interface finds the translation with selected UI language first. If there is no translation with selected UI language, then extension method searches for the default language setting (see [Setting](Settings.md)) and uses the translation in default language. If extension method couldn't find any translation in current UI language or default language, it uses one of the existing translations. \ No newline at end of file +https://github.com/abpframework/abp/issues/1169 diff --git a/docs/en/UI/Blazor/Error-Handling.md b/docs/en/UI/Blazor/Error-Handling.md index f43456e3a7..35aff041af 100644 --- a/docs/en/UI/Blazor/Error-Handling.md +++ b/docs/en/UI/Blazor/Error-Handling.md @@ -16,6 +16,8 @@ There are different type of `Exception` classes handled differently by the ABP F `UserFriendlyException` is a special type of exception. You can directly show a error message dialog to the user by throwing such an exception. +> For Blazor Server, exceptions must be handled manually. Otherwise it crashes the whole application. Auto Exception Handling is not possible with Blazor Server right now, please follow [this issue](https://github.com/abpframework/abp/issues/8195) to see progress. In meantime, you can use try-catch blocks and call the `HandleErrorAsync` method of ABP to handle errors manually, which shows an error dialog for you. + **Example** ````csharp @@ -26,10 +28,24 @@ There are different type of `Exception` classes handled differently by the ABP F @code { + //for Blazor WASM private void TestException() { throw new UserFriendlyException("A user friendly error message!"); } + + //for Blazor Server + private async Task TestException() + { + try + { + throw new UserFriendlyException("A user friendly error message!"); + } + catch(UserFriendlyException ex) + { + await HandleErrorAsync(ex); + } + } } ```` diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.js b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.js index 3422b36d63..e4f5f82620 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.js +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.js @@ -13,6 +13,10 @@ volo.abp.account.profile.update(input).then(function (result) { abp.notify.success(l('PersonalSettingsSaved')); + + volo.abp.account.profile.get().then(function(profile){ + $("#ConcurrencyStamp").val(profile.concurrencyStamp); + }); }); }); });