本文整理汇总了C#中IProductRepository.SaveUOM方法的典型用法代码示例。如果您正苦于以下问题:C# IProductRepository.SaveUOM方法的具体用法?C# IProductRepository.SaveUOM怎么用?C# IProductRepository.SaveUOM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProductRepository
的用法示例。
在下文中一共展示了IProductRepository.SaveUOM方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SampleMethod
private static void SampleMethod(IProductRepository productRepo)
{
SessionProvider.RebuildSchema();
//Add a Unit of Measure
var uomCrate = new UnitOfMeasure { UomDescription = "Crate" };
productRepo.SaveUOM(uomCrate);
//Add some categories
var catA = new Category { CategoryName = "Metals" };
var catB = new Category { CategoryName = "Plastics" };
var catC = new Category { CategoryName = "Recycled Goods" };
var catD = new Category { CategoryName = "New Materials" };
productRepo.SaveCategory(catA);
productRepo.SaveCategory(catB);
productRepo.SaveCategory(catC);
productRepo.SaveCategory(catD);
//Add some products
var prod01 = new Product { ProductName = "Copper Wire", UOM = uomCrate };
var prod02 = new Product { ProductName = "Refurbished Sprockets", UOM = uomCrate };
var prod03 = new Product { ProductName = "Plastic Housings", UOM = uomCrate };
var prod04 = new Product { ProductName = "Used Bubble Wrap", UOM = uomCrate };
//Assign some Categories
prod01.Categories.Add(catA);
prod01.Categories.Add(catD);
prod02.Categories.Add(catA);
prod02.Categories.Add(catC);
prod03.Categories.Add(catB);
prod03.Categories.Add(catD);
prod04.Categories.Add(catB);
prod04.Categories.Add(catC);
//Persist our objects
productRepo.Save(prod01);
productRepo.Save(prod02);
productRepo.Save(prod03);
productRepo.Save(prod04);
var prodTemp = productRepo.GetById(prod01.ProductId);
prodTemp.Categories.RemoveAt(0);
System.Console.WriteLine("Press any key to continue...");
System.Console.Read();
}