I'm familiarizing with PetaPoco (it looks great btw), but have one blocker here, and I'm curious if I can do that in PetaPoco.
What I would like to do, is to map one row in the database into a composite object. I think that example will clear things up.
Suppose, we have a table in the database called 'Customers' and row looks somethins like this:
ID | Name | City | Street |
1 | John Doe | New York | Some Street Name |
and I would like to use model like that:
public class Customer
{
public int Id { get; set; }
public string Name { get; set; }
public Address Address { get; set; }
}
public class Address
{
public string City{ get; set; }
public string Street { get; set; }
}
So we have to different objects in c#, but it's only one entity (one Id, one row in the database).
Can I achieve such mapping using PetaPoco ?