2020-12-21 18:53:44 +03:00
|
|
|
|
using MapTo;
|
|
|
|
|
|
|
|
|
|
namespace TestConsoleApp.ViewModels
|
|
|
|
|
{
|
|
|
|
|
[MapFrom(typeof(Data.Models.User))]
|
2020-12-22 11:28:14 +03:00
|
|
|
|
public partial class UserViewModel
|
|
|
|
|
{
|
|
|
|
|
public string FirstName { get; }
|
|
|
|
|
|
2021-01-07 11:17:36 +03:00
|
|
|
|
[IgnoreProperty]
|
2020-12-22 11:28:14 +03:00
|
|
|
|
public string LastName { get; }
|
2021-01-07 11:17:36 +03:00
|
|
|
|
|
2021-01-21 19:43:58 +03:00
|
|
|
|
[MapTypeConverter(typeof(LastNameConverter))]
|
2021-01-07 11:17:36 +03:00
|
|
|
|
public string Key { get; }
|
|
|
|
|
|
2021-01-21 11:19:17 +03:00
|
|
|
|
private class LastNameConverter : ITypeConverter<long, string>
|
2021-01-07 11:17:36 +03:00
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
2021-01-27 10:53:29 +03:00
|
|
|
|
public string Convert(long source, object[]? converterParameters) => $"{source} :: With Type Converter";
|
2021-01-07 11:17:36 +03:00
|
|
|
|
}
|
2020-12-22 11:28:14 +03:00
|
|
|
|
}
|
2020-12-21 18:53:44 +03:00
|
|
|
|
}
|