diff --git a/docs/en/Module-Development-Basics.md b/docs/en/Module-Development-Basics.md index e6f80233e4..4b76465a3e 100644 --- a/docs/en/Module-Development-Basics.md +++ b/docs/en/Module-Development-Basics.md @@ -57,7 +57,7 @@ public class BlogModule : AbpModule } ```` -See Configuration (TODO: link) document for more about the configuration system. +See the [Configuration](Configuration.md) document for more about the configuration system. #### Pre & Post Configure Services @@ -139,4 +139,4 @@ A depended module may depend on another module, but you only need to define your There are **two types of modules.** They don't have any structural difference but categorized by functionality and purpose: - **Framework modules**: These are **core modules of the framework** like caching, emailing, theming, security, serialization, validation, EF Core integration, MongoDB integration... etc. They do not have application/business functionalities but makes your daily development easier by providing common infrastructure, integration and abstractions. -- **Application modules**: These modules implement **specific application/business functionalities** like blogging, document management, identity management, tenant management... etc. They generally have their own entities, services, APIs and UI components. See [pre-built application modules](Modules/Index.md). \ No newline at end of file +- **Application modules**: These modules implement **specific application/business functionalities** like blogging, document management, identity management, tenant management... etc. They generally have their own entities, services, APIs and UI components. See [pre-built application modules](Modules/Index.md). diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/ReflectionHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/ReflectionHelper.cs index fd47d8b859..132c198aa9 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/ReflectionHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/ReflectionHelper.cs @@ -124,7 +124,7 @@ namespace Volo.Abp.Reflection ? customAttributes.Concat(declaringTypeCustomAttributes).Distinct() : customAttributes; } - + /// /// Gets value of a property by it's full path from given object /// @@ -134,7 +134,7 @@ namespace Volo.Abp.Reflection var currentType = objectType; var objectPath = currentType.FullName; var absolutePropertyPath = propertyPath; - if (absolutePropertyPath.StartsWith(objectPath)) + if (objectPath != null && absolutePropertyPath.StartsWith(objectPath)) { absolutePropertyPath = absolutePropertyPath.Replace(objectPath + ".", ""); } @@ -142,8 +142,16 @@ namespace Volo.Abp.Reflection foreach (var propertyName in absolutePropertyPath.Split('.')) { var property = currentType.GetProperty(propertyName); - value = property.GetValue(value, null); - currentType = property.PropertyType; + if (property != null) + { + value = property.GetValue(value, null); + currentType = property.PropertyType; + } + else + { + value = null; + break; + } } return value; diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs index bf2be8e8f0..fffde41ba7 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs @@ -57,7 +57,7 @@ namespace Volo.Abp.Application.Services protected override Task MapToGetListOutputDtoAsync(TEntity entity) { - return base.MapToGetOutputDtoAsync(entity); + return MapToGetOutputDtoAsync(entity); } protected override TEntityDto MapToGetListOutputDto(TEntity entity) diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/ReflectionHelper_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/ReflectionHelper_Tests.cs index 333ea2e84a..9a621d3e01 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/ReflectionHelper_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/ReflectionHelper_Tests.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System; +using System.Linq; using Shouldly; using Xunit; @@ -8,6 +9,50 @@ namespace Volo.Abp.Reflection { //TODO: ... + class GetValueByPathTestClass + { + public string Name { get; set; } + + public int Count { get; set; } + + public DateTime Time { get; set; } + + public GetValueByPathTestChildrenClass Children { get; set; } + } + + class GetValueByPathTestChildrenClass + { + public string Name { get; set; } + + public int Count { get; set; } + } + + [Fact] + public void GetValueByPath_Test() + { + var value = new GetValueByPathTestClass + { + Name = "test", + Count = 8, + Time = DateTime.Parse("2020-01-01"), + Children = new GetValueByPathTestChildrenClass + { + Name = "test-children", + Count = 9, + } + }; + + ReflectionHelper.GetValueByPath(value, value.GetType(), "Name").ShouldBe("test"); + ReflectionHelper.GetValueByPath(value, value.GetType(), "Volo.Abp.Reflection.ReflectionHelper_Tests+GetValueByPathTestClass.Name").ShouldBe("test"); + ReflectionHelper.GetValueByPath(value, value.GetType(), "Count").ShouldBe(8); + ReflectionHelper.GetValueByPath(value, value.GetType(), "Time").ShouldBe(DateTime.Parse("2020-01-01")); + ReflectionHelper.GetValueByPath(value, value.GetType(), "Children.Name").ShouldBe("test-children"); + ReflectionHelper.GetValueByPath(value, value.GetType(), "Children.Count").ShouldBe(9); + ReflectionHelper.GetValueByPath(value, value.GetType(), "Volo.Abp.Reflection.ReflectionHelper_Tests+GetValueByPathTestClass.Children.Name").ShouldBe("test-children"); + + ReflectionHelper.GetValueByPath(value, value.GetType(), "Children.NotExist").ShouldBeNull(); + ReflectionHelper.GetValueByPath(value, value.GetType(), "NotExist").ShouldBeNull(); + } [Fact] public void GetPublicConstantsRecursively_Test() @@ -99,4 +144,4 @@ namespace Volo.Abp.Reflection } } -} \ No newline at end of file +} diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs index 97f443f3b6..db6cbdfe38 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Identity Task UpdateRolesAsync(Guid id, IdentityUserUpdateRolesDto input); - Task FindByUsernameAsync(string username); + Task FindByUsernameAsync(string userName); Task FindByEmailAsync(string email); } diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs index 070a452218..acd573f916 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs @@ -135,10 +135,10 @@ namespace Volo.Abp.Identity } [Authorize(IdentityPermissions.Users.Default)] - public virtual async Task FindByUsernameAsync(string username) + public virtual async Task FindByUsernameAsync(string userName) { return ObjectMapper.Map( - await UserManager.FindByNameAsync(username) + await UserManager.FindByNameAsync(userName) ); } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json index 63ad1f2c3e..c1b4d42a04 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json @@ -79,8 +79,8 @@ "Permission:UserManagement": "User management", "Permission:UserLookup": "User lookup", "Feature:IdentityGroup": "Identity", - "Feature:TwoFactor": "Two Factor", - "Feature:TwoFactorDescription": "Two Factor", + "Feature:TwoFactor": "Two factor behaviour", + "Feature:TwoFactorDescription": "Set two factor behaviour. Optional values: Optional,Disabled,Forced", "Feature:TwoFactor.Optional": "Optional", "Feature:TwoFactor.Disabled": "Disabled", "Feature:TwoFactor.Forced": "Forced", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/tr.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/tr.json index 9bdecca7b2..09707f73c2 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/tr.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/tr.json @@ -78,10 +78,10 @@ "Permission:UserLookup": "Kullanıcı sorgulama", "Feature:IdentityGroup": "Kimlik", "Feature:TwoFactor": "İki faktörlü kimlik doğrulama", - "Feature:TwoFactorDescription": "İki faktörlü kimlik doğrulama", + "Feature:TwoFactorDescription": "İki faktörlü kimlik doğrulamanın talep edileceği durumu seçin", "Feature:TwoFactor.Optional": "İsteğe bağlı", - "Feature:TwoFactor.Disabled": "Devre dışı", - "Feature:TwoFactor.Forced": "Zorunlu", + "Feature:TwoFactor.Disabled": "Asla", + "Feature:TwoFactor.Forced": "Her zaman", "DisplayName:Abp.Identity.Password.RequiredLength": "Uzunluk gerekli", "DisplayName:Abp.Identity.Password.RequiredUniqueChars": "Tekil karakter gerekli", "DisplayName:Abp.Identity.Password.RequireNonAlphanumeric": "Alfasayısal olmayan karakter gerekli", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json index a9bce46cf9..7b084c473e 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json @@ -79,8 +79,8 @@ "Permission:UserManagement": "用户管理", "Permission:UserLookup": "用户查询", "Feature:IdentityGroup": "身份标识", - "Feature:TwoFactor": "双因素身份验证", - "Feature:TwoFactorDescription": "双因素身份验证", + "Feature:TwoFactor": "双因素身份验证行为", + "Feature:TwoFactorDescription": "设置双因素身份验证行为. 可选值:可选,禁用,强制启用", "Feature:TwoFactor.Optional": "可选", "Feature:TwoFactor.Disabled": "禁用", "Feature:TwoFactor.Forced": "强制启用", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hant.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hant.json index dd8c9e0a17..5a4c96d111 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hant.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hant.json @@ -79,8 +79,8 @@ "Permission:UserManagement": "使用者管理", "Permission:UserLookup": "使用者查詢", "Feature:IdentityGroup": "身份識別", - "Feature:TwoFactor": "雙因素", - "Feature:TwoFactorDescription": "雙因素", + "Feature:TwoFactor": "雙因素身份驗證行為", + "Feature:TwoFactorDescription": "設置雙因素身份驗證行為. 可選值:可選,禁用,強制啟用", "Feature:TwoFactor.Optional": "選用", "Feature:TwoFactor.Disabled": "關閉", "Feature:TwoFactor.Forced": "強制啟用",