У меня есть запись:
Код: Выделить всё
public record EmployeeId
{
public Guid Value { get; }
public EmployeeId(Guid value)
{
DomainException.ThrowIf(
value == Guid.Empty,
"Employee ID is required");
Value = value;
}
}
Код: Выделить всё
public record EmployeePreview
{
public Guid Id { get; init; }
//And other properties
}
Код: Выделить всё
internal class EmployeeMappingProfile : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.ForType()
.Map(dest => dest.Id, src => src.Value);
}
}
Код: Выделить всё
var empl = new EmployeeId(Guid.NewGuid());
var res = empl.Adapt();
И у меня есть регистрация картографа:
Код: Выделить всё
TypeAdapterConfig.GlobalSettings.Scan(assembly);
Я пробовал другие методы, такие как MapWith или ConstructUsing, но результат тот же>
Подробнее здесь: https://stackoverflow.com/questions/797 ... ue-objects
Мобильная версия