<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Teaching AutoMapper about our conventions</title>
	<atom:link href="http://lostechies.com/joshuaflanagan/2010/03/19/teaching-automapper-about-our-conventions/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/joshuaflanagan/2010/03/19/teaching-automapper-about-our-conventions/</link>
	<description></description>
	<lastBuildDate>Thu, 14 Mar 2013 03:50:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: Joshua Flanagan</title>
		<link>http://lostechies.com/joshuaflanagan/2010/03/19/teaching-automapper-about-our-conventions/#comment-98</link>
		<dc:creator>Joshua Flanagan</dc:creator>
		<pubDate>Mon, 22 Mar 2010 04:30:10 +0000</pubDate>
		<guid isPermaLink="false">/blogs/joshuaflanagan/archive/2010/03/19/teaching-automapper-about-our-conventions.aspx#comment-98</guid>
		<description>I didn&#039;t read it as critical at all, its all valid feedback, and I pretty much agree with everything you said.
The truth is, I started to go down the path of a method-chained DSL, but it makes the implementation a lot more complicated. It wasn&#039;t worth the effort to solve my problem, since I saw it as a one-off solution. I know Jimmy is re-thinking some of the underlying infrastructure to enable a better solution for the next major version of AutoMapper. My solution is just some spackle to hold us over (which is also why I didn&#039;t propose it as a patch to AM). I posted it, not because the code is impressive, but to share the idea.</description>
		<content:encoded><![CDATA[<p>I didn&#8217;t read it as critical at all, its all valid feedback, and I pretty much agree with everything you said.<br />
The truth is, I started to go down the path of a method-chained DSL, but it makes the implementation a lot more complicated. It wasn&#8217;t worth the effort to solve my problem, since I saw it as a one-off solution. I know Jimmy is re-thinking some of the underlying infrastructure to enable a better solution for the next major version of AutoMapper. My solution is just some spackle to hold us over (which is also why I didn&#8217;t propose it as a patch to AM). I posted it, not because the code is impressive, but to share the idea.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CraigCav</title>
		<link>http://lostechies.com/joshuaflanagan/2010/03/19/teaching-automapper-about-our-conventions/#comment-97</link>
		<dc:creator>CraigCav</dc:creator>
		<pubDate>Sun, 21 Mar 2010 22:02:09 +0000</pubDate>
		<guid isPermaLink="false">/blogs/joshuaflanagan/archive/2010/03/19/teaching-automapper-about-our-conventions.aspx#comment-97</guid>
		<description>Hi Joshua,

I&#039;ve struggled with similar repetitive mappings myself and hadn&#039;t achieved a way to make my conventions explicit, so I found this a really interesting read. 

I&#039;m really hoping that AutoMapper will soon be extended to natively support conventions to build mappings for type information, as although this work-around is much better than where we started, it still feels a little clunky.

I guess I&#039;d like to be able to see full, easily testable, convention classes for MapViewUrls and MapDisplayValues, rather than extension methods off of IMappingExpression.

Another thing I&#039;m thinking was that it took me longer than it should for me to figure out what was going on in the CreateMapsForSourceTypes method. Now, that might just be me being a little slow...but I couldn&#039;t figure out what the parameters were doing at a glance. I&#039;m wondering if this method should be broken up into smaller chunks? Maybe something like:

cfg.ForSourceTypes(x =&gt; x.CanBeCastTo&lt;Entity&gt;())
        .MapToDestinationType(sourceType =&gt; Type.GetType(typeof (ListItemMethodDTO).Namespace + &quot;.&quot; + sourceType.Name + &quot;DTO&quot;))
        .CreateMaps(map, source, destination =&gt;  
        {  
            map.MapViewUrls(source, destination);  
            map.MapDisplayValues(source, destination);  
        }); 

What do you think?

The only other part that wasn&#039;t particularly clear (without looking at the implementation) was where exactly the source types were coming from.

Hmm...Reading my comment back I sound really critical, but actually I&#039;m just excited to see where this is going. Keep up the good work.</description>
		<content:encoded><![CDATA[<p>Hi Joshua,</p>
<p>I&#8217;ve struggled with similar repetitive mappings myself and hadn&#8217;t achieved a way to make my conventions explicit, so I found this a really interesting read. </p>
<p>I&#8217;m really hoping that AutoMapper will soon be extended to natively support conventions to build mappings for type information, as although this work-around is much better than where we started, it still feels a little clunky.</p>
<p>I guess I&#8217;d like to be able to see full, easily testable, convention classes for MapViewUrls and MapDisplayValues, rather than extension methods off of IMappingExpression.</p>
<p>Another thing I&#8217;m thinking was that it took me longer than it should for me to figure out what was going on in the CreateMapsForSourceTypes method. Now, that might just be me being a little slow&#8230;but I couldn&#8217;t figure out what the parameters were doing at a glance. I&#8217;m wondering if this method should be broken up into smaller chunks? Maybe something like:</p>
<p>cfg.ForSourceTypes(x => x.CanBeCastTo<entity>())<br />
        .MapToDestinationType(sourceType => Type.GetType(typeof (ListItemMethodDTO).Namespace + &#8220;.&#8221; + sourceType.Name + &#8220;DTO&#8221;))<br />
        .CreateMaps(map, source, destination =><br />
        {<br />
            map.MapViewUrls(source, destination);<br />
            map.MapDisplayValues(source, destination);<br />
        }); </p>
<p>What do you think?</p>
<p>The only other part that wasn&#8217;t particularly clear (without looking at the implementation) was where exactly the source types were coming from.</p>
<p>Hmm&#8230;Reading my comment back I sound really critical, but actually I&#8217;m just excited to see where this is going. Keep up the good work.</entity></p>
]]></content:encoded>
	</item>
</channel>
</rss>
