0

We have recently upgraded our project to run on Sitecore 8.2, Rev3, as part of the upgrade we had to update Glass Mapper which is now running on version 4.3.4.197.

However, we are now getting an error when trying to create an item:

            var service = new SitecoreService(_database);
            service.Create(parent, redHotDeal);

The exception we are getting is: Failed to find configuration for parent item type Sitecore.Data.Items.Item

StackTrace:

at Glass.Mapper.Sc.SitecoreService.Create[T,TK](TK parent, T newItem, Boolean updateStatistics, Boolean silent) in c:\TeamCity\buildAgent\work\8567e2ba106d3992\Source\Glass.Mapper.Sc\SitecoreService.cs:line 200 at TTC.IV.Infrastructure.Import.RedHotDeals.RedHotDealsImporter.ImportRedHotDeals(IEnumerable`1 redhotdeals, Item parent) in G:\TFSProjects\IV\Source\TTC.IV.Infrastructure\Import\RedHotDeals\RedHotDealsImporter.cs:line 104

Has anyone experienced this issue or knows what might be causing it?

A bit more info on the setup: parent item is of type Sitecore.Data.Items.Item redHotDeal item is of type DealCollectionItem

DealCollectionItem model looks like this:

using System; using Glass.Mapper.Sc.Configuration.Attributes;

namespace TTC.IV.Model.Templates.Items
{
    [SitecoreType(TemplateId = TemplateStringId)]
    public class DealCollectionItem : Item
    {
        public new static Guid TemplateId = new Guid(TemplateStringId);
        private const string TemplateStringId = "{998CA212-92D5-4566-B877-44D1F378EFD6}";

    /// <summary>
    /// Gets or sets the mv code.
    /// </summary>
    /// <value>
    /// The mv code.
    /// </value>
    [SitecoreField]
    public virtual string MvCode { get; set; }

    /// <summary>
    /// Gets or sets the departure code.
    /// </summary>
    /// <value>
    /// The departure code.
    /// </value>
    [SitecoreField]
    public virtual string DepartureCode { get; set; }

    /// <summary>
    /// Gets or sets the discount.
    /// </summary>
    /// <value>
    /// The discount.
    /// </value>
    [SitecoreField]
    public virtual double Discount { get; set; }

    /// <summary>
    /// Gets or sets the promo code.
    /// </summary>
    /// <value>
    /// The promo code.
    /// </value>
    [SitecoreField]
    public virtual string PromoCode { get; set; }

    /// <summary>
    /// Gets or sets the price.
    /// </summary>
    /// <value>
    /// The price.
    /// </value>
    [SitecoreField]
    public virtual double Price { get; set; }

    /// <summary>
    /// Gets or sets the promo amount.
    /// </summary>
    /// <value>
    /// The promo amount.
    /// </value>
    [SitecoreField]
    public virtual double PromoAmount { get; set; }

    /// <summary>
    /// Gets or sets the table amount.
    /// </summary>
    /// <value>
    /// The table amount.
    /// </value>
    [SitecoreField]
    public virtual int TableAmount { get; set; }

    /// <summary>
    /// Gets or sets the import region.
    /// </summary>
    /// <value>
    /// The import region.
    /// </value>
    public string ImportRegion { get; set; }
}

}

Marek Musielak
  • 26,832
  • 8
  • 72
  • 80
Igor
  • 115
  • 1
  • 2
  • 10

1 Answers1

0

This is now resolved. I followed the advise as per https://github.com/mikeedwards83/Glass.Mapper/issues/305 and mapped an Item as a property by calling it 'Item' and letting it automap.

Igor
  • 115
  • 1
  • 2
  • 10