What is the best way to use nested Objects with Subsonic when I only have Iqueryable for Foreign Key Relationships
I'd like to use Subsonic i开发者_如何学JAVAn a shopping cart application, but I'm trying to replace code that is using Session to store an Order object. That Order object has a collection or OrderDetail objects that are added to the collection through the shopping cart process. I'm impressed with what Subsonic can do and I think I'm missing how I could implement it in this project. What I need is:
Order.OrderDetails.Add(new OrderDetail());
Right now Subsonic is creating the one-to-many relationship for me based on the foreign key in the OrderDetails table. But Order.OrderDetails is available as an Iqueryable interface. I would like more control over how the property is managed. How have other managed to use the Subsonic generated objects to hold data in memory before saving to the database?
You could add another property via a partial class and use that instead of the generated one:
public partial class Order {
public IList<OrderDetail> Details { get; set; }
}
精彩评论