I have class department inside container Containerclass as following
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- using System.ComponentModel.DataAnnotations.Schema;
- using System.Linq;
- using System.Web;
-
- namespace UniversityData.Models
- {
- [Table("Department")]
- public partial class Department
- {
- public Department()
- {
-
-
- }
- [DatabaseGenerated(DatabaseGeneratedOption.None)]
-
- [Key]
- public int DepartmentID { get; set; }
- [Required]
- [StringLength(50)]
-
- public string DepartmentName { get; set; }
- [Required]
- [StringLength(50)]
- public string YearName { get; set; }
-
-
-
-
-
-
- }
- }
I need to make DepartmentID field identity then apply migrations in database
how to do that
my container class as following
- public partial class ContainerClass : DbContext
- {
- public ContainerClass() : base("name=mycon")
- {
-
- }
- public virtual DbSet<Department> Departments { get; set; }
- }
Table department already created in database but only i need to modify table
to make DepartmentID IDENTITY then make migrations