本文整理汇总了C#中Workspace.New方法的典型用法代码示例。如果您正苦于以下问题:C# Workspace.New方法的具体用法?C# Workspace.New怎么用?C# Workspace.New使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workspace
的用法示例。
在下文中一共展示了Workspace.New方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitilazieContextWithData
private void InitilazieContextWithData(Workspace<SystemData> iogWorkspace)
{
iogWorkspace.Data.Products = iogWorkspace.New<IIndexedCollection<Product>>();
iogWorkspace.Data.Orders = iogWorkspace.New<IIndexedCollection<Order>>();
iogWorkspace.Data.Categories = iogWorkspace.New<IIndexedCollection<Category>>();
#region Categories initial dummy data
Category cat1 = iogWorkspace.New<Category>();
cat1.ID = Guid.NewGuid();
cat1.Name = "Keyboard";
iogWorkspace.Data.Categories.Add(cat1);
Category cat2 = iogWorkspace.New<Category>();
cat2.ID = Guid.NewGuid();
cat2.Name = "Mouse";
iogWorkspace.Data.Categories.Add(cat2);
Category cat3 = iogWorkspace.New<Category>();
cat3.ID = Guid.NewGuid();
cat3.Name = "HDD";
iogWorkspace.Data.Categories.Add(cat3);
Category cat4 = iogWorkspace.New<Category>();
cat4.ID = Guid.NewGuid();
cat4.Name = "Motherboard";
iogWorkspace.Data.Categories.Add(cat4);
Category cat5 = iogWorkspace.New<Category>();
cat5.ID = Guid.NewGuid();
cat5.Name = "Graphic card";
iogWorkspace.Data.Categories.Add(cat5);
#endregion
#region Products initial dummy data
Product p1 = iogWorkspace.New<Product>();
p1.ID = Guid.NewGuid();
p1.Name = "PS/2 US Genius Slimstar 110";
p1.Photo = "Images/Products/Slimstar_110.jpg";
p1.Price = 6;
p1.Category = cat1;
iogWorkspace.Data.Products.Add(p1);
Product p2 = iogWorkspace.New<Product>();
p2.ID = Guid.NewGuid();
p2.Name = "PS/2 Genius NetScroll 120";
p2.Photo = "Images/Products/Genius_NetScroll_120.jpg";
p2.Price = 4.5;
p2.Category = cat2;
iogWorkspace.Data.Products.Add(p2);
Product p3 = iogWorkspace.New<Product>();
p3.ID = Guid.NewGuid();
p3.Name = "Seagate Barracuda Green ST100";
p3.Photo = "Images/Products/Seagate_Barracuda_Green.jpg";
p3.Price = 100;
p3.Category = cat3;
iogWorkspace.Data.Products.Add(p3);
Product p4 = iogWorkspace.New<Product>();
p4.ID = Guid.NewGuid();
p4.Name = "MSI 970A-G46";
p4.Photo = "Images/Products/MSI_970A-G46.jpg";
p4.Price = 82;
p4.Category = cat4;
iogWorkspace.Data.Products.Add(p4);
Product p5 = iogWorkspace.New<Product>();
p5.ID = Guid.NewGuid();
p5.Name = "GeForce GTX550-Ti EVGA";
p5.Photo = "Images/Products/GeForce_GTX550-Ti.jpg";
p5.Price = 122;
p5.Category = cat5;
iogWorkspace.Data.Products.Add(p5);
#endregion
}