我可以将哪些属性类型用于我的Entity Framework模型类?

时间:2015-04-19 10:37:58

标签: c# entity-framework

我有一个这样的课程:

    public class BabyChangeFacility
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public ChangeFacilityType Type { get; set; }
        public OpeningHours OpeningHours { get; set; }
        public LatLng Coordinates { get; set; }
        public string Notes { get; set; }
    }

我希望ChangeFacilityTypeOpeningHours成为某种形式的枚举类型,即它们的值应该是预定义的 - 例如我希望ChangeFacilityType具有以下任一字符串值:

Female Only Male and Female

OpeningHours同样具有以下值:

Shop opening hours Daylight hours

定义它们的最佳方法是什么?我最初考虑过使用enum,但据我所知,它们不能代表字符串值,所以我有点不知道怎么做 - 有人可以帮忙吗?

0 个答案:

没有答案