Hello !
Maybe there is something i misunderstood, but I can't automap my input dto with a multilingual entity. I'm using ASP NET Zero 5.4.1 startup template with ABP 3.2.0 update & .NET Core 2.1.
At the line :
var documentCategory = ObjectMapper.Map<DocumentCategory>(input);
of the method
private async Task Create(CreateOrEditDocumentCategoryDto input)
I get this exception :
CreateOrEditDocumentCategoryDto -> DocumentCategory (Destination member list) Colnec.Documents.Dtos.CreateOrEditDocumentCategoryDto -> Colnec.Documents.DocumentCategory (Destination member list)
Unmapped properties: Translations_
What I'm trying is to convert the name from the dto (simple string) into the entity translations collection (with the default language). The exception seems normal because the map is configure with the dto as the destination, but before creating my own CreateMultiLingualMap function for handle the automatic mapping in this way, is there something I'm missing there ? I followed the documentation from ABP website.
Thank's a lot :)
[Table("DocumentCategories")]
public class DocumentCategory : FullAuditedEntity<Guid> , IMayHaveTenant, IMultiLingualEntity<DocumentCategoryTranslation>
{
public int? TenantId { get; set; }
[Required]
[StringLength(DocumentCategoryConsts.MaxLoincCodeLength, MinimumLength = DocumentCategoryConsts.MinLoincCodeLength)]
public string LoincCode { get; set; }
public ICollection<DocumentCategoryTranslation> Translations { get; set; }
}
public class DocumentCategoryTranslation : Entity, IEntityTranslation<DocumentCategory, Guid>
{
public string Name { get; set; }
public DocumentCategory Core { get; set; }
public Guid CoreId { get; set; }
public string Language { get; set; }
}
[AbpAuthorize(AppPermissions.Pages_DocumentCategories_Create)]
private async Task Create(CreateOrEditDocumentCategoryDto input)
{
var documentCategory = ObjectMapper.Map<DocumentCategory>(input);
if (AbpSession.TenantId != null)
{
documentCategory.TenantId = (int?)AbpSession.TenantId;
}
await _documentCategoryRepository.InsertAsync(documentCategory);
}
public class CreateOrEditDocumentCategoryDto : FullAuditedEntityDto<Guid?>
{
[Required]
[StringLength(DocumentCategoryConsts.MaxLoincCodeLength, MinimumLength = DocumentCategoryConsts.MinLoincCodeLength)]
public string LoincCode { get; set; }
public string Name { get; set; }
public int? TenantId { get; set; }
}
public static void CreateMappings(IMapperConfigurationExpression configuration, MultiLingualMapContext context)
{
configuration.CreateMultiLingualMap<DocumentCategory, Guid, DocumentCategoryTranslation, CreateOrEditDocumentCategoryDto>(context);
...