In the general case, your one-to-many relationship don't have to be "visible" in both A and B.
Another thing to consider is if the classes really belong in different assemblies if they _must_ now about each other. I cannot speak about your idea with interfaces, haven't used that in the way you seem to be thinking about. /Oskar 2009/9/30 sudip <[email protected]>: > > I have the following situation: > > Assembly A.dll contains entity A and its mapping file A.hbm.xml > Assembly B.dll contains entity B and its mapping file B.hbm.xml > > I want to create a One-to-Many relationship between A and B ( A has > many B's). > > What is the recommended way for doing this? Obviously, I can't add a > reference to B in A.dll and vice versa because that would cause a > circular dependency. > > Is it possible to do the following: > > A derives from interface IA > B derives from interface IB > > IA and IB are put in a common assembly (Common.dll). > A.dll specifies the collection element as IB in mapping and code > B.dll specifies the parent as IA in mapping and code > > Use dependency injection via a container to tell NHibernate to use B > when it sees IB and A when it sees IA. > Not sure how the dependency injection would be specified to > NHibernate. > > Looking forward to some responses. > Thanks. > > Sudip > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
