首先将默认成员添加到代码中

时间:2017-09-15 15:15:09

标签: c# entity-framework ef-code-first code-first

我在代码中几乎是新手。我希望ef在创建数据库时将默认成员添加到表中,例如: 表名:用户 默认成员:

        var user1 = new User() { Email = "u1@contoso.com", FirstName = "u1" };
        var user2 = new User() { Email = "u2@contoso.com", FirstName = "u2" };
        var user3 = new User() { Email = "u3@contoso.com", FirstName = "u3" };
        var user4 = new User() { Email = "u4@contoso.com", FirstName = "u4" };
        var user5 = new User() { Email = "u5@contoso.com", FirstName = "u5" };

我该怎么办?

0 个答案:

没有答案