我正在使用 Sitecore 7.5、MVC 5.2 和 Glass Mapper 3.2。
在渲染中使用 Editable() 时,Visual Studio 中会显示以下错误,即使它在使用站点和/或页面编辑器时正确渲染。我是否缺少参考资料或其他内容?
错误:
“无法将 lambda 表达式转换为类型 'System.Linq.Expressions.Expression>',因为它不是委托类型”
看法
@using Sitecore.Mvc
@using Sitecore.Mvc.Presentation
@inherits Glass.Mapper.Sc.Web.Mvc.GlassView<Air.SitecoreModels.Metadata>
@*<h1>@Model.Item.Name </h1>*@
<h2>@Editable(x => x.BrowserTitle)</h2>
模型(使用 TDS 自动生成)
[SitecoreType(TemplateId=IMetadataConstants.TemplateIdString )] //, Cachable = true
public partial interface IMetadata : IGlassBase
{
/// <summary>
/// The BrowserTitle field.
/// <para></para>
/// <para>Field Type: Single-Line Text</para>
/// <para>Field ID: 82cb07ca-0f04-442e-9a42-641d71540b35</para>
/// <para>Custom Data: </para>
/// </summary>
[SitecoreField(IMetadataConstants.BrowserTitleFieldName)]
string BrowserTitle {get; set;}
/// <summary>
/// The PageTitle field.
/// <para></para>
/// <para>Field Type: Single-Line Text</para>
/// <para>Field ID: 462e2170-1157-4e9d-92dc-0d5da2956c44</para>
/// <para>Custom Data: </para>
/// </summary>
[SitecoreField(IMetadataConstants.PageTitleFieldName)]
string PageTitle {get; set;}
}
[SitecoreType(TemplateId=IMetadataConstants.TemplateIdString, AutoMap=true)] //, Cachable = true
public partial class Metadata : GlassBase, IMetadata
{
/// <summary>
/// The BrowserTitle field.
/// <para></para>
/// <para>Field Type: Single-Line Text</para>
/// <para>Field ID: 82cb07ca-0f04-442e-9a42-641d71540b35</para>
/// <para>Custom Data: </para>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Team Development for Sitecore - GlassItem.tt", "1.0")]
[SitecoreField(IMetadataConstants.BrowserTitleFieldName)]
public virtual string BrowserTitle {get; set;}
/// <summary>
/// The PageTitle field.
/// <para></para>
/// <para>Field Type: Single-Line Text</para>
/// <para>Field ID: 462e2170-1157-4e9d-92dc-0d5da2956c44</para>
/// <para>Custom Data: </para>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Team Development for Sitecore - GlassItem.tt", "1.0")]
[SitecoreField(IMetadataConstants.PageTitleFieldName)]
public virtual string PageTitle {get; set;}
}