TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
515
46.4k
About Identity-Auto Increment Id in MVC
Feb 6 2021 6:44 PM
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
Reply
Answers (
9
)
Autocomplete Address using Google API Showing Error
How to insert multiple data in a table?