Entity Framework Code First Using One column as Primary Key and another as Auto Increment Column
You can also do this with Data Annotations: public class Sale { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } [Key] public string TrNo { get; set; } public DateTime Date { get; set; } public int CustomerID { get; set; } public ObservableCollection<SaleDetail> SaleDetails { get; set; } }