Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 4 在EF CodeFirst中使用复杂数据类型_Asp.net Mvc 4_Ef Code First_Entity Framework 5 - Fatal编程技术网

Asp.net mvc 4 在EF CodeFirst中使用复杂数据类型

Asp.net mvc 4 在EF CodeFirst中使用复杂数据类型,asp.net-mvc-4,ef-code-first,entity-framework-5,Asp.net Mvc 4,Ef Code First,Entity Framework 5,这是我的模型: public class Course { public int Id { get; set; } public string Title { get; set; } public string Institute { get; set; } public string Instructor { get; set; } public string Duration { get; set; }

这是我的模型:

public class Course
    {
        public int Id { get; set; }
        public string Title { get; set; }
        public string Institute { get; set; }
        public string Instructor { get; set; }
        public string Duration { get; set; }
        public Level Level { get; set; }
        public Format Format { get; set; }
        public DateTime Released { get; set; }
        public string FileSize { get; set; }
        public string Desciption { get; set; }
    }
    public enum Level
    {
        Beginner,
        Intermediate,
        Advanced
    }
    public enum Format
    {
        Avi,
        Hd,
        FullHd
    }
    public class CourseDb:DbContext
    {
        public DbSet<Course> Courses { get; set; }
    }
公共课
{
公共int Id{get;set;}
公共字符串标题{get;set;}
公共字符串机构{get;set;}
公共字符串指导员{get;set;}
公共字符串持续时间{get;set;}
公共级别{get;set;}
公共格式{get;set;}
发布的公共日期时间{get;set;}
公共字符串文件大小{get;set;}
公共字符串说明{get;set;}
}
公共枚举级别
{
初学者,
中间的
先进的
}
公共枚举格式
{
阿维,
房屋署,
全高清
}
公共课程B:DbContext
{
公共数据库集课程{get;set;}
}
当我想使用EF模板创建带有支架的新控制器时,
当我使用EF5时,不能同时创建
级别
格式
字段
我有什么问题?

感谢您的建议

搭建时当前不支持枚举类型,这很可能是未创建字段的原因

我的建议是使用助手方法,例如:

并手动编写代码

更新:

这里似乎记录了支持它的票证: