<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Automatic properties with custom logic – part 2</title>
	<atom:link href="http://blog.somecreativity.com/2008/10/29/automatic-properties-with-custom-logic-%e2%80%93-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.somecreativity.com/2008/10/29/automatic-properties-with-custom-logic-%e2%80%93-part-2/</link>
	<description>Weblog of Siddharth Uppal</description>
	<lastBuildDate>Sun, 21 Feb 2010 10:50:19 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Sid</title>
		<link>http://blog.somecreativity.com/2008/10/29/automatic-properties-with-custom-logic-%e2%80%93-part-2/#comment-4718</link>
		<dc:creator>Sid</dc:creator>
		<pubDate>Thu, 30 Oct 2008 20:38:12 +0000</pubDate>
		<guid isPermaLink="false">http://siddhu.wordpress.com/?p=509#comment-4718</guid>
		<description>Having a virtual Taxable property makes the scenario of the same item becoming non-taxable a bit twisted. That said - there are multiple ways to skin a cat. My approach seemed a natural succession of automatic properties.</description>
		<content:encoded><![CDATA[<p>Having a virtual Taxable property makes the scenario of the same item becoming non-taxable a bit twisted. That said &#8211; there are multiple ways to skin a cat. My approach seemed a natural succession of automatic properties.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jd</title>
		<link>http://blog.somecreativity.com/2008/10/29/automatic-properties-with-custom-logic-%e2%80%93-part-2/#comment-4717</link>
		<dc:creator>Jd</dc:creator>
		<pubDate>Thu, 30 Oct 2008 19:46:40 +0000</pubDate>
		<guid isPermaLink="false">http://siddhu.wordpress.com/?p=509#comment-4717</guid>
		<description>In such a scenario, you can make Taxable property as virtual and create another derived class named  TaxableShoppingCartItem, in which you mark taxable = True, regardless of TaxId. I am not able to think of the scenario where one would need what you are looking for.</description>
		<content:encoded><![CDATA[<p>In such a scenario, you can make Taxable property as virtual and create another derived class named  TaxableShoppingCartItem, in which you mark taxable = True, regardless of TaxId. I am not able to think of the scenario where one would need what you are looking for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sid</title>
		<link>http://blog.somecreativity.com/2008/10/29/automatic-properties-with-custom-logic-%e2%80%93-part-2/#comment-4716</link>
		<dc:creator>Sid</dc:creator>
		<pubDate>Wed, 29 Oct 2008 21:26:08 +0000</pubDate>
		<guid isPermaLink="false">http://siddhu.wordpress.com/?p=509#comment-4716</guid>
		<description>That&#039;s not against the business rule. As I said in the beginning, there can be items that have a non-zero TaxID but are not taxed because of some logic elsewhere - customer has a special tax exempt status or something. Having a Taxable flag on the item makes those areas of code that just need to know whether an item is taxable or not simpler (they don&#039;t need to know the business rule that those with a taxid of zero are non-taxable... also this logic for determining taxable items might change in the future).</description>
		<content:encoded><![CDATA[<p>That&#8217;s not against the business rule. As I said in the beginning, there can be items that have a non-zero TaxID but are not taxed because of some logic elsewhere &#8211; customer has a special tax exempt status or something. Having a Taxable flag on the item makes those areas of code that just need to know whether an item is taxable or not simpler (they don&#8217;t need to know the business rule that those with a taxid of zero are non-taxable&#8230; also this logic for determining taxable items might change in the future).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jd</title>
		<link>http://blog.somecreativity.com/2008/10/29/automatic-properties-with-custom-logic-%e2%80%93-part-2/#comment-4715</link>
		<dc:creator>Jd</dc:creator>
		<pubDate>Wed, 29 Oct 2008 21:18:03 +0000</pubDate>
		<guid isPermaLink="false">http://siddhu.wordpress.com/?p=509#comment-4715</guid>
		<description>I am sorry, but I think you have it backwards. If your property Taxable is a dependent property (on TaxId), then you make Taxable readonly and derive it from TaxId inside your code. 

The simpler solution will be:

public class ShoppingCartItem  
{  
    public int TaxID { get; set; }  
    public bool Taxable 
    { 
         get { return TaxID &gt; 0 ? true : false; }
    }  
}  

This also solves your problem of keeping &#039;Taxable&#039; in sync with TaxId. In your scenario, someone can set Taxable property to false even when TaxId &gt; 0 which is against the business rule.</description>
		<content:encoded><![CDATA[<p>I am sorry, but I think you have it backwards. If your property Taxable is a dependent property (on TaxId), then you make Taxable readonly and derive it from TaxId inside your code. </p>
<p>The simpler solution will be:</p>
<p>public class ShoppingCartItem<br />
{<br />
    public int TaxID { get; set; }<br />
    public bool Taxable<br />
    {<br />
         get { return TaxID &gt; 0 ? true : false; }<br />
    }<br />
}  </p>
<p>This also solves your problem of keeping &#8216;Taxable&#8217; in sync with TaxId. In your scenario, someone can set Taxable property to false even when TaxId &gt; 0 which is against the business rule.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Automatic properties with custom logic &#171; Some Creativity</title>
		<link>http://blog.somecreativity.com/2008/10/29/automatic-properties-with-custom-logic-%e2%80%93-part-2/#comment-4714</link>
		<dc:creator>Automatic properties with custom logic &#171; Some Creativity</dc:creator>
		<pubDate>Wed, 29 Oct 2008 20:58:37 +0000</pubDate>
		<guid isPermaLink="false">http://siddhu.wordpress.com/?p=509#comment-4714</guid>
		<description>[...] Update:Check out part 2 where I take an example to bring the problem into perspective and propose a solution&#8230; Possibly related posts: (automatically generated)PSA: Bindable Setters Don&#8217;t Fire!Using optional private field param to register property to waive loadPropertyCustom field types for SharePoint [...]</description>
		<content:encoded><![CDATA[<p>[...] Update:Check out part 2 where I take an example to bring the problem into perspective and propose a solution&#8230; Possibly related posts: (automatically generated)PSA: Bindable Setters Don&rsquo;t Fire!Using optional private field param to register property to waive loadPropertyCustom field types for SharePoint [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
