Description
After registering a new product type or other data-mapped entity in Unity, you get an exception similar to the following upon running your Active Commerce website.
[NullReferenceException: Object reference not set to an instance of an object.] ActiveCommerce.Data.GlassItemToEntityMapper.Map(Item source, IEntity target) +155
Cause
Glass Mapper cannot find the mapping configuration for your class. You likely have not configured your assembly with Active Commerce as a source of Glass Mapper entities.
Solution
Use a configuration patch to add your assembly to the /configuration/sitecore/activecommerce/glassConfiguration/assemblies list. For an example, see the Custom Product example in our code samples.
xActiveCommerce.xCustomProduct.config
If you think that you have properly configured your assembly, check /sitecore/admin/showconfig.aspx to ensure your patch is being processed, and your Sitecore logs to ensure there are no syntax errors in your configuration patch.
Comments