0

Could anyone tell me why the models that I have in an external library (referenced in my main project) can't be loaded by Glass Mapper?

I get something like this:

Type Test.Project.Models.Item has not been loaded

The version of Glass Mapper is 2.0.11 and Sitecore has the version 7.2 (client's request).

Thank you

Marius Popa
  • 564
  • 1
  • 5
  • 22

1 Answers1

0

When you install Glass.Mapper using the Glass.Mapper.Sc.CastleWindsor it will automatically load classes configured with attributes from the current assembly, but if you want to load classes configured with attributes from another assembly. you have to add adding another SitecoreAttributeConfigurationLoader

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

        return new IConfigurationLoader[]{attributes, attributes2};
    }
Ahmad Harb
  • 605
  • 3
  • 17
  • and where should this method be called in? thanks. I am currently using the 2.0.11 version which is structured a bit differently. – Marius Popa Nov 16 '15 at 23:51