Urgent - Issue with Admin Mapping

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Hi everyone.

We have made some rather large changes to the underlying code of NopCommerce 2.65 (to allow for multiple delivery addresses).

Everything works on the front end of the site and can save orders back to the database, bring products out and the site functions as it should do.

However we appear to have broken the mapping in the admin panel somehow :( Whenever we try and edit a  product or category it works fine when pulling the data out but when trying to save back to the database we get the following error:

Missing type map configuration or unsupported mapping.

Mapping types:
ProductModel -> Product_DC6A9D9185860C61DA71404078A3812A93D0CF9595388B9345170D9DF95604E4
Nop.Admin.Models.Catalog.ProductModel -> System.Data.Entity.DynamicProxies.Product_DC6A9D9185860C61DA71404078A3812A93D0CF9595388B9345170D9DF95604E4

Destination path:
Product_DC6A9D9185860C61DA71404078A3812A93D0CF9595388B9345170D9DF95604E4

Source value:
Nop.Admin.Models.Catalog.ProductModel
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.

Mapping types:
ProductModel -> Product_DC6A9D9185860C61DA71404078A3812A93D0CF9595388B9345170D9DF95604E4
Nop.Admin.Models.Catalog.ProductModel -> System.Data.Entity.DynamicProxies.Product_DC6A9D9185860C61DA71404078A3812A93D0CF9595388B9345170D9DF95604E4

Destination path:
Product_DC6A9D9185860C61DA71404078A3812A93D0CF9595388B9345170D9DF95604E4

Source value:
Nop.Admin.Models.Catalog.ProductModel

Source Error:


Line 102:        public static Product ToEntity(this ProductModel model, Product destination)
Line 103:        {
Line 104:            return Mapper.Map(model, destination);
Line 105:        }
Line 106:


Source File: c:\Projects\GreenAndBlacksClive\G and B\nopCommerce\Presentation\Nop.Web\Administration\MappingExtensions.cs    Line: 104


Does anyone have any ideas as to what might be broke here?!

Any quick help will be much appreciated :(

Thanks,

Matt
11 years ago
Hi Matt,

It seems like AutoMapper is not able to map between your Model and your Entity. Unfortunately, it's hard to pin-point the exact mistake without a look at the source code and a brief understanding of what you've changed.
11 years ago
Hi Lam,

Thanks for your reply.

On further investigation it appears I can add new items through the admin panel and delete existing items through the admin panel I just cannot edit anything.

I'm happy to provide my full source code if anyone is willing to take a look.

It appears that the automapperstartup task is getting hit but clearly my mappings aren't getting created properly.

We haven't changed anything the admin project so i think the problem is likely to be somewhere in the core, data or services I guess?

Thanks,

Matt
11 years ago
Hi Matt, you can PM me your plugin source code. I'll try to help. :D
11 years ago
Hi Lam,

Thanks for the offer, very much appreciated.

I have PM'd you the source code.

Thanks,

Matt
11 years ago
Resolved.

For others who also experience this issue, DO NOT update AutoMapper library to the latest version. Use the one which is provided with nopCommerce
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.