<?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: Custom Model Binding in ASP.NET Core 1.0	</title>
	<atom:link href="https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/feed/" rel="self" type="application/rss+xml" />
	<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/</link>
	<description>Complex Software Development - Simplified</description>
	<lastBuildDate>Mon, 22 Aug 2022 01:55:47 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>
		By: 192.168.0.1		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-371917</link>

		<dc:creator><![CDATA[192.168.0.1]]></dc:creator>
		<pubDate>Fri, 29 Mar 2019 08:17:55 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-371917</guid>

					<description><![CDATA[There are many ways on the client to scrub user input]]></description>
			<content:encoded><![CDATA[<p>There are many ways on the client to scrub user input</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dot Net Developer		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-359641</link>

		<dc:creator><![CDATA[Dot Net Developer]]></dc:creator>
		<pubDate>Fri, 30 Nov 2018 05:56:44 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-359641</guid>

					<description><![CDATA[Very good read. Thank you for sharing. I am also a Developer. This is a great and informative article. So thank you.]]></description>
			<content:encoded><![CDATA[<p>Very good read. Thank you for sharing. I am also a Developer. This is a great and informative article. So thank you.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: JATINDAR SINGH		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-359036</link>

		<dc:creator><![CDATA[JATINDAR SINGH]]></dc:creator>
		<pubDate>Wed, 17 Oct 2018 03:49:44 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-359036</guid>

					<description><![CDATA[I enjoyed reading the article you posted. There were some really great explain Custom Model Binding in ASP.Net Core! 
I hope you will keep sharing more such informative articles, have a nice day!]]></description>
			<content:encoded><![CDATA[<p>I enjoyed reading the article you posted. There were some really great explain Custom Model Binding in ASP.Net Core!<br />
I hope you will keep sharing more such informative articles, have a nice day!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nuri Yilmaz		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-358250</link>

		<dc:creator><![CDATA[Nuri Yilmaz]]></dc:creator>
		<pubDate>Tue, 10 Jul 2018 23:06:16 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-358250</guid>

					<description><![CDATA[wow! thanks Dan! Really nice article as safe life jacket.]]></description>
			<content:encoded><![CDATA[<p>wow! thanks Dan! Really nice article as safe life jacket.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Mythree		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-337991</link>

		<dc:creator><![CDATA[Mythree]]></dc:creator>
		<pubDate>Wed, 15 Mar 2017 21:39:06 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-337991</guid>

					<description><![CDATA[Awesome article! But just wondering how complex types (a list of strings for example) should be handled?
And as Ryan pointed: IScrubberAttribute cannot be used as type parameter for GetCustomAttributes. The framework expects a type which inherits from System.Attribute or typeof(System.Attribute) itself.]]></description>
			<content:encoded><![CDATA[<p>Awesome article! But just wondering how complex types (a list of strings for example) should be handled?<br />
And as Ryan pointed: IScrubberAttribute cannot be used as type parameter for GetCustomAttributes. The framework expects a type which inherits from System.Attribute or typeof(System.Attribute) itself.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dan Haley		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-331901</link>

		<dc:creator><![CDATA[Dan Haley]]></dc:creator>
		<pubDate>Thu, 02 Feb 2017 23:37:19 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-331901</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-329951&quot;&gt;Michae Bird&lt;/a&gt;.

Michae,

The code in the GitHub repo is targeting v1.1 - SDK 1.0.0 Preview 2.1-003177, so it is the latest code.

The example doesn&#039;t have any other parameters it is binding to, so it doesn&#039;t need to check for PropertyName.  In your case I would just check if context.Metadata.PropertyName != null.

For your second comment, the IModelBinderProvider will get called for everything that is bound - in your case &quot;id&quot;, &quot;item&quot;, and all of item&#039;s properties.  Your provider gets to choose which of those it wants to handle the binding for, and for everything else it will return null.  In the example it is only handling the binding for properties of the model with an IScrubberAttribute.  Everything else is ignored.

Hope that helps.

Dan]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-329951">Michae Bird</a>.</p>
<p>Michae,</p>
<p>The code in the GitHub repo is targeting v1.1 &#8211; SDK 1.0.0 Preview 2.1-003177, so it is the latest code.</p>
<p>The example doesn&#8217;t have any other parameters it is binding to, so it doesn&#8217;t need to check for PropertyName.  In your case I would just check if context.Metadata.PropertyName != null.</p>
<p>For your second comment, the IModelBinderProvider will get called for everything that is bound &#8211; in your case &#8220;id&#8221;, &#8220;item&#8221;, and all of item&#8217;s properties.  Your provider gets to choose which of those it wants to handle the binding for, and for everything else it will return null.  In the example it is only handling the binding for properties of the model with an IScrubberAttribute.  Everything else is ignored.</p>
<p>Hope that helps.</p>
<p>Dan</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Michae Bird		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-329961</link>

		<dc:creator><![CDATA[Michae Bird]]></dc:creator>
		<pubDate>Fri, 20 Jan 2017 15:19:47 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-329961</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-329951&quot;&gt;Michae Bird&lt;/a&gt;.

That being the case, I really can&#039;t determine how I would get a single IModelBinder to return since there could be multiple attributes in the Model that need to be scrubbed.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-329951">Michae Bird</a>.</p>
<p>That being the case, I really can&#8217;t determine how I would get a single IModelBinder to return since there could be multiple attributes in the Model that need to be scrubbed.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Michae Bird		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-329951</link>

		<dc:creator><![CDATA[Michae Bird]]></dc:creator>
		<pubDate>Fri, 20 Jan 2017 15:06:38 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-329951</guid>

					<description><![CDATA[I am using v1.1 and this code no longer seems to work. I have a web method:

        [HttpPut(&quot;{id}&quot;)]
        public IActionResult Update(string id, [FromBody] Test item)

and in the ScrubbingModelBinderProvider.GetBinder, I get called twice:
1. with a string, the id form the Update method
2. with a Test instance from the Update method

In the GetBinder, the call for the id crashes because the PropertyName is null, the call for the Test instance does nothing because it is a complex type and the GetBinder method ignores complex types.]]></description>
			<content:encoded><![CDATA[<p>I am using v1.1 and this code no longer seems to work. I have a web method:</p>
<p>        [HttpPut(&#8220;{id}&#8221;)]<br />
        public IActionResult Update(string id, [FromBody] Test item)</p>
<p>and in the ScrubbingModelBinderProvider.GetBinder, I get called twice:<br />
1. with a string, the id form the Update method<br />
2. with a Test instance from the Update method</p>
<p>In the GetBinder, the call for the id crashes because the PropertyName is null, the call for the Test instance does nothing because it is a complex type and the GetBinder method ignores complex types.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dan Haley		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-319511</link>

		<dc:creator><![CDATA[Dan Haley]]></dc:creator>
		<pubDate>Thu, 17 Nov 2016 16:08:11 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-319511</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-319401&quot;&gt;Ryan&lt;/a&gt;.

Thanks Ryan.  Yes, the code definitely is not complete, but as-is should work.  I just installed .Net Core 1.0.1 and the tooling on a machine without any .Net Core components, and the project works.  What kind of error are you getting on the line in ScrubbingModelBinderProvider?  Are you on version 1.1?

As for changing it to CurrencyScrubberAttribute, the binder provider is written to work with any attribute that implements IScrubberAttribute, so it should be typeof(IScrubberAttribute).]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-319401">Ryan</a>.</p>
<p>Thanks Ryan.  Yes, the code definitely is not complete, but as-is should work.  I just installed .Net Core 1.0.1 and the tooling on a machine without any .Net Core components, and the project works.  What kind of error are you getting on the line in ScrubbingModelBinderProvider?  Are you on version 1.1?</p>
<p>As for changing it to CurrencyScrubberAttribute, the binder provider is written to work with any attribute that implements IScrubberAttribute, so it should be typeof(IScrubberAttribute).</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ryan		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-319401</link>

		<dc:creator><![CDATA[Ryan]]></dc:creator>
		<pubDate>Wed, 16 Nov 2016 17:49:47 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-319401</guid>

					<description><![CDATA[Awesome article. Just a quick update:

On the ScrubbingModelBinderProvider, line 14:
var attribute = propInfo.GetCustomAttributes(typeof(IScrubberAttribute), false).FirstOrDefault();

This throws an error. It should be CurrencyScrubberAttribute instead of IScrubberAttribute. 

You may also want to throw in some error handling to make sure propName and propInfo are not null before you get to attribute. It was throwing errors for me before I put that in.]]></description>
			<content:encoded><![CDATA[<p>Awesome article. Just a quick update:</p>
<p>On the ScrubbingModelBinderProvider, line 14:<br />
var attribute = propInfo.GetCustomAttributes(typeof(IScrubberAttribute), false).FirstOrDefault();</p>
<p>This throws an error. It should be CurrencyScrubberAttribute instead of IScrubberAttribute. </p>
<p>You may also want to throw in some error handling to make sure propName and propInfo are not null before you get to attribute. It was throwing errors for me before I put that in.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Legolas		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-315251</link>

		<dc:creator><![CDATA[Legolas]]></dc:creator>
		<pubDate>Mon, 17 Oct 2016 12:25:31 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-315251</guid>

					<description><![CDATA[Thank you Dan Haley, 

Your post helped me to resolve an error and understand the model binding behaviors.]]></description>
			<content:encoded><![CDATA[<p>Thank you Dan Haley, </p>
<p>Your post helped me to resolve an error and understand the model binding behaviors.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Milan		</title>
		<link>https://intellitect.com/blog/custom-model-binding-in-asp-net-core-1-0/#comment-310151</link>

		<dc:creator><![CDATA[Milan]]></dc:creator>
		<pubDate>Tue, 30 Aug 2016 15:09:15 +0000</pubDate>
		<guid isPermaLink="false">http://intellitect.com/?p=23091#comment-310151</guid>

					<description><![CDATA[Thank you Dan, very useful article !]]></description>
			<content:encoded><![CDATA[<p>Thank you Dan, very useful article !</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
