自分のクラスでUmbracoから画像を取得しようとしています。自分のクラスでUmbracoHelperにアクセスできない理由
私のクラスで@umbracoヘルパーを使用できない理由を理解できません。私が書くとき、私は、UmbracoHelperを使用することができます
using Umbraco.Core.Models;
using Umbraco.Web;
:私は、その名前空間のような、クラスで定義されている。ここ
var umbracoHelper = new UmbracoHelper(Umbraco.Web.UmbracoContext.Current);
は私のクラスである:
using Umbraco.Core.Models;
using Umbraco.Web;
namespace House.Site.Helpers
{
public static class ImageClass
{
public static string GetAbsoluteImageUrl(this IPublishedContent node, string propertyName)
{
var umbracoHelper = new UmbracoHelper(Umbraco.Web.UmbracoContext.Current);
var imgID = node.GetPropertyValue<string>("propertyName");
var imgObject = umbracoHelper.TypedMedia(imgID);
return imgObject.Url;
}
}
}