1. Convert an existing property to Enum:

 

EntityFramework 学习 一  枚举

 

EntityFramework 学习 一  枚举

 

EntityFramework 学习 一  枚举

EntityFramework 学习 一  枚举

 

 

 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 学习 一  枚举

 

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

 

相关文章:

  • 2021-10-14
  • 2018-02-28
  • 2018-06-28
  • 2021-11-17
  • 2021-12-21
  • 2022-01-15
  • 2022-12-23
猜你喜欢
  • 2021-09-26
  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案