I have a situation where I need to create a relationship between two entities. The relationship will be one to one, but one of the entities exists in a database I don't have the ability to modify, so I created an "extension table" to represent the relationship:
Organization
OrgId
Name
Style
StyleId
StyleInfo
StylesForOrgs
StyleId
OrgId
The tables are more complex than that, but you get the idea. I want to map the the table to my Organization entity and cohesively as possible so the domain layer doesn't know or care about the extension table. Every Organization has a Style object in it.
How would I go about this? I thought of using a many-to-many, but I didn't want to use set semantics on the Organization entity since each Org will only have a SINGLE style. Additionally, the organization table might change and I might get my field in there.
Would a View be a better approach? Map the combined Organization + Style in my domain?
Is there a way to do this WITHOUT a view with nHibernate and not use a set or bag?
Worst case I use the bag and write some domain logic to handle this case.
|