当前位置: 首页>>代码示例>>C#>>正文


C# Workspace.New方法代码示例

本文整理汇总了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
        }
开发者ID:nemanjazz,项目名称:iog,代码行数:89,代码来源:StorageServices.cs


注:本文中的Workspace.New方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。