本文介绍了如何使用EDM在多对多关系中插入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ADO.Net实体数据模型3.5,我有三个数据库表

1.组(ID,Name)//此表包含用户的组信息

2.角色(ID,Name)//包含角色信息

3. AssignedRoles(GrpID,RoleID)//包含分配给特定组的角色



ADO.Net实体模型针对这三个表生成了以下两个实体(DataEntites)

> 1. Gourp

标量属性
ID
名称

导航
角色

2.角色

标量属性
ID
名称

导航


这两个实体之间的关系是多对多的.

>我想针对特定的groupid插入角色

请在这方面帮助我
向我发送使用Entity Framework插入Role(GroupID,RoleID)的代码.

I am using ADO.Net Entity Data Model 3.5 I have three Database Tables

1. Groups (ID ,Name) // This table contain user''s group information

2. Roles (ID,Name) // contains role information

3. AssignedRoles (GrpID, RoleID) // contain roles assigned to a specific group



ADO.Net Entity Model has generated (DataEntites) the following two entities against these three tables

1. Gourp

Scalar Properties
ID
Name

Navigation
Roles

2. Role

Scalar Properties
ID
Name

Navigation
Groups

The relationship between these two entities is Many to Many.

I want to insert a role against a particular groupid

Please help me in this regard
Send me code that insert Role(GroupID,RoleID) using Entity Framework.

推荐答案


这篇关于如何使用EDM在多对多关系中插入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 08:41
查看更多