diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeEto.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeEto.cs new file mode 100644 index 0000000000..2d0dd4ebfc --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityClaimTypeEto.cs @@ -0,0 +1,24 @@ +using System; + +namespace Volo.Abp.Identity +{ + [Serializable] + public class IdentityClaimTypeEto + { + public Guid Id { get; set; } + + public string Name { get; set; } + + public bool Required { get; set; } + + public bool IsStatic { get; set; } + + public string Regex { get; set; } + + public string RegexDescription { get; set; } + + public string Description { get; set; } + + public IdentityClaimValueType ValueType { get; set; } + } +} diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleEto.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleEto.cs new file mode 100644 index 0000000000..8e91eadf72 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityRoleEto.cs @@ -0,0 +1,20 @@ +using System; + +namespace Volo.Abp.Identity +{ + [Serializable] + public class IdentityRoleEto + { + public Guid Id { get; set; } + + public Guid? TenantId { get; set; } + + public string Name { get; set; } + + public bool IsDefault { get; set; } + + public bool IsStatic { get; set; } + + public bool IsPublic { get; set; } + } +} \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj b/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj index 41fbc25274..fa22210db0 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj @@ -25,6 +25,7 @@ + diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs index 1bb065017e..12af875bab 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs @@ -2,6 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; +using Volo.Abp.AutoMapper; using Volo.Abp.Domain; using Volo.Abp.EventBus.Distributed; using Volo.Abp.Modularity; @@ -12,17 +13,27 @@ namespace Volo.Abp.Identity [DependsOn( typeof(AbpDddDomainModule), typeof(AbpIdentityDomainSharedModule), - typeof(AbpUsersDomainModule) + typeof(AbpUsersDomainModule), + typeof(AbpAutoMapperModule) )] public class AbpIdentityDomainModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => + context.Services.AddAutoMapperObjectMapper(); + + Configure(options => { - options.EtoMappings.Add(); + options.AddProfile(validate: true); }); + Configure(options => + { + options.EtoMappings.Add(typeof(AbpIdentityDomainModule)); + options.EtoMappings.Add(typeof(AbpIdentityDomainModule)); + options.EtoMappings.Add(typeof(AbpIdentityDomainModule)); + }); + var identityBuilder = context.Services.AddAbpIdentity(options => { options.User.RequireUniqueEmail = true; diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDomainMappingProfile.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDomainMappingProfile.cs new file mode 100644 index 0000000000..547525b46e --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDomainMappingProfile.cs @@ -0,0 +1,15 @@ +using AutoMapper; +using Volo.Abp.Users; + +namespace Volo.Abp.Identity +{ + public class IdentityDomainMappingProfile : Profile + { + public IdentityDomainMappingProfile() + { + CreateMap(); + CreateMap(); + CreateMap(); + } + } +} \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs index c6ad077456..51e15339ee 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs @@ -8,12 +8,11 @@ using Microsoft.AspNetCore.Identity; using Volo.Abp.Auditing; using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Guids; -using Volo.Abp.ObjectMapping; using Volo.Abp.Users; namespace Volo.Abp.Identity { - public class IdentityUser : FullAuditedAggregateRoot, IUser, IMapTo + public class IdentityUser : FullAuditedAggregateRoot, IUser { public virtual Guid? TenantId { get; protected set; } @@ -281,36 +280,5 @@ namespace Volo.Abp.Identity { return $"{base.ToString()}, UserName = {UserName}"; } - - UserEto IMapTo.MapTo() - { - //TODO: Instead, consider to use automapper (but it makes dependency just for a small code part)?? - - return new UserEto - { - Name = Name, - Email = Email, - EmailConfirmed = EmailConfirmed, - Id = Id, - PhoneNumber = PhoneNumber, - PhoneNumberConfirmed = PhoneNumberConfirmed, - Surname = Surname, - TenantId = TenantId, - UserName = UserName - }; - } - - void IMapTo.MapTo(UserEto destination) - { - destination.Name = Name; - destination.Email = Email; - destination.EmailConfirmed = EmailConfirmed; - destination.Id = Id; - destination.PhoneNumber = PhoneNumber; - destination.PhoneNumberConfirmed = PhoneNumberConfirmed; - destination.Surname = Surname; - destination.TenantId = TenantId; - destination.UserName = UserName; - } } }