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

Rijwan AnsariRank #82 · 24.2K reputationPosted Feb 7, 2021, 12:39 AM EST
Satya KarkiRank #78 · 24.6K reputationPosted Feb 7, 2021, 12:42 AM EST
Rijwan AnsariRank #82 · 24.2K reputationPosted Feb 7, 2021, 12:49 PM EST
Sachin SinghRank #66 · 26.2K reputationPosted Feb 6, 2021, 2:28 PM EST
Guest UserRank #2,192 · 643 reputationPosted Feb 6, 2021, 2:32 PM EST
Sachin SinghRank #66 · 26.2K reputationPosted Feb 6, 2021, 2:35 PM EST
Guest UserRank #2,192 · 643 reputationPosted Feb 6, 2021, 3:11 PM EST
Guest UserRank #2,192 · 643 reputationPosted Feb 7, 2021, 9:21 AM EST
Guest UserRank #2,192 · 643 reputationPosted Feb 8, 2021, 2:39 AM EST