sergey wrote:
But the model wouldn't have to know about NHibernate, that's the whole point!
Anyway, your approach will work too, as long as you tell NHibernate to access the collection directly (using access="field...").
Yes but this solution had a problem. I if i use this collection in HSQL i have to use "kittens" not the public property "Kittens".
I think't about it. IList ISet and something else are a liddle bit generic. Ive looked at the implementation of System.Collection.ObjectModel.Collection . It is only a wrapper. It has an internel Field with name items of type IList and all Methods are using this underling IList.
NHibernate can detect that Kittens is derived from Collection und create an instance of this collection with default constructor when its null and then redirect NHibernate to the private items field of the Collection.
Its not a "must have" feature, but i could increase the capabilities of nHibernate.
If you say its intresting and its possibility, then i can try to write a patch for it. But i have to know about the sticking points.