Using Entity Framework SQL-Server-CE I have created a table like this:
class Era {
public long Id { get; set; }
[Index(IsUnique=true), Required]
public long Code { get; set; }
public string Name { get; set; }
public long StartDate { get; set; }
public long EndDate { get; set; }
}
Whenever I try to insert into it using Entity Framework, the Id
field of the Era
object is ignored and an auto incremented Id
is inserted.
How can I make the Id
field not to use the auto incremented value, and use the given value instead, using annotations preferably.