是否可以使用 NPoco 映射具有嵌套类和集合类的复杂类?我查看了文档,但我是否可以通过一个查询映射到这个类并不是 100% 清楚。
例如给定这些类:
public class User
{
public int UserId { get; set; }
public string Name { get; set; }
public Address Address { get; set; }
public List<Car> Cars { get; set; }
}
public class Address
{
public string Street { get; set; }
public string City { get; set; }
}
public class Car
{
public string Make { get; set; }
public string Color { get; set; }
}
是否可以通过一个查询映射用户并填充地址属性和汽车属性?
我已经看到我可以进行 OneToMany Fetch,并且也可以映射作为类的属性,但我不确定我是否可以通过一次提取来映射具有这两种属性的类。