Anders Lindén
Anders Lindén

Reputation: 7323

Ambigous reference using ColumnAttribute

In one project, I was able to use ColumnAttribute without problems.

In another, not. I have the following class in a test project:

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; }
}

resulting in

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

I have the following references added to the test project:

Upvotes: 0

Views: 447

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364369

Are you using .NET 4.5? In such case you will have ColumnAttribute in both System.ComponentModel.DataAnnotations.dll and EntityFramework.dll. The solution should be upgrading EntityFramework to 5.0 because version 4.4 is only for .NET 4.0.

Upvotes: 2

Related Questions