本文整理汇总了C#中Product.AddMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# Product.AddMetadata方法的具体用法?C# Product.AddMetadata怎么用?C# Product.AddMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product.AddMetadata方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateProduct
protected new void CreateProduct()
{
var product = new Product("PRT") {Name = "Product", Description = "설명입니다."};
product.AddMetadata("a", new MetadataValue("A"));
product.AddMetadata("b", new MetadataValue("B"));
product.AddLocale(new CultureInfo("en"), new ProductLocale {Name = "Product"});
product.AddLocale(new CultureInfo("ko"), new ProductLocale {Name = "제품"});
Repository<Product>.SaveOrUpdate(product);
}
示例2: ProductTestByUnitOfWork
public void ProductTestByUnitOfWork()
{
var product = new Product("PRT_1") {Name = "Product", Description = "설명입니다."};
product.AddMetadata("a", new MetadataValue("A"));
product.AddMetadata("b", new MetadataValue("B"));
product.AddLocale(new CultureInfo("en"), new ProductLocale {Name = "Product1"});
product.AddLocale(new CultureInfo("ko"), new ProductLocale {Name = "제품1"});
Repository<Product>.SaveOrUpdate(product);
UnitOfWork.Current.TransactionalFlush();
UnitOfWork.Current.Clear();
var loaded = Repository<Product>.Get(product.Id);
Assert.AreEqual(product, loaded);
loaded.LocaleMap.Count.Should().Be(2);
}
示例3: ProductTestByHybrid
public void ProductTestByHybrid()
{
var product = new Product("PRT_2") {Name = "Product2", Description = "설명입니다"};
product.AddMetadata("a", new MetadataValue("A"));
product.AddMetadata("b", new MetadataValue("B"));
product.AddLocale(new CultureInfo("en"), new ProductLocale {Name = "Product2"});
product.AddLocale(new CultureInfo("ko"), new ProductLocale {Name = "제품2"});
new PersistenceSpecification<Product>(UnitOfWork.CurrentSession)
.VerifyTheMappings(product);
}