使用Glass Mapper V3,是否可以检查Sitecore项目是否支持特定的Glass Mapper类/接口?
给定以下这些类:
我希望能做类似这样的事情。
给定以下这些类:
[SitecoreType]
public partial interface IPage : IGlassBase
{
// ... some properties here ...
}
[SitecoreType]
public partial interface IRateableItem : IGlassBase
{
// ... some properties here ...
}
我希望能做类似这样的事情。
var context = SitecoreContext();
var item = context.GetCurrentItem<IRateableItem>();
if (item != null)
// it's an item that is composed of the Rateable Item template
不幸的是,如果我这样做,无论当前项目是否由该模板组成,我都会得到一个IRateableItem类型的项目。