本文整理汇总了C#中umbraco.MacroEngines.DynamicNode.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# DynamicNode.GetProperty方法的具体用法?C# DynamicNode.GetProperty怎么用?C# DynamicNode.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类umbraco.MacroEngines.DynamicNode
的用法示例。
在下文中一共展示了DynamicNode.GetProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPropertyValueInternal
protected virtual string GetPropertyValueInternal( DynamicNode model, string propertyAlias, bool recursive )
{
string strValue = "";
if ( model != null && !string.IsNullOrEmpty( propertyAlias ) ) {
IProperty property = null;
if ( !recursive ) {
property = model.GetProperty( propertyAlias );
} else {
DynamicNode tempModel = model;
IProperty tempProperty = tempModel.GetProperty( propertyAlias );
if ( tempProperty != null && !string.IsNullOrEmpty( tempProperty.Value ) ) {
property = tempProperty;
}
while ( property == null && tempModel != null && tempModel.Id > 0 ) {
tempModel = tempModel.Parent;
if ( tempModel != null ) {
tempProperty = tempModel.GetProperty( propertyAlias );
if ( tempProperty != null && !string.IsNullOrEmpty( tempProperty.Value ) ) {
property = tempProperty;
}
}
}
}
if ( property != null ) {
strValue = property.Value;
}
}
return strValue;
}
开发者ID:uniquelau,项目名称:Tea-Commerce-for-Umbraco,代码行数:34,代码来源:DynamicNodeProductInformationExtractor.cs
示例2: SiteMapTemplate
/// <summary>
/// The site map.
/// </summary>
/// <param name="renderModel">
/// The render model.
/// </param>
/// <returns>
/// The <see cref="ActionResult"/>.
/// </returns>
public ActionResult SiteMapTemplate(RenderModel renderModel)
{
List<SiteMapViewModel> sitemapElements = new List<SiteMapViewModel>();
DynamicNode homepage = new DynamicNode(1089);
if (homepage.GetProperty("showInSiteMap") != null && homepage.GetProperty("showInSiteMap").Value == "1")
{
sitemapElements.Add(new SiteMapViewModel { Url = homepage.Url, LastModified = homepage.UpdateDate });
}
DynamicNodeList sitemapPages =
homepage.Descendants(
n => n.GetProperty("showInSiteMap") != null && n.GetProperty("showInSiteMap").HasValue() && n.GetProperty("showInSiteMap").Value == "1");
foreach (DynamicNode page in sitemapPages)
{
sitemapElements.Add(new SiteMapViewModel { Url = page.Url, LastModified = page.UpdateDate });
}
return this.View("SiteMapTemplate", sitemapElements);
}
示例3: ImageUrls
public static IEnumerable<string> ImageUrls(this RazorLibraryCore ctx, DynamicNode node, string alias, string cropProperty, string cropName)
{
var mediaProp = node.GetProperty(alias);
if (mediaProp != null && !string.IsNullOrWhiteSpace(mediaProp.Value))
{
if (mediaProp.Value.Contains('<'))
{
foreach (var m in new DynamicXml(mediaProp.Value).OfType<DynamicXml>())
{
var url = ImageUrlFromXml(ctx, m, cropProperty, cropName);
if (!url.IsNullOrWhiteSpace())
yield return url;
}
}
else
{
//we look like a list ofr ids
foreach (var val in mediaProp.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
int mediaId = 0;
if (int.TryParse(val, out mediaId))
{
var url = ImageUrlFromMediaItem(ctx, mediaId, cropProperty, cropName);
if (!url.IsNullOrWhiteSpace())
yield return url;
}
}
//we look like xml
}
}
}