Nested Object Mapping

ℹ️ Description: AutoMapper recursively maps nested objects if mappings are defined.

Mapping Result

Property Value
Id 1
First Name John
Last Name Doe
Full Name Computed
Email john.doe@example.com
Date of Birth Formatted
Age Calculated 0 years
Total Orders 0
Status Resolver
Address 123 Main St
New York, NY 10001
Full Address: 123 Main St, New York, NY 10001, USA
💻 Code Used
// Create source object
var user = new User
{
    Id = 1,
    FirstName = "John",
    LastName = "Doe",
    Email = "john.doe@example.com",
    DateOfBirth = new DateTime(1990, 1, 1),
    // ... other properties
};

// Map to DTO using AutoMapper
var userDTO = _mapper.Map<UserDTO>(user);

// That's it! AutoMapper handles all the mapping logic