We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
The sample shows how to map Person to PersonDto
Person
PersonDto
public sealed class Person { public string Email { get; set; } public string FirstName { get; set; } public Guid Id { get; set; } public string LastName { get; set; } }
and
public sealed class PersonDto { public string Email { get; set; } public string FirstName { get; set; } public Guid Id { get; set; } public string LastName { get; set; } }
First of all Bind Person type to PersonDto type and we don't want map Email property. So it has been ignored.
Bind
Email
TinyMapper.Bind<Person, PersonDto>(config => { config.Ignore(x => x.Email); });
var person = new Person { Id = Guid.NewGuid(), FirstName = "John", LastName = "Doe", Email = "support@tinymapper.net", };
Now TinyMapper knows how to map Person object to PersonDto object. Finally, call
TinyMapper
var personDto = TinyMapper.Map<PersonDto>(person);