Missing type map configuration or unsupported mapping.
Mapping types:
ContentCategoryModel -> ContentCategory_A1833731E515D7707F9E111891AB7E0342B197B0C1EC80795229C8577CB3CFEE
Nop.Plugin.CMS.SimpleCMS.Models.Admin.ContentCategoryModel -> System.Data.Entity.DynamicProxies.ContentCategory_A1833731E515D7707F9E111891AB7E0342B197B0C1EC80795229C8577CB3CFEE
Destination path:
ContentCategory_A1833731E515D7707F9E111891AB7E0342B197B0C1EC80795229C8577CB3CFEE
Source value:
Nop.Plugin.CMS.SimpleCMS.Models.Admin.ContentCategoryModel
My model:
namespace Nop.Plugin.CMS.SimpleCMS.Models.Admin
{
[Validator(typeof(ContentCategoryValidator))]
public partial class ContentCategoryModel : BaseNopEntityModel, ILocalizedModel<ContentCategoryLocalizedModel>
{
public ContentCategoryModel()
{
if (PageSize < 1)
{
PageSize = 5;
}
Locales = new List<ContentCategoryLocalizedModel>();
}
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.Name")]
[AllowHtml]
public string Name { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.Description")]
[AllowHtml]
public string Description { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.MetaKeywords")]
[AllowHtml]
public string MetaKeywords { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.MetaDescription")]
[AllowHtml]
public string MetaDescription { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.MetaTitle")]
[AllowHtml]
public string MetaTitle { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.SeName")]
[AllowHtml]
public string SeName { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.Parent")]
public int ParentCategoryId { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.PageSize")]
public int PageSize { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.AllowCustomersToSelectPageSize")]
public bool AllowCustomersToSelectPageSize { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.PageSizeOptions")]
public string PageSizeOptions { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.ShowOnHomePage")]
public bool ShowOnHomePage { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.Published")]
public bool Published { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.Deleted")]
public bool Deleted { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.DisplayOrder")]
public int DisplayOrder { get; set; }
public IList<ContentCategoryLocalizedModel> Locales { get; set; }
public string Breadcrumb { get; set; }
public IList<DropDownItem> ParentCategories { get; set; }
}
public partial class ContentCategoryLocalizedModel : ILocalizedModelLocal
{
public int LanguageId { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.Name")]
[AllowHtml]
public string Name { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.Description")]
[AllowHtml]
public string Description {get;set;}
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.MetaKeywords")]
[AllowHtml]
public string MetaKeywords { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.MetaDescription")]
[AllowHtml]
public string MetaDescription { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.MetaTitle")]
[AllowHtml]
public string MetaTitle { get; set; }
[NopResourceDisplayName("Admin.Catalog.Categories.Fields.SeName")]
[AllowHtml]
public string SeName { get; set; }
}
}
Entity:
namespace Nop.Plugin.CMS.SimpleCMS.Domain
{
/// <summary>
/// Represents a category
/// </summary>
public partial class ContentCategory : BaseEntity, ILocalizedEntity, ISlugSupported
{
private ICollection<ContentItem> _contentItems;
/// <summary>
/// Gets or sets the name
/// </summary>
public virtual string Name { get; set; }
/// <summary>
/// Gets or sets the description
/// </summary>
public virtual string Description { get; set; }
/// <summary>
/// Gets or sets the meta keywords
/// </summary>
public virtual string MetaKeywords { get; set; }
/// <summary>
/// Gets or sets the meta description
/// </summary>
public virtual string MetaDescription { get; set; }
/// <summary>
/// Gets or sets the meta title
/// </summary>
public virtual string MetaTitle { get; set; }
/// <summary>
/// Gets or sets the search-engine name
/// </summary>
public virtual string SeName { get; set; }
/// <summary>
/// Gets or sets the parent category identifier
/// </summary>
public virtual int ParentCategoryId { get; set; }
/// <summary>
/// Gets or sets the page size
/// </summary>
public virtual int PageSize { get; set; }
/// <summary>
/// Gets or sets a value indicating whether customers can select the page size
/// </summary>
public virtual bool AllowCustomersToSelectPageSize { get; set; }
/// <summary>
/// Gets or sets the available customer selectable page size options
/// </summary>
public virtual string PageSizeOptions { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to show the category on home page
/// </summary>
public virtual bool ShowOnHomePage { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the entity is published
/// </summary>
public virtual bool Published { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the entity has been deleted
/// </summary>
public virtual bool Deleted { get; set; }
/// <summary>
/// Gets or sets the display order
/// </summary>
public virtual int DisplayOrder { get; set; }
/// <summary>
/// Gets or sets the date and time of instance creation
/// </summary>
public virtual DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the date and time of instance update
/// </summary>
public virtual DateTime UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the Content comments
/// </summary>
public virtual ICollection<ContentItem> ContentItems
{
get { return _contentItems ?? (_contentItems = new List<ContentItem>()); }
protected set { _contentItems = value; }
}
}
}
It's strange that I've inserted some ContentCategory's sucessfully.
Here is the mapping:
public class AutoMapperStartupTask : IStartupTask
{
public void Execute()
{
//content category
Mapper.CreateMap<ContentCategory, ContentCategoryModel>()
.ForMember(dest => dest.Locales, mo => mo.Ignore())
.ForMember(dest => dest.Breadcrumb, mo => mo.Ignore())
.ForMember(dest => dest.ParentCategories, mo => mo.Ignore())
.ForMember(dest => dest.SeName, mo => mo.MapFrom(src => src.GetSeName(0, true, false)))
.ForMember(dest => dest.CustomProperties, mo => mo.Ignore());
Mapper.CreateMap<ContentCategoryModel, ContentCategory>()
.ForMember(dest => dest.CreatedOnUtc, mo => mo.Ignore())
.ForMember(dest => dest.UpdatedOnUtc, mo => mo.Ignore())
.ForMember(dest => dest.Deleted, mo => mo.Ignore())
.ForMember(dest => dest.ContentItems, mo=>mo.Ignore());
//content
Mapper.CreateMap<ContentItem, ContentItemModel>()
.ForMember(dest => dest.Comments, mo => mo.Ignore())
.ForMember(dest => dest.StartDate, mo => mo.Ignore())
.ForMember(dest => dest.EndDate, mo => mo.Ignore())
.ForMember(dest => dest.CreatedOn, mo => mo.Ignore())
.ForMember(dest => dest.CustomProperties, mo => mo.Ignore());
Mapper.CreateMap<ContentItemModel, ContentItem>()
.ForMember(dest => dest.ContentComments, mo => mo.Ignore())
.ForMember(dest => dest.ApprovedCommentCount, mo => mo.Ignore())
.ForMember(dest => dest.NotApprovedCommentCount, mo => mo.Ignore())
.ForMember(dest => dest.StartDateUtc, mo => mo.Ignore())
.ForMember(dest => dest.EndDateUtc, mo => mo.Ignore())
.ForMember(dest => dest.CreatedOnUtc, mo => mo.Ignore())
.ForMember(dest => dest.ContentCategory, mo=>mo.Ignore());
}
public int Order
{
get { return 1; }
}
}