Creating class components
There are cases where a set of properties are used repeatedly. These properties may even have their own business logic, but they do not represent an entity in your application. They are value objects. In this recipe, we will tell you how to separate these properties and business logic into a component class without creating a separate entity.
Getting ready
Complete the Getting ready instructions at the beginning of this chapter.
How to do it…
Add a folder named
Components
to theMappingRecipes
project.In the folder, add an
Addr
ess
class with the following properties:public virtual Guid Id { get; protected set; } public virtual string Lines { get; set; } public virtual string City { get; set; } public virtual string State { get; set; } public virtual string ZipCode { get; set; }
Add a
Custo
mer
class with the following properties:public virtual string Name { get; set; } public virtual Address BillingAddress { get; set; } public virtual Address ShippingAddress { get; set...