Hello,
can any one tell me how to make a column identity using Data anotation without having primary key on the column
Note: any other solution using code first it is ok also
Thanks
Mohammad
Hi Mohammadmk,
Refer the below code.
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; }
https://msdn.microsoft.com/en-us/data/jj591583.aspx
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.