Hello, I have a domain object that should contain 2 properties of type OrganizationUnit.
In the application in hand, I am making use of OUs in such a way that I need a concept of Region and within a Region there are Camps. So when creating a new instance of this domain object the user will select a Region (i.e. OU) and then based on the Region selection I filter out a second dropdown list containing Camps (to display only children OUs of the Region OU).
So in summary when saved in the DB, this domain object should have Ids for both Region OU and optionally Camp OU Id.
As far as properties to be added to the domain object, it will be 2 properties of type OrganizationUnit. But for DB relations, what relations I shall place here and where on which object (so that EF would handle the relations etc, ..)
Every Domain object has 1 Region (OU) and 1 or 0 Camp (OU). So the relation is 1 to Many and 1 to 0/Many. (OU Region can contain more than 1 of the domain objects).
So shall I add 1 property on the domain object of type OrganizationUnit and called Region
And add another property of type OrganizationUnit and called Camp (but nullable as the relation is 1 to 0).
Do I need to add 2 collections on OrganizationUnit object?
Many Thanks Bilal
2 Answer(s)
-
0
Hi,
So shall I add 1 property on the domain object of type OrganizationUnit and called Region And add another property of type OrganizationUnit and called Camp (but nullable as the relation is 1 to 0).
Yes, for this one :).
Do I need to add 2 collections on OrganizationUnit object?
You don't need to add this to organization unit if you are not going to use it.
-
0
Thanks a lot :-)