本文整理汇总了C#中Seed.PurgeDb方法的典型用法代码示例。如果您正苦于以下问题:C# Seed.PurgeDb方法的具体用法?C# Seed.PurgeDb怎么用?C# Seed.PurgeDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Seed
的用法示例。
在下文中一共展示了Seed.PurgeDb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: before_each
void before_each()
{
seed = new Seed();
markets = new Markets();
seed.PurgeDb();
seed.CreateTable("Markets",
seed.Id(),
new { Name = "nvarchar(255)" }).ExecuteNonQuery();
seed.CreateTable("SupplyChains",
seed.Id(),
new { MarketId = "int" },
new { SupplierId = "int" }).ExecuteNonQuery();
seed.CreateTable("Suppliers",
seed.Id(),
new { Name = "nvarchar(255)" }).ExecuteNonQuery();
supplier1Id = new { Name = "Supplier 1" }.InsertInto("Suppliers");
supplier2Id = new { Name = "Supplier 2" }.InsertInto("Suppliers");
market1Id = new { Name = "Market 1" }.InsertInto("Markets");
market2Id = new { Name = "Market 2" }.InsertInto("Markets");
new { MarketId = market1Id, SupplierId = supplier1Id }.InsertInto("SupplyChains");
new { MarketId = market2Id, SupplierId = supplier1Id }.InsertInto("SupplyChains");
}
示例2: before_each
void before_each()
{
seed = new Seed();
seed.PurgeDb();
cars = new Cars();
seed.CreateTable("Cars",
new { Id = "int" },
new { Model = "nvarchar(255)" }).ExecuteNonQuery();
seed.CreateTable("BluePrints",
new { Id = "int" },
new { CarId = "int" },
new { Sku = "nvarchar(255)" }).ExecuteNonQuery();
car1Id = 100;
new { Id = car1Id, Model = "car 1" }.InsertInto("Cars");
car2Id = 200;
new { Id = car2Id, Model = "car 2" }.InsertInto("Cars");
bluePrint1Id = 300;
new { Id = bluePrint1Id, CarId = car1Id, Sku = "Sku 1" }.InsertInto("BluePrints");
bluePrint2Id = 400;
new { Id = bluePrint2Id, CarId = car2Id, Sku = "Sku 2" }.InsertInto("BluePrints");
}
示例3: before_each
void before_each()
{
seed = new Seed();
books = new Books();
seed.PurgeDb();
seed.CreateTable("Books",
seed.Id(),
new { Title = "nvarchar(255)" }).ExecuteNonQuery();
seed.CreateTable("Chapters",
seed.Id(),
new { BookId = "int" },
new { Name = "nvarchar(255)" }).ExecuteNonQuery();
book1Id = new { Title = "book 1" }.InsertInto("Books");
new { BookId = book1Id, Name = "Chapter 1" }.InsertInto("Chapters");
new { BookId = book1Id, Name = "Chapter 2" }.InsertInto("Chapters");
book2Id = new { Title = "book 2" }.InsertInto("Books");
new { BookId = book2Id, Name = "Chapter 1" }.InsertInto("Chapters");
new { BookId = book2Id, Name = "Chapter 2" }.InsertInto("Chapters");
}
示例4: specify_db_can_be_specified
void specify_db_can_be_specified()
{
var connectionString = ConfigurationManager.ConnectionStrings["AnotherDb"].ConnectionString;
seed = new Seed(new ConnectionProfile
{
ConnectionString = connectionString
});
seed.PurgeDb();
seed.CreateTable("Authors",
seed.Id(),
new { Name = "nvarchar(255)" }
).ExecuteNonQuery(seed.ConnectionProfile);
seed.CreateTable("Emails",
seed.Id(),
new { AuthorId = "int" },
new { Address = "nvarchar(255)" }
).ExecuteNonQuery(seed.ConnectionProfile);
db = new DynamicDb(connectionString);
var authorId = db.Authors().Insert(new { Name = "hello" });
db.Emails().Insert(new { authorId, Address = "[email protected]" });
(db.Authors().All().First().Email().Address as string).should_be("[email protected]");
}
示例5: before_each
void before_each()
{
seed = new Seed();
seed.PurgeDb();
persons = new Persons();
}
示例6: before_each
void before_each()
{
seed = new Seed();
records = new MemoizedRecords();
seed.PurgeDb();
}
示例7: describe_db_rows_to_json
void describe_db_rows_to_json()
{
before = () =>
{
Seed seed = new Seed();
seed.PurgeDb();
seed.CreateTable("Rabbits", seed.Id(), new { Name = "nvarchar(255)" }).ExecuteNonQuery();
seed.CreateTable("Tasks",
seed.Id(),
new { Description = "nvarchar(255)" },
new { RabbitId = "int" },
new { DueDate = "datetime" }).ExecuteNonQuery();
var rabbitId = new { Name = "Yours Truly" }.InsertInto("Rabbits");
new { rabbitId, Description = "bolt onto vans", DueDate = new DateTime(2013, 1, 14) }.InsertInto("Tasks");
rabbitId = new { Name = "Hiro Protaganist" }.InsertInto("Rabbits");
new { rabbitId, Description = "save the world", DueDate = new DateTime(2013, 1, 14) }.InsertInto("Tasks");
new { rabbitId, Description = "deliver pizza", DueDate = new DateTime(2013, 1, 14) }.InsertInto("Tasks");
rabbitId = new { Name = "Lots" }.InsertInto("Rabbits");
for (int i = 0; i < 10; i++)
{
new
{
rabbitId,
Description = "Task: " + i.ToString(),
DueDate = new DateTime(2013, 1, 14)
}.InsertInto("Tasks");
}
};
it["disregards self referencing objects"] = () =>
{
var results = tasks.All().Include("Rabbits").ToList();
(results as IEnumerable<dynamic>).ForEach(s =>
{
s.Rabbit = s.Rabbit();
});
objectToConvert = new Gemini(new { Tasks = results });
string expected = @"{ ""tasks"": [ { ""id"": 1, ""description"": ""bolt onto vans"", ""rabbitId"": 1, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 1, ""name"": ""Yours Truly"" } }, { ""id"": 2, ""description"": ""save the world"", ""rabbitId"": 2, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 2, ""name"": ""Hiro Protaganist"" } }, { ""id"": 3, ""description"": ""deliver pizza"", ""rabbitId"": 2, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 2, ""name"": ""Hiro Protaganist"" } }, { ""id"": 4, ""description"": ""Task: 0"", ""rabbitId"": 3, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 3, ""name"": ""Lots"" } }, { ""id"": 5, ""description"": ""Task: 1"", ""rabbitId"": 3, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 3, ""name"": ""Lots"" } }, { ""id"": 6, ""description"": ""Task: 2"", ""rabbitId"": 3, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 3, ""name"": ""Lots"" } }, { ""id"": 7, ""description"": ""Task: 3"", ""rabbitId"": 3, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 3, ""name"": ""Lots"" } }, { ""id"": 8, ""description"": ""Task: 4"", ""rabbitId"": 3, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 3, ""name"": ""Lots"" } }, { ""id"": 9, ""description"": ""Task: 5"", ""rabbitId"": 3, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 3, ""name"": ""Lots"" } }, { ""id"": 10, ""description"": ""Task: 6"", ""rabbitId"": 3, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 3, ""name"": ""Lots"" } }, { ""id"": 11, ""description"": ""Task: 7"", ""rabbitId"": 3, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 3, ""name"": ""Lots"" } }, { ""id"": 12, ""description"": ""Task: 8"", ""rabbitId"": 3, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 3, ""name"": ""Lots"" } }, { ""id"": 13, ""description"": ""Task: 9"", ""rabbitId"": 3, ""dueDate"": ""1/14/13 12:00:00 AM"", ""rabbit"": { ""id"": 3, ""name"": ""Lots"" } } ] }";
jsonString = DynamicToJson.Convert(objectToConvert);
jsonString.should_be(expected);
};
}
示例8: before_each
void before_each()
{
db = new DynamicDb();
AssociationByConventions.ColumnCache = new Dictionary<string, List<string>>();
AssociationByConventions.TableCache = new Dictionary<string, bool>();
seed = new Seed();
seed.PurgeDb();
}
示例9: before_each
void before_each()
{
seed = new Seed();
seed.PurgeDb();
person = new Person();
persons = new Persons();
person.Email = "[email protected]";
person.EmailConfirmation = "[email protected]";
}
示例10: before_each
void before_each()
{
seed = new Seed();
records = new Records();
seed.PurgeDb();
@"if exists(select * from sysobjects where name = 'GetRecords' and xtype = 'p')
begin
drop procedure GetRecords
end".ExecuteNonQuery();
}
示例11: before_each
void before_each()
{
seed = new Seed();
db = new DynamicDb();
seed.PurgeDb();
SeedBlogSchema();
SeedSchoolSchema();
SeedPeepsSchema();
}
示例12: before_each
void before_each()
{
inventory = new Inventory();
seed = new Seed();
seed.PurgeDb();
seed.CreateTable("Inventory", new dynamic[]
{
new { Id = "int", Identity = true, PrimaryKey = true },
new { Sku = "nvarchar(255)" }
}).ExecuteNonQuery();
}
示例13: before_each
void before_each()
{
seed = new Seed();
seed.PurgeDb();
blogs = new Blogs();
blogs.Projection = d => new BlogWithAutoProps(d).InitializeExtensions();
comments = new Comments();
(comments as Comments).Projection = d => new CommentWithAutoProps(d).InitializeExtensions();
CreateBlogTable();
CreateCommentTable();
blogId = new { Title = "Some Blog", Body = "Lorem Ipsum" }.InsertInto("Blogs");
commentId = new { BlogId = blogId, Text = "Comment 1" }.InsertInto("Comments");
}
示例14: associations_can_be_added_directly_to_gemini
void associations_can_be_added_directly_to_gemini()
{
before = () =>
{
comments = new Comments();
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();
blogId = new { Title = "Some Blog", Body = "Lorem Ipsum" }.InsertInto("Blogs");
commentId = new { BlogId = blogId, Text = "Comment 1" }.InsertInto("Comments");
};
it["change tracking methods exist when changes is mixed in"] = () =>
{
act = () => comment = comments.Single(commentId);
it["returns blog associated with comment"] = () =>
{
(comment.Blog().Id as object).should_be(blogId as object);
};
};
}
示例15: before_each
void before_each()
{
seed = new Seed();
seed.PurgeDb();
agents = new Agents();
seed.CreateTable("Booths",
seed.Id(),
new { BoothId = "int" },
new { Name = "nvarchar(255)" }).ExecuteNonQuery();
seed.CreateTable("Agents",
new { Id = "int" },
new { BoothId = "int" },
new { Name = "nvarchar(255)" }).ExecuteNonQuery();
new { BoothId = 500, Name = "Booth 500" }.InsertInto("Booths");
new { BoothId = 500, Name = "Agent 1" }.InsertInto("Agents");
}