尚未加载类型

时间:2014-06-19 07:26:03

标签: asp.net-mvc-4 sitecore sitecore7 glass-mapper

关注question, 我在我的MVC项目中安装了Glass.mapper.sc.Mvc,并按照以下步骤进行操作

创建了一个名为“Home”的类

 [SitecoreType(AutoMap = true)]
    public class Home : IPageBase
    {
      public virtual string PageTitle
       {
        get;
        set;
       }
    }

创建了一个Homecontroller

public HomeController()
        {
            context = new SitecoreContext();
        }           

        public ActionResult Index()
        {
            ISitecoreContext context = new SitecoreContext();            
            var home = context.GetCurrentItem<Home>();            
            return View(home);                
        }

创建了一个视图

@using Sitecore.Mvc


@using Glass.Sitecore.Mapper;
@using Project.Libraries.Sitecore.Glass.Mapper.Model;
@model Home


@Model.PageTitle

然后将sitecore中的控制器渲染分配给占位符

但是当执行此代码时,它表示Home类尚未加载

Type Project.Libraries.Sitecore.Glass.Mapper.Model.Home has not been loaded

var home = context.GetCurrentItem(); //在控制器的这一行

我是否需要执行任何额外步骤才能使玻璃贴图工作

我只在我的项目中安装了Glass.Mapper.Src和Glass.Mapper.Src.Mvc,然后创建了上面的代码。

请建议。

1 个答案:

答案 0 :(得分:0)

您还需要安装此处找到的主要Glass.Mapper.Sc.CastleWindsor项目http://www.nuget.org/packages/Glass.Mapper.Sc.CastleWindsor

MVC DLL扩展了主项目,为MVC提供了特定于版本的支持