1. Convert an existing property to Enum:

EntityFramework 学习 一  枚举-LMLPHP

EntityFramework 学习 一  枚举-LMLPHP

EntityFramework 学习 一  枚举-LMLPHP

EntityFramework 学习 一  枚举-LMLPHP

 using (var ctx = new SchoolDBEntities())
{
Teacher tchr = new Teacher();
tchr.TeacherName = "New Teacher"; //assign enum value
tchr.TeacherType = TeacherType.Permanent; ctx.Teachers.Add(tchr); ctx.SaveChanges();
}

2. Add New Enum from Designer:

EntityFramework 学习 一  枚举-LMLPHP

3. If you already have Enum type created in your code, then you can use that as a data type of any entity property.

05-14 10:00