0

I have a table with the following schema, which basically contains items unique per each account, but items and account are not unique for the entire table.

EnteredDate  Account  ItemNo  ItemDesc
01/01/2018   1234     9982-1  TestItem1
01/01/2018   1234     9982-2  TestItem2
01/01/2018   1234     9982-3  TestItem3
01/01/2018   6789     9982-1  TestItem1
01/01/2018   6789     9982-4  TestItem4

I did saw a solution here but not 100% sure I should have the Account unique since this post shows that .

Model
public DateTime? EnteredDate { get; set; }

[StringLength(12)]
[Index("IX_TestItemNoPerAccount", 1, IsUnique = true)]
[Required]
public string Account { get; set; }

[StringLength(20)]
[Index("IX_TestItemNoPerAccount", 2, IsUnique = true)]
[Required]
public string ItemNo { get; set; }

[StringLength(500)]
[Required]
public string ItemDesc { get; set; }

So Should I have Account Unique or I should remove it? Thanks!

joseph.c
  • 146
  • 13

0 Answers0