MapTo/test/TestConsoleApp/ViewModels/UserViewModel.cs

22 lines
568 B
C#
Raw Normal View History

using MapTo;
namespace TestConsoleApp.ViewModels
{
[MapFrom(typeof(Data.Models.User))]
public partial class UserViewModel
{
public string FirstName { get; }
2021-01-07 11:17:36 +03:00
[IgnoreProperty]
public string LastName { get; }
2021-01-07 11:17:36 +03:00
[MapProperty(Converter = typeof(LastNameConverter))]
2021-01-07 11:17:36 +03:00
public string Key { get; }
private class LastNameConverter : ITypeConverter<long, string>
2021-01-07 11:17:36 +03:00
{
/// <inheritdoc />
public string Convert(long source) => $"{source} :: With Type Converter";
2021-01-07 11:17:36 +03:00
}
}
}