Hello,
I want to wrap my untyped collections in business classes with some generic wrapper. Wrapper class has some additional functionality, it is raising events when items are added or removed from collection, for example. Because of this functionality, I cannot have the following code for the wrapping - I need to have only one instance of the wrapper per collection.
Code:
// persistent bag
private IList m_KnownSubjects = new ArrayList();
// generic wrapper
private BusinessList<Subject> g_KnownSubjects {
get { return new BusinessList<Subject>(m_KnownSubjects); }
}
Of course I tried to create wrapper in the constructor, but it seems to be too soon - my wrapper then managed empty instance of ArrayList instead of the instance loaded by Nhibernate.
Code:
// persistent bag
private IList m_KnownSubjects = new ArrayList();
// generic wrapper
private BusinessList<Subject> g_KnownSubjects;
// constructor code
g_KnownSubjects = new BusinessList<Subject>(m_KnownSubjects);
Any ideas? Many thanks.