2012-10-18 19 views
1

在我的项目我在实体框架项目是我建的DLL中使用,我有例如类是这样的:DLL不行

类玩家的游戏
public class Games 
{ 
    public int GameID { get; set; } 
    public string Description { get; set; } 
    public float Time { get; set; } 
    public int Level { get; set; } 

    //Collection of all the players that play in the game 
    public virtual ICollection<PlayerGame> PlayersInGame { get; set; } 

} 

定义的游戏一样,这个属性:

public virtual Games Game { get; set; } 

约束定义在模型构建上。

玩家游戏中的游戏是表中的外键。

当我在这个项目上测试它收集填充细节。

但是,当我在其他项目中的集合空白。

在其他项目中的代码是这样的:

GamesContext MyContext = new GamesContext(); 
List<Games> GamesList= MyContext.GamesTbl.ToList(); 
在上下文类

我有表和约束,并在实体框架的项目工作!

+1

问题,你能告诉你正在使用针对这个DLL的代码? – Arrow

+0

我编辑问题... –

+0

因此,在您使用此库的其他项目中,是否正确配置数据库访问? – Gromer

回答

0

的DLL最终没有工作..

有在配置文件中