Featured

EF : Code First – Auto Increment Key

No need for an explanation for the subject. Its a general scenario to have an auto incremental key column in DB. So, we can use [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] attributes for the purpose, for example : namespace CustomerBase.Models { using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; public partial class Customer { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } […]

Read More EF : Code First – Auto Increment Key