2012-11-23 38 views
0

在一個項目中,我能夠毫無問題地使用ColumnAttribute。使用ColumnAttribute進行引用不準確

在另一個,不是。我有以下的類在測試項目:導致

Ambigous reference: 
System.ComponentModel.DataAnnotations.Schema.ColumnAttribute 
System.ComponentModel.DataAnnotations.Schema.ColumnAttribute 
match 

我有以下引用添加到測試項目

class TestClass_x 
{ 
    [Key, Column(Order = 0)] 
    public int i { get; set; } 

    [Key, Column(Order = 1)] 
    public string i2 { get; set; } 

    public string str { get; set; } 
} 

  • 的EntityFramework(V 4.4.0.0)
  • 項目來測試
  • 另一個項目來測試
  • 第三個項目,以測試
  • Microsoft.VisualStudio.Quality.Tools.UnitTestFramework(ⅴ10.0.0.0)
  • PresentationFramework(V 4.0.0.0)
  • 系統(ⅴ4.0.0.0)
  • 系統。 ComponentModel.DataAnnotations(v 4.0.0.0)

回答

2

您是否使用.NET 4.5?在這種情況下,您將在System.ComponentModel.DataAnnotations.dll和EntityFramework.dll中都有ColumnAttribute。該解決方案應該將EntityFramework升級到5.0,因爲4.4版僅適用於.NET 4.0。

相關問題