<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>MVC Style parameter binding for WebAPI</title><link>http://blogs.msdn.com/b/jmstall/archive/2012/04/18/mvc-style-parameter-binding-for-webapi.aspx</link><description>I described earlier how WebAPI binds parameters . The entire parameter binding behavior is determined by the IActionValueBinder interface and can be swapped out. The default implementation is DefaultActionValueBinder. Here’s another IActionValueBinder</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: MVC Style parameter binding for WebAPI</title><link>http://blogs.msdn.com/b/jmstall/archive/2012/04/18/mvc-style-parameter-binding-for-webapi.aspx#10319918</link><pubDate>Thu, 14 Jun 2012 14:57:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10319918</guid><dc:creator>Marcus McConnell</dc:creator><description>&lt;p&gt;Thanks Mike! This is exactly what I was looking for.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10319918" width="1" height="1"&gt;</description></item><item><title>re: MVC Style parameter binding for WebAPI</title><link>http://blogs.msdn.com/b/jmstall/archive/2012/04/18/mvc-style-parameter-binding-for-webapi.aspx#10316030</link><pubDate>Wed, 06 Jun 2012 16:33:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10316030</guid><dc:creator>Mike Stall - MSFT</dc:creator><description>&lt;p&gt;@Ryan &amp;nbsp;- I&amp;#39;d be happy to. stay tuned...&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10316030" width="1" height="1"&gt;</description></item><item><title>re: MVC Style parameter binding for WebAPI</title><link>http://blogs.msdn.com/b/jmstall/archive/2012/04/18/mvc-style-parameter-binding-for-webapi.aspx#10315462</link><pubDate>Tue, 05 Jun 2012 19:47:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10315462</guid><dc:creator>Ryan Riley</dc:creator><description>&lt;p&gt;Mike, any chance you&amp;#39;d care to add this to WebApiContrib? :) &lt;a rel="nofollow" target="_new" href="http://github.com/WebApiContrib/WebAPIContrib"&gt;github.com/.../WebAPIContrib&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10315462" width="1" height="1"&gt;</description></item><item><title>re: MVC Style parameter binding for WebAPI</title><link>http://blogs.msdn.com/b/jmstall/archive/2012/04/18/mvc-style-parameter-binding-for-webapi.aspx#10295941</link><pubDate>Fri, 20 Apr 2012 19:38:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10295941</guid><dc:creator>Mike Stall - MSFT</dc:creator><description>&lt;p&gt;@Dave - yes. It&amp;#39;s very similar to MVC. I&amp;#39;ll write up a blog about it. &lt;/p&gt;
&lt;p&gt;There are several ways to do it. One way is to add a [ModelBinder] attribute on the parameter callstite. &lt;/p&gt;
&lt;p&gt;GetContacts([ModelBinder(typeof(MyModelBinder)] OAuthToken authToken)&lt;/p&gt;
&lt;p&gt;In the beta, you must supply a model binder provider. In the lastest sources, you can supply a IModelBinder just like MVC. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10295941" width="1" height="1"&gt;</description></item><item><title>re: MVC Style parameter binding for WebAPI</title><link>http://blogs.msdn.com/b/jmstall/archive/2012/04/18/mvc-style-parameter-binding-for-webapi.aspx#10295842</link><pubDate>Fri, 20 Apr 2012 15:41:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10295842</guid><dc:creator>Dave (@cozmicdad)</dc:creator><description>&lt;p&gt;Can I use a modelbinder or a formatter to change the type of a parameter / add remove parameters?&lt;/p&gt;
&lt;p&gt;ie. I have a method &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;List&amp;lt;Contact&amp;gt; GetContacts(string authToken)&lt;/p&gt;
&lt;p&gt;where authToken is an OAuthToken which allows me to lookup an actual user account and fetch user-account-info &lt;/p&gt;
&lt;p&gt;. &amp;nbsp;In fact, I have a lot of service methods which accept this authToken......ALMOST every service method in fact..... &amp;nbsp;I don&amp;#39;t want to have to convert authToken into Account in every method. &amp;nbsp;In fact, I just want *some magic* which will take in the authToken, validate it and either return an error to the client or pass the looked-up-Account instance to the downstream method.....&lt;/p&gt;
&lt;p&gt;HttpRequest -&amp;gt; List&amp;lt;Contact&amp;gt;GetContacts(string authToken) -&amp;gt; *Some magic* -&amp;gt; List&amp;lt;Contact&amp;gt;GetContacts(Account acct)&lt;/p&gt;
&lt;p&gt;How do I go about achieving this?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10295842" width="1" height="1"&gt;</description></item></channel></rss>