如何检查CatalogDefinition是否已经有属性? [英] Howto check whether a CatalogDefinition already has a property?

查看:105
本文介绍了如何检查CatalogDefinition是否已经有属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的例程让我烦恼但是异常"属性已经存在....",检查CatalogDefinition是否具有特定属性的正确方法是什么?

CatalogDefinition cat, CatalogProperty prop

if(!cat.HasProperty(prop.Name)){
cat.AddProperty(prop.Name,DefinitionPropertyType.NormalProperty);
cat.Save();
}

The following routine keep bugging me with exception "The property already exists....", what is the proper way to check if the CatalogDefinition has a particular property?

CatalogDefinition cat, CatalogProperty prop
 
if (!cat.HasProperty(prop.Name)){
     cat.AddProperty(prop.Name, DefinitionPropertyType.NormalProperty);
     cat.Save();
}

推荐答案

构建一个搜索子句并调用GetProperties - 它将返回CS中的所有属性并检查您的属性是否存在。请查看以下网址了解更多详情。
http://msdn.microsoft.com/en-us/library/microsoft.commerceserver.catalog.catalogpropertiesdataset.catalogproperty.aspx

希望这会有所帮助。

问候,
-Ravi Kanth Koppala
Build a search clause and call GetProperties - which will return all properties in CS and check whether your property exists. Check below url for more details. http://msdn.microsoft.com/en-us/library/microsoft.commerceserver.catalog.catalogpropertiesdataset.catalogproperty.aspx Hope this helps. Regards, -Ravi Kanth Koppala


这篇关于如何检查CatalogDefinition是否已经有属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆