Из того, что я прочитал, стандарт заключается в наследовании класса Profile, чтобы Automapper обнаруживал карты. https://automapper.org/
public class GamerVM : Profile
{
public GamerVM()
{
CreateMap<GamerVM, Gamer>();
CreateMap<Gamer, GamerVM>();
}
public int Id { get; set; }
public string Name { get; set; }
public string Tag { get; set; }
}
Если я наследую этот класс в моей модели представления, Json возвращается с дополнительными свойствами:
{
"id": 8,
"name": "Ashton Heir",
"tag": "Legend",
"defaultMemberConfig": {
"nameMapper": {
"getMembers": {},
"namedMappers": [
{
"methodCaseSensitive": false
},
{},
{
"prefixes": [
"Get"
],
"postfixes": [],
"destinationPrefixes": [],
"destinationPostfixes": []
}
]
},
"memberMappers": [
{
"nameMapper": {
"getMembers": {},
"namedMappers": [
{
"methodCaseSensitive": false
},
{},
{
"prefixes": [
"Get"
],
"postfixes": [],
"destinationPrefixes": [],
"destinationPostfixes": []
}
]
}
},
{
"sourceMemberNamingConvention": {
"splittingExpression": {
"pattern": "(\\p{Lu}+(?=$|\\p{Lu}[\\p{Ll}0-9])|\\p{Lu}?[\\p{Ll}0-9]+)",
"options": 0
},
"separatorCharacter": ""
},
"destinationMemberNamingConvention": {
"splittingExpression": {
"pattern": "(\\p{Lu}+(?=$|\\p{Lu}[\\p{Ll}0-9])|\\p{Lu}?[\\p{Ll}0-9]+)",
"options": 0
},
"separatorCharacter": ""
}
}
]
}
Я правильно это делаю? Есть ли способ, чтобы JSON игнорировал эти дополнительные свойства?