Sitecore 8 Editable Fields Using Glass Mapper

For some reason, Visual Studio gives me this error in the view:

Cannot convert lambda expression to type 'System.Linq.Expressions.Expression>' because it is not a delegate Type

Also, I don't have intellisense on lambda.

I made sure to bring my MVC version down to 5.1.0 based on this post:

Sitecore editable glass cannot convert lambda expression

Unfortunately, I did not have the points necessary for commenting directly on this post. Unfortunately, the MVC solution for the version does not work for me. When I publish for deployment, the data comes in just fine - editing works just fine - but I would rather not just ignore the red squiggly lines and the lack of intellisense.

From the new Sitecore 8 / Visual Studio MVC application setup I Ran:

Update package Glass.Mapper.Sc.CastleWindsor to give me v3.3.1.26

Then I launched Install-Package Glass.Mapper.Sc.Mvc-5 to give me v3.3.1.48

I installed the model

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Glass.Mapper.Sc;
using Glass.Mapper.Sc.Configuration.Attributes;

namespace myns.app.Models
{
    [SitecoreType]
    public class BaseContent
    {
        [SitecoreId]
        public virtual Guid Id { get; set; }

        [SitecoreField("Content Title")]
        public virtual string Title { get; set; }

        [SitecoreField("Summary Content")]
        public virtual string Summary { get; set; }

        [SitecoreField("Full Content")]
        public virtual string Content { get; set; }

        [SitecoreField("Content Image")]
        public virtual Glass.Mapper.Sc.Fields.Image ImagePath { get; set; }

    }
}

And have a working view

@inherits Glass.Mapper.Sc.Web.Mvc.GlassView<myns.app.Models.BaseContent>

<div>
    <h4>BaseContent</h4>
    <hr />
    @Model.Title
    <p>@Editable(Model, x => x.Title)</p>
    <p>@Editable(Model, x => x.Summary)</p>
    <h5>content</h5>
    <p>@Editable(Model, x => x.Content)</p>
    <p>@RenderImage(Model, x => x.ImagePath)</p> 
</div>

Thank you in advance for your entry!

UPDATE : When I comment on the next three lines in compilation assemblies > in the web.config Sitecore file, the problem seems to disappear. Not sure if this is the best you can do:

<compilation defaultLanguage="c#" debug="false" targetFramework="4.5">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Web.Helpers, Version=3.0.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=5.2.2.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" />
        <!--add assembly="System.Web.Http, Version=5.1.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" /-->
        <!--add assembly="System.Web.Http.WebHost, Version=5.1.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" /-->
        <!--add assembly="System.Net.Http.Formatting, Version=5.1.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" /-->
      </assemblies>
    </compilation>
+4
source share
2 answers

Commenting on the following three lines in the node assemblies inside the site, web.config fixed the problem.

<!--add assembly="System.Web.Http, Version=5.1.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" /-->
<!--add assembly="System.Web.Http.WebHost, Version=5.1.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" /-->
<!--add assembly="System.Net.Http.Formatting, Version=5.1.0.0, Culture=neutral,PublicKeyToken=31BF3856AD364E35" /-->
+3
source

, . Glass . , web.config /views/web.config:

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>
0

All Articles