In a typical organization application i create, entities User
,Projects
,Company
,Contacts
exists. For the user class defined below i think i will hit with a circular dependency. How should i modify the class below to solve the problem.
User
Username
Company
Projects
List<Projects>
Project
ProjectName
Resources
List<Resource>
Project Head
User
Resource
ResourceId
ProjectId
ReportingHead
User
You must have already found the flaw but,as you see ReportingHead
, ProjectLead is already User class this makes it query for information about projects for them ,which will result in another cycle to retrieve the users for their project.
Even though resource is associated with project i will have to add a property projectId( First it was of type project) because i had a IResourceRepository
to create resource for a project which would return a instance of Resource
. How should the class be designed now so that it makes sense?