Linq to SQL-多对多映射 [英] Linq to SQL - many to many mapping

查看:72
本文介绍了Linq to SQL-多对多映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我有"Player"(玩家ID和数据)表,"Games"表(GameID,Name),并且创建了很多表"PlayerGames"(PlayerID,GameID-我创建了外键关系)

In my project I have 'Player'(PlayerID and data) table, 'Games' table (GameID, Name) and I made a many to many table 'PlayerGames' (PlayerID, GameID - I created the forign keys relations)

PlayerID和GameID是它们表中的主键,元组(PlayerID,GameID)是"PlayerGames"表中的主键

PlayerID and GameID are primary keys in their tables and the tuple (PlayerID,GameID) are primary key in 'PlayerGames' Table

我尝试使用Visual Studio中的设计器将这些表映射到类中.

I tried to map these tables in classes using the designer in visual studio.

但是在玩家类中,我没有带有游戏列表的游戏"属性.相反,我具有EntitySet类型的PlayerGames属性.

But in the player class I don't have 'Games' property with a list of games. Instead, I'm having PlayerGames property of type EntitySet.

我该怎么办?

推荐答案

您可能还想查看 CodeSmith的PLINQO .它不是免费的,但它是Linq to Sql的超级拉皮版本,它支持多对多关系,等等.

You might also want to check out CodeSmith's PLINQO. It's not free, but it's a super-pimped version of Linq to Sql and it supports many-to-many relationships, among other things.

这篇关于Linq to SQL-多对多映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆