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
the [Key] attribute put on my column primary key and i dont want my column to have primary key i need this column just to have identity
I have modified my previous reply. Refer the below link.
http://www.aspforums.net/Threads/589470/AspNet-MVC-Column-Identity/Replies/1#Replies
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.