views:

108

answers:

1

I'd like to use Subsonic in 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?

A: 

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; }
}
John Sheehan
Thanks for the suggestion John. How can I prevent the original property from being automatically generated?
Mark Fruhling