<?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: Entity validation with visitors and extension methods</title>
	<atom:link href="http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/</link>
	<description>Strong opinions, weakly held</description>
	<lastBuildDate>Sun, 19 May 2013 03:22:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: DDD Validation &#124; C#Net</title>
		<link>http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/#comment-5863</link>
		<dc:creator>DDD Validation &#124; C#Net</dc:creator>
		<pubDate>Sun, 19 May 2013 03:22:18 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2007/10/24/entity-validation-with-visitors-and-extension-methods.aspx#comment-5863</guid>
		<description>[...] The validation is different. The same validation rules don&#8217;t apply in both the contexts. So a visitor pattern where we need to have two validators. These two validators can handle two different contexts. This [...]</description>
		<content:encoded><![CDATA[<p>[...] The validation is different. The same validation rules don&#8217;t apply in both the contexts. So a visitor pattern where we need to have two validators. These two validators can handle two different contexts. This [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nimam51</title>
		<link>http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/#comment-4659</link>
		<dc:creator>Nimam51</dc:creator>
		<pubDate>Sat, 30 Jun 2012 07:42:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2007/10/24/entity-validation-with-visitors-and-extension-methods.aspx#comment-4659</guid>
		<description>that was great and i used it in my apps. but what about duplication validation logic in my inheritance tree? Person &lt;-----Employee  which Employee has common properties in reside in Person so some Resistancy validation already defined in Persone validator.
my workaround is to use aggregation in validators (use persone validator in employee validator). any better idea?</description>
		<content:encoded><![CDATA[<p>that was great and i used it in my apps. but what about duplication validation logic in my inheritance tree? Person &lt;&#8212;&#8211;Employee  which Employee has common properties in reside in Person so some Resistancy validation already defined in Persone validator.<br />
my workaround is to use aggregation in validators (use persone validator in employee validator). any better idea?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Validating domain model using extension methods &#124; PHP Developer Resource</title>
		<link>http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/#comment-4610</link>
		<dc:creator>Validating domain model using extension methods &#124; PHP Developer Resource</dc:creator>
		<pubDate>Wed, 23 May 2012 11:05:01 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2007/10/24/entity-validation-with-visitors-and-extension-methods.aspx#comment-4610</guid>
		<description>[...] found the following example of using extension methods to validate my models, but was wondering if there were any specific [...]</description>
		<content:encoded><![CDATA[<p>[...] found the following example of using extension methods to validate my models, but was wondering if there were any specific [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: indiecodemonkey</title>
		<link>http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/#comment-4301</link>
		<dc:creator>indiecodemonkey</dc:creator>
		<pubDate>Tue, 07 Feb 2012 20:58:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2007/10/24/entity-validation-with-visitors-and-extension-methods.aspx#comment-4301</guid>
		<description>okay, what if I needed a database look-up before persisting the Order? In this case, neither of the two properties would really need it, but in some cases, Entities that requires a unique name (or something along those lines) would need check all existing names first, then persist. Would it be possible to inject Repositories or Services into the OrderPersistenceValidator?</description>
		<content:encoded><![CDATA[<p>okay, what if I needed a database look-up before persisting the Order? In this case, neither of the two properties would really need it, but in some cases, Entities that requires a unique name (or something along those lines) would need check all existing names first, then persist. Would it be possible to inject Repositories or Services into the OrderPersistenceValidator?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven</title>
		<link>http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/#comment-28</link>
		<dc:creator>Steven</dc:creator>
		<pubDate>Tue, 28 Sep 2010 07:51:08 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2007/10/24/entity-validation-with-visitors-and-extension-methods.aspx#comment-28</guid>
		<description>Very nice. I wrote a blog post over a year back that describes such a mechanism in the &#039;context&#039; of the validation application block. The trick I used was to use a [ThreadStatic] variable to sending a unit of work (such as LINQ to SQL&#039;s DataContext and Entity Framework&#039;s ObjectContext) to validators lower on the call stack. You can read more about it here: http://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=47.

Cheers</description>
		<content:encoded><![CDATA[<p>Very nice. I wrote a blog post over a year back that describes such a mechanism in the &#8216;context&#8217; of the validation application block. The trick I used was to use a [ThreadStatic] variable to sending a unit of work (such as LINQ to SQL&#8217;s DataContext and Entity Framework&#8217;s ObjectContext) to validators lower on the call stack. You can read more about it here: <a href="http://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=47" rel="nofollow">http://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=47</a>.</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/#comment-27</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Wed, 28 Apr 2010 18:02:54 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2007/10/24/entity-validation-with-visitors-and-extension-methods.aspx#comment-27</guid>
		<description>err...I guess that would need a negation for the name &quot;IsValid&quot;:

return !BrokenRules(entity).Any();</description>
		<content:encoded><![CDATA[<p>err&#8230;I guess that would need a negation for the name &#8220;IsValid&#8221;:</p>
<p>return !BrokenRules(entity).Any();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/#comment-26</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Wed, 28 Apr 2010 15:37:29 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2007/10/24/entity-validation-with-visitors-and-extension-methods.aspx#comment-26</guid>
		<description>To avoid iterating the entire set of broken rules when you don&#039;t need to you could shortcut IsValid to return false as soon as BrokenRules yields anything:

return BrokenRules(entity).Any();

On a side note, it seems harsh that you have to run the rules twice (less so with the shortcut above) in the implementing code in order to get both the rules collection and the IsValid status, which gets another rules collection.</description>
		<content:encoded><![CDATA[<p>To avoid iterating the entire set of broken rules when you don&#8217;t need to you could shortcut IsValid to return false as soon as BrokenRules yields anything:</p>
<p>return BrokenRules(entity).Any();</p>
<p>On a side note, it seems harsh that you have to run the rules twice (less so with the shortcut above) in the implementing code in order to get both the rules collection and the IsValid status, which gets another rules collection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eugene</title>
		<link>http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/#comment-25</link>
		<dc:creator>Eugene</dc:creator>
		<pubDate>Tue, 20 Oct 2009 06:14:28 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2007/10/24/entity-validation-with-visitors-and-extension-methods.aspx#comment-25</guid>
		<description>Validator class should be static if you want to use extension method</description>
		<content:encoded><![CDATA[<p>Validator class should be static if you want to use extension method</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/#comment-24</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Mon, 16 Feb 2009 13:09:55 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2007/10/24/entity-validation-with-visitors-and-extension-methods.aspx#comment-24</guid>
		<description>@Chev

Well, unfortunately the _real_ code is in a proprietary NDA app, and the sample code from above I lost about a year ago.  Sorry...</description>
		<content:encoded><![CDATA[<p>@Chev</p>
<p>Well, unfortunately the _real_ code is in a proprietary NDA app, and the sample code from above I lost about a year ago.  Sorry&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chev</title>
		<link>http://lostechies.com/jimmybogard/2007/10/24/entity-validation-with-visitors-and-extension-methods/#comment-23</link>
		<dc:creator>Chev</dc:creator>
		<pubDate>Mon, 16 Feb 2009 10:26:03 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2007/10/24/entity-validation-with-visitors-and-extension-methods.aspx#comment-23</guid>
		<description>really enjoyed the article.

Would it be possible to get a sample app?</description>
		<content:encoded><![CDATA[<p>really enjoyed the article.</p>
<p>Would it be possible to get a sample app?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
