Hello everyone,
Hope everyone is fine
I am working on web application using OrmLite and Sql server.
I have created table "AgeGroups" with column "id" as PrimaryKey and Set Identity to True in Sql table, So that I can achieve autoincrement in my web application
But in application when I am trying to insert record it always gets "id" as 0 and don't auto increment
In my entity I have already used [Key] and Identity attribute to id column. Following is my table
public partial class age_groups
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int id { get; set; }
public string name { get; set; }
public DateTime created_at { get; set; }
public DateTime updated_at { get; set; }
}
I tried to use [AutoIncrement] attribute, but it says 'could not find assembly', so I am not sure which dll I am missing.
Also, Please help to save AutoIncrement Id in sql database, Any help will be appreciated.
Thank you in advance
9 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Guest UserPosted Feb 8, 2021, 7:39 AM
Rijwan AnsariPosted Feb 7, 2021, 5:49 PM
Guest UserPosted Feb 7, 2021, 2:21 PM
Satya KarkiPosted Feb 7, 2021, 5:42 AM
Rijwan AnsariPosted Feb 7, 2021, 5:39 AM
Guest UserPosted Feb 6, 2021, 8:11 PM
Sachin SinghPosted Feb 6, 2021, 7:35 PM
Guest UserPosted Feb 6, 2021, 7:32 PM
Sachin SinghPosted Feb 6, 2021, 7:28 PM