I have a composite key mapped in a class as shown:
HasKey(l => new { l.A, l.B });
But, here A is supposed to be an identity.
Property(l => l.A).HasColumnName("A").HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
Property(l => l.B).HasColumnName("B");
However, when I try to Add an object with the value of A(null since it is an identity) and B, I get a Primary Key violation.
Is there any way to get around this?
The types are as follows:
public Int64? A{ get; set; } //Identity
public int B { get; set; }
And from a DB world:
A bigint
B int