<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"><channel><title>Model Validation in ASP.NET Web API</title><link>http://www.asp.net</link><pubDate>Fri, 11 Jan 2013 09:59:49 GMT</pubDate><generator>umbraco</generator><description>Comments for Model Validation in ASP.NET Web API</description><language>en</language><atom:link href="http://www.asp.net/rss/comments/42703" rel="self" type="application/rss+xml" /><item><title>Comment Posted by discofunk</title><link>http://www.asp.net/web-api/overview/formats-and-model-binding/model-validation-in-aspnet-web-api</link><pubDate>Tue, 14 Aug 2012 13:03:38 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016170</guid><description><![CDATA[ <p>As a transitional phase we are doing something that is a little odd - using a Binary serialization formatter until we can get our objects JSON serialization friendly.  Due to this, we sometimes end up with large object graphs.  Because the DefaultBodyModelValidator is always called (yikes) we noticed severe performance degradation.  Replacing the DefaultBodyModelValidator with an implementation that just returns true on  Validate resolved this.</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/discofunk.jpg?forceidenticon=false&amp;dt=635044705800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by rkanjama</title><link>http://www.asp.net/web-api/overview/formats-and-model-binding/model-validation-in-aspnet-web-api</link><pubDate>Fri, 17 Aug 2012 18:52:30 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016203</guid><description><![CDATA[ <p>In the latest bits HttpActionContext.Request does not have CreateResponse method.  Am I missing something?</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/rkanjama.jpg?forceidenticon=false&amp;dt=635044705800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by jeffr59</title><link>http://www.asp.net/web-api/overview/formats-and-model-binding/model-validation-in-aspnet-web-api</link><pubDate>Wed, 05 Sep 2012 09:05:02 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016381</guid><description><![CDATA[ <p>I&#39;m unable to use the Required attribute on any primitive including nullable as in following example.  I tried with int &amp; datetime as well.  In all cases the server returns 500 internal error.  Deserialization works if I remove the Required attribute.  I&#39;m using VS 2010 and downloaded asp.net web api.  Any ideas?</p><p></p><p>[Required]</p><p>public decimal? Price { get; set; }</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/jeffr59.jpg?forceidenticon=false&amp;dt=635044705800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by guogangj</title><link>http://www.asp.net/web-api/overview/formats-and-model-binding/model-validation-in-aspnet-web-api</link><pubDate>Wed, 26 Sep 2012 00:55:23 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016516</guid><description><![CDATA[ <p>Hi, how can I deal with the model having IValidatableObject interface?</p><p></p><p>I have a post to describe this question here: <a rel="nofollow" href="http://stackoverflow.com/questions/12593462/asp-net-web-api-custom-validation-example-issue" target="_blank">stackoverflow.com/</a></p><p></p><p>Could you give me a hand?</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/guogangj.jpg?forceidenticon=false&amp;dt=635044705800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by NeoZhou</title><link>http://www.asp.net/web-api/overview/formats-and-model-binding/model-validation-in-aspnet-web-api</link><pubDate>Sun, 18 Nov 2012 23:48:35 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016826</guid><description><![CDATA[ <p>If I want to use ValidationAttribute in a get method like this </p><p></p><p>public UserInfo Get([UserNameValidator]string name)</p><p></p><p>What I supposed to do?</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/NeoZhou.jpg?forceidenticon=false&amp;dt=635044705800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by bendras</title><link>http://www.asp.net/web-api/overview/formats-and-model-binding/model-validation-in-aspnet-web-api</link><pubDate>Fri, 14 Dec 2012 07:28:46 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000017009</guid><description><![CDATA[ <p>ExceptionMessage:</p><p></p><p>....Value-typed properties marked as [Required] must also be marked with</p><p>[DataMember(IsRequired=true)] to be recognized as required. Consider attributing the declaring type with [DataContract] and the property with [DataMember(IsRequired=true)].&quot;</p><p></p><p></p><p>Solution: <a rel="nofollow" href="http://stackoverflow.com/questions/12305784/dataannotation-for-required-property" target="_blank">stackoverflow.com/</a></p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/bendras.jpg?forceidenticon=false&amp;dt=635044705800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by ozkary</title><link>http://www.asp.net/web-api/overview/formats-and-model-binding/model-validation-in-aspnet-web-api</link><pubDate>Fri, 11 Jan 2013 09:59:49 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000017157</guid><description><![CDATA[ <p>How would the model validation filter work for unit testing?</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/ozkary.jpg?forceidenticon=false&amp;dt=635044705800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item></channel></rss>