2
当EntityDataSource _Inserted
事件引发时,我需要填充Pure Junction Table(仅包含FK到其他表)。实体框架如何使用导航属性
我在我的数据库表3:
CmsJobs (JobId)
CmsJobsUsers (JobId FK, UserId FK)*
aspnet_Users (UserId)
* CmsJobsUsers是PURE结合表并且不表示为EF模型中的实体。
在这里我的代码,我不能够保存这个数据在CmsJobsUsers。
protected void uxEntityDataSourceCreateJob_Inserted(object sender, EntityDataSourceChangedEventArgs e)
{
Guid myUserListSelected = new Guid(uxListUsers.SelectedValue);// Guid for UserId in DropDownList
CmsJob myJob = (CmsJob)e.Entity; // My new Jobid
aspnet_Users myUser = new aspnet_Users();
myUser.UserId = myUserListSelected;
}
任何想法?谢谢你的帮助!
这里有用的资源: 但我不能implment它: http://thedatafarm.com/blog/data-access/inserting-many-to-many-relationships-in-ef-with-or-without-a-join-entity/
由于现在它的工作原理 – GibboK 2011-02-04 08:58:14