I’ve got the following model class:
public class Product
{
public int ProductID {get;set;}
public string ProductName {get;set; ]
public int ActiveOrdersCount {get;set;}
public Category[] Categories {get;set}
//etc...
}
When I load a product from the database, I load all the properties and maybe lazy-load the categories.
Does it make more sense to load all the properties of the object or partial etc?
It depends on how the objects will be accessed at run time. If you want to immediately access the categories collection for all of the products in a collection, then lazy loading will be very chatty.
On the other end of the spectrum if you only want to hit the Categories property for a small subset of the returned values, lazy loading might be beneficial.