Sunday, 8 September 2013

Entity framework with lambda to insert records into linked tables

Entity framework with lambda to insert records into linked tables

My tables looks like this :

I am using entity framework with CRUD class files . First i would let user
create an activity.
Then under the list of Activity , choose the activity that u want to
create the task under which activity.
But how do i tied them using codes in ActivityTask table ? What i want to
do is that the record will be auto generated at ActivityTask table where
activityID is tied to a taskID whenever a certain task is being created
under the selected activity .
Right now my codes are as simple as this :
//Insert record
public void Insert(ModelSQL.task act)
{
context.tasks.AddObject(act);
}
I am stucked at how to continue doing this . Do we have to use Include or
something to include the link tables as well?

No comments:

Post a Comment