Duplicate 'Column' attribute
I am creating an entity using Entity Framework 4.1 and I am using column to give different names to columns. I have a composite key as well as foreign key but I am getting error
public class Account
{
[Key]
[ForeignKey("Account"), Column(Order = 0)]
[Column("Creditor ID", Order = 0)] //PK F开发者_Go百科K
public int CreditorId { get; set; }
[Key]
[ForeignKey("Account"), Column(Order = 1)]
[Column("[Account No]", Order = 1)] //PK FK
public int AccountNo { get; set; }
}
Both are primary key as well as foreign keys
I get following error:
Duplicate 'Column' attribute
Well, you do! each property has two ColumnArtribute instances defined. The fact that they are on different lines and in different sets of square brackets is irrelevant.
It looks like in both cases the one on the first line is redundant.
精彩评论