I have the following data model:
I am writing a WCF service that needs to support adding new Report:
public bool CreateNewReport(Report report)
{
MyEntities context = new MyEntities();
context.AddToReports(Report);
context.SaveChanges();
}
So my method gets a report object that was made on the client and adds it to the database throught the data context. (all of the members are included in the DataContract)
My question is regarding navigation properties.
- Do the client also needs to create a user object and put it in the new report object before sending it ?
- What is the best way to approach this ? one way i think of is adding a
UserId
field in theReportEntity
- when a new report is inserted, how do i update the UserEntity Report nav property that with the new Report ?
Thanks.