Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues using AutoMapper with DataRow Descendants #228

Closed
nwoolls opened this issue Jul 20, 2012 · 2 comments

Comments

Projects
None yet
1 participant
@nwoolls
Copy link

commented Jul 20, 2012

Hi there. I'm new to AutoMapper and so far it seems like a very promising library. I am trying to use it as a solution to copy the property values from one DataRow descendant to another (using strongly-typed datasets). The problem I am having is that, regardless of the ForMember/MapFrom combinations I use, the source DataRow values seem to be copied directly to the destination DataRow properties. If I use a simple object with all the same code, things work properly.

I've created a sample project that reproduces this:

https://github.com/nwoolls/automapper-w-datarow

The relevant code is in Form1.cs. The project uses the AdventureWorks DB. This is pretty simple to reproduce. As I indicated I'm new to AutoMapper so maybe I'm doing something wrong here.

Thanks in advance! I'd love to be able to use AutoMapper here as it seems like it could save a lot of code.

@nwoolls

This comment has been minimized.

Copy link
Author

commented Sep 7, 2012

I've updated my example on Github with the solution for this. It is not an issue with AutoMapper. AutoMapper was doing its job and copying the ItemArray property found in the ancestor DataRow. This was causing properties to come over exactly, appearing to disregard the .ForMember() and .MapFrom() options specified. Using opt.Ignore() for the ItemArray member fixes this.

@nwoolls nwoolls closed this Sep 7, 2012

@lock

This comment has been minimized.

Copy link

commented May 8, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 8, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.