You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicpartialclassUserMapper:IUserMapper{publicExpression<Func<User,UserDto>> UserProjection =>p1 =>new UserDto(){Id= p1.Id,Name= p1.Name} public UserDto MapTo(User p2){return p2 ==null?null:new UserDto(){Id= p2.Id,Name= p2.Name};}public UserDto MapTo(Userp3,UserDtop4){if(p3==null){returnnull;}UserDtoresult=p4??new UserDto();
result.Id = p3.Id;//there is an error due to property marked as init
result.Name = p3.Name;//there is an error due to property marked as initreturnresult;}}
Can someone help me?
The text was updated successfully, but these errors were encountered:
YaroslavMudryk
changed the title
Mapping with existing object and init properties are failed
Error mapping with existing object and init properties
Feb 7, 2023
I have object User and UserDto:
Also i have config:
And interface for mappers:
As result I get the generated file:
Can someone help me?
The text was updated successfully, but these errors were encountered: