【发布时间】:2013-10-22 21:12:31
【问题描述】:
使用 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 的项目返回,而不管当前项目是否由该模板组成。
【问题讨论】:
-
我会写一个例子,明天贴出来。
标签: c# asp.net sitecore sitecore6 glass-mapper