示例#1
0
 public string CreateUserTable(Seed seed)
 {
     return seed.CreateTable("Users",
         new { Id = "int", Identity = true, PrimaryKey = true },
         new { Email = "nvarchar(max)" },
         new { FirstName = "nvarchar(max)" },
         new { LastName = "nvarchar(max)" },
         new { Password = "******" }
     );
 }
        void SetupSchema()
        {
            seed = new Seed();

            seed.PurgeDb();

            seed.CreateTable("Blogs", new dynamic[]
            {
                new { Id = "int", Identity = true, PrimaryKey = true },
                new { Title = "nvarchar(255)" },
                new { Body = "nvarchar(max)" }
            }).ExecuteNonQuery();

            seed.CreateTable("Comments", new dynamic[]
            {
                new { Id = "int", Identity = true, PrimaryKey = true },
                new { BlogId = "int", ForeignKey = "Blogs(Id)" },
                new { Text = "nvarchar(1000)" }
            }).ExecuteNonQuery();
        }