小编Jef*_*ear的帖子

剂量q和Clojure之间的差异

doseq和Clojure之间有什么区别?什么时候你选择使用一个而不是另一个?

clojure

100
推荐指数
2
解决办法
2万
查看次数

保存枚举时值不正确

我将Entity Framework 5 Enums映射到迁移中的整数列时遇到一些困难.这是代码的样子:

[Table("UserProfile")]
public class UserProfile
{
    public enum StudentStatusType
    {
        Student = 1,
        Graduate = 2
    }

    [Key]
    public int UserId { get; set; }
    public string UserName { get; set; }
    public string FullName { get; set; }
    public StudentStatusType Status { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

迁移看起来像这样:

public partial class EnumTest : DbMigration
{
    public override void Up()
    {
        AddColumn("UserProfile", "Status", c => c.Int(nullable: false, defaultValue:1));
    }

    public override void Down()
    {
        DropColumn("UserProfile", "Status");
    }
} …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework code-first ef-migrations entity-framework-5

5
推荐指数
1
解决办法
809
查看次数