I have two table called Project and ProjectComments on my database.
I mapped them these two tables to my Entity Framework Model with generator.
Each project have many ProjectComments. I don’t want to add ProjectComments as a navigation property to Project because i want to write a GetProjectComments function to Project class.
Btw i can make desicion in GetProjectComments function for IsDeleted column of ProjectComments table. Because i don’t really delete any rows from ProjectComments table, i only make its IsDeleted = true if i need to delete, thus i shouldn’t return ProjectComments whose IsDeleted = true in GetProjectComments function.
It’s okay up to now. The problem is that in GetProjectComments function of Project class i need provider(context object) as parameter to call SaveChanges method of the same provider.
Is there any method to make these approach without asking provider object as a parameter in GetProjectComments function. Am i doing something wrong??
Looking for you reply. Thanks a lot.
Easier :
Add a ProjectComments navigation property in Project class (well let the generator do the job)
Add a new property in a partial “Project” class
EDIT
or as danludwig stated