-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProjectLike Infinite Project References #341
Comments
I would like to add that this is also the case with the User class. When the user likes his own project the ProjectLike class will reference the CreatorOfProject which contains a list of ProjectLikes referencing back to the ProjectLike with the user. |
I will be refactoring the ProjectLike class to: |
Okay, I've finnaly come to the conclusion that this isn't a bug that needs to be fixed.
That being said, why isn't this a bug? There's 2 reasons:
|
Reopened this issue because naming is not right. CreatorOfProject attribute is actually the one who likes the project. |
Ah yes my bad, seems like entity framework uses bidirectional relationships as its standard when using this kind of code first approach. Good catch. |
Describe the bug
In the Models Project class, a list of ProjectLike is present. However in ProjectLike there is again a reference to the aforementioned Project, essentially creating an infinite chain. Moreover in ProjectLike there is redundant information in the properties, a 'CreatorOfProject' User property is present, while this is already in the parent Project entity.
Also the user that actually made the like is only referenced by an Integer property 'UserId', this should probably also have the whole User Entity as a property.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Code should be DRY and follow SOLID principles.
The text was updated successfully, but these errors were encountered: