Thanks for the repsonse,
I took a glance at the Wilson Nhibernate example.. I couldnt get it to actually run for some reason (exception in the Nhibernate.dll, didnt have time to debug)
What I saw was that he was instantiated his IList's in the Nhibernate object files.
IList something = new ArrayList();
This would allow a user to Add Children to an unsaved parent. And when they click OK on the parent it would loop through the children Ilist and save.
It didnt work though. I assume because the IList wasnt created by Nhibernate it threw up. (Gave a could not save or update row not found error)
So now i've hacked it (really not a great hack) by adding an arraylist to the object. So as an example, I have a Car object that has Tire's as children
IList Tires
ArrayList NTires
So when creating a new Car, any tires added would go into the NTires, then when you click OK on your car, it would save the Car, then loop the NTires and call Save on them, setting their parent to be Car.
What a horrible solution. Has anyone been able to create the IList Tires manually and have it persist properly?
|