【发布时间】:2013-08-06 08:03:23
【问题描述】:
我最初在聚合中使用 Enum 恰好对我来说工作正常,但是现在当我将属性更改为 List 时,我发现这些值没有在数据库中保存或检索,我认为 CodeFirst 会为 List 创建一个单独的表并在其中映射行,但事实并非如此,既不会存储也不会检索值。
聚合:
public class Trainee: Entity
{
public int TraineeId { get; set; }
public string Name { get; set; }
public int Age { get; set;}
public virtual List<CoursesTypes> CoursesOpted { get; set; }
}
枚举:
public enum CoursesTypes
{
PHP,
Networking,
}
【问题讨论】:
-
有同样的问题有答案:stackoverflow.com/questions/28429945/…
标签: c# entity-framework enums