2012-12-02 95 views
1

我一直在嘗試構建一個應用程序並遇到小問題的EF5。實體框架5代碼首先不映射模型

我創建了像

public class TargetBusinessModel 
{ 
    public int Id { get; set; } 
    public Guid BusinessId {get; set; } 
    public Business Business { get; set; } 
    public string ContactName { get; set; } 
    public string ContactTitle { get; set; } 
    public string ContactPhone { get; set; } 
} 

更新的內容檔案

public DbSet<TargetBusinessModel> TargetBusinessModels { get; set; } 

我的問題是沒有從業務屬性都在數據庫中映射模型。

我試圖添加的商業模式來自另一個項目,我不確定是否這是原因。

我不介意代碼是先爲我的商業模型創建一個單獨的表還是將它們組合在一起。

任何人都可以幫忙嗎?

回答

0

試圖爲Business實體添加DbSetDbContext實現:

public DbSet<Business> Businesses { get; set; } 
+1

由於懶惰,這是答案:) –