【问题标题】:Models not loaded by Glass MapperGlass Mapper 未加载的模型
【发布时间】:2015-11-16 16:07:49
【问题描述】:

谁能告诉我为什么 Glass Mapper 无法加载我在外部库中的模型(在我的主项目中引用)?

我得到这样的东西:

类型 Test.Project.Models.Item 尚未 已加载

Glass Mapper 的版本是 2.0.11,Sitecore 的版本是 7.2(客户要求)。

谢谢

【问题讨论】:

标签: asp.net-mvc error-handling model sitecore glass-mapper


【解决方案1】:

当您使用 Glass.Mapper.Sc.CastleWindsor 安装 Glass.Mapper 时,它会自动加载配置了当前程序集属性的类,但如果您想加载配置了来自另一个程序集的属性的类。您必须添加另一个 SitecoreAttributeConfigurationLoader

public static IConfigurationLoader[] GlassLoaders(){
        var attributes = new SitecoreAttributeConfigurationLoader("Project.Website");
        var attributes2 = new SitecoreAttributeConfigurationLoader("Project.Models");

        return new IConfigurationLoader[]{attributes, attributes2};
    }

【讨论】:

  • 应该在哪里调用这个方法?谢谢。我目前使用的是 2.0.11 版本,它的结构有点不同。
猜你喜欢
  • 1970-01-01
  • 2015-05-26
  • 1970-01-01
  • 2023-03-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多