<?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 for Progressive Digressive</title>
	<atom:link href="http://www.marcuswhitworth.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marcuswhitworth.com</link>
	<description>Marcus Whitworth&#039;s tech blog – .NET, C#, Silverlight, WPF, Flex…etc, etc</description>
	<lastBuildDate>Thu, 24 Feb 2011 17:00:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comment on Dynamic Linq with Expression Trees by Jhelumi</title>
		<link>http://www.marcuswhitworth.com/2009/12/dynamic-linq-with-expression-trees/comment-page-1/#comment-24</link>
		<dc:creator>Jhelumi</dc:creator>
		<pubDate>Thu, 24 Feb 2011 17:00:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=106#comment-24</guid>
		<description>I need something like this for my Advance Search form. What I&#039;m doing is passing the rules collection to a method which uses the foreach loop to apply all the where conditions to my object. my question is how I&#039;m going to return the results.
public IQueryable GetProducts(List rules)
{
foreach( var rule in rules_
{ var products =  this.ObjectContext.Products.Where(GetExpression(
            rule.MemberName, // The Applicant property
            rule.Operator, // Equals, Contains, GreaterThan, etc
            rule.Value)
  );
}
return ??
}

How can I make the query to run and return the result</description>
		<content:encoded><![CDATA[<p>I need something like this for my Advance Search form. What I&#8217;m doing is passing the rules collection to a method which uses the foreach loop to apply all the where conditions to my object. my question is how I&#8217;m going to return the results.<br />
public IQueryable GetProducts(List rules)<br />
{<br />
foreach( var rule in rules_<br />
{ var products =  this.ObjectContext.Products.Where(GetExpression(<br />
            rule.MemberName, // The Applicant property<br />
            rule.Operator, // Equals, Contains, GreaterThan, etc<br />
            rule.Value)<br />
  );<br />
}<br />
return ??<br />
}</p>
<p>How can I make the query to run and return the result</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Dynamic Linq with Expression Trees by Shane</title>
		<link>http://www.marcuswhitworth.com/2009/12/dynamic-linq-with-expression-trees/comment-page-1/#comment-23</link>
		<dc:creator>Shane</dc:creator>
		<pubDate>Wed, 08 Dec 2010 19:58:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=106#comment-23</guid>
		<description>If i use Equal instead of Equals for the operator type, everything works just fine.</description>
		<content:encoded><![CDATA[<p>If i use Equal instead of Equals for the operator type, everything works just fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Dynamic Linq with Expression Trees by Shane</title>
		<link>http://www.marcuswhitworth.com/2009/12/dynamic-linq-with-expression-trees/comment-page-1/#comment-22</link>
		<dc:creator>Shane</dc:creator>
		<pubDate>Tue, 07 Dec 2010 23:15:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=106#comment-22</guid>
		<description>Interesting note:

decimal? testVal = new decimal?(2100);
            var test = (from i in context.Leases where i.AnnualRental == testVal select i).ToList();

the above works, while the following throws an error:

decimal? testVal = new decimal?(2100);
            var test = (from i in context.Leases where i.AnnualRental.Equals(testVal) select i).ToList();

Unable to create a constant value of type &#039;System.Object&#039;. Only primitive types (&#039;such as Int32, String, and Guid&#039;) are supported in this context.
Source : System.Data.Entity</description>
		<content:encoded><![CDATA[<p>Interesting note:</p>
<p>decimal? testVal = new decimal?(2100);<br />
            var test = (from i in context.Leases where i.AnnualRental == testVal select i).ToList();</p>
<p>the above works, while the following throws an error:</p>
<p>decimal? testVal = new decimal?(2100);<br />
            var test = (from i in context.Leases where i.AnnualRental.Equals(testVal) select i).ToList();</p>
<p>Unable to create a constant value of type &#8216;System.Object&#8217;. Only primitive types (&#8216;such as Int32, String, and Guid&#8217;) are supported in this context.<br />
Source : System.Data.Entity</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Dynamic Linq with Expression Trees by Shane</title>
		<link>http://www.marcuswhitworth.com/2009/12/dynamic-linq-with-expression-trees/comment-page-1/#comment-21</link>
		<dc:creator>Shane</dc:creator>
		<pubDate>Tue, 07 Dec 2010 23:04:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=106#comment-21</guid>
		<description>I am using Entity Framework and have an entity with a nullable decimal field. When I attempt to call this method on that field I get this error:

Expression of type &#039;System.Nullable`1[System.Decimal]&#039; cannot be used for parameter of type &#039;System.Object&#039; of method &#039;Boolean Equals(System.Object)&#039;

It appears to be related to the fact that EF cannot handle the Object parameter. I am not sure if this is just an issue with Linq to EF or not.

As an example this will also give an error:

decimal? testVal = new decimal?(2100);
            var test = (from i in context.Leases where i.AnnualRental.Equals(testVal) select i).ToList();</description>
		<content:encoded><![CDATA[<p>I am using Entity Framework and have an entity with a nullable decimal field. When I attempt to call this method on that field I get this error:</p>
<p>Expression of type &#8216;System.Nullable`1[System.Decimal]&#8216; cannot be used for parameter of type &#8216;System.Object&#8217; of method &#8216;Boolean Equals(System.Object)&#8217;</p>
<p>It appears to be related to the fact that EF cannot handle the Object parameter. I am not sure if this is just an issue with Linq to EF or not.</p>
<p>As an example this will also give an error:</p>
<p>decimal? testVal = new decimal?(2100);<br />
            var test = (from i in context.Leases where i.AnnualRental.Equals(testVal) select i).ToList();</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Dynamic Linq with Expression Trees by Marcus</title>
		<link>http://www.marcuswhitworth.com/2009/12/dynamic-linq-with-expression-trees/comment-page-1/#comment-20</link>
		<dc:creator>Marcus</dc:creator>
		<pubDate>Tue, 07 Dec 2010 22:22:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=106#comment-20</guid>
		<description>I&#039;m not sure what you mean Shane, it seems to work ok with nullable props too for me.  Using that same method to create the expression,  I just pass in a nullable property and it all works.

Is there a specific example you can give?</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure what you mean Shane, it seems to work ok with nullable props too for me.  Using that same method to create the expression,  I just pass in a nullable property and it all works.</p>
<p>Is there a specific example you can give?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Dynamic Linq with Expression Trees by Shane</title>
		<link>http://www.marcuswhitworth.com/2009/12/dynamic-linq-with-expression-trees/comment-page-1/#comment-19</link>
		<dc:creator>Shane</dc:creator>
		<pubDate>Tue, 07 Dec 2010 21:53:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=106#comment-19</guid>
		<description>I appreciate your example and it works great with non-nullable fields, however I am having fits trying to make this work with nullable fields. Any suggestions?</description>
		<content:encoded><![CDATA[<p>I appreciate your example and it works great with non-nullable fields, however I am having fits trying to make this work with nullable fields. Any suggestions?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Dynamic Linq with Expression Trees by Marcus</title>
		<link>http://www.marcuswhitworth.com/2009/12/dynamic-linq-with-expression-trees/comment-page-1/#comment-10</link>
		<dc:creator>Marcus</dc:creator>
		<pubDate>Wed, 02 Dec 2009 23:28:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=106#comment-10</guid>
		<description>&lt;blockquote&gt;&lt;em&gt;In the UI you show, how do you select both London &amp; NY. That doesn’t seem to work the code either.&lt;/em&gt;&lt;/blockquote&gt;

That&#039;s not yet a requirement, but if/when it is, I&#039;d need to introduce some logic like PredicateBuilder in the back end, and some optional rule grouping by &#039;OR/AND&#039; in the client UI to enable it.</description>
		<content:encoded><![CDATA[<blockquote><p><em>In the UI you show, how do you select both London &amp; NY. That doesn’t seem to work the code either.</em></p></blockquote>
<p>That&#8217;s not yet a requirement, but if/when it is, I&#8217;d need to introduce some logic like PredicateBuilder in the back end, and some optional rule grouping by &#8216;OR/AND&#8217; in the client UI to enable it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Dynamic Linq with Expression Trees by Aaron Goldman</title>
		<link>http://www.marcuswhitworth.com/2009/12/dynamic-linq-with-expression-trees/comment-page-1/#comment-9</link>
		<dc:creator>Aaron Goldman</dc:creator>
		<pubDate>Wed, 02 Dec 2009 20:36:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=106#comment-9</guid>
		<description>This is a cool demonstration of expression tree building.  I have to do this sometime.

I have almost the exact same requirement in my current project.  My data is in arrays, so in a way its more straightforward.  

I created 2 filter types - 1 for enums and 1 for range filtering.  Everything is bound to a WPF UI so when the user selects the field, they&#039;re also selecting the index into the array (as a property of the Field type).  Also, the user selects in a slider for ranges and a list for enums.  In the UI you show, how do you select both London &amp; NY.  That doesn&#039;t seem to work the code either.

In the end, my filtering in Linq looks very similar to yours and the whole system is nearly logically identical.</description>
		<content:encoded><![CDATA[<p>This is a cool demonstration of expression tree building.  I have to do this sometime.</p>
<p>I have almost the exact same requirement in my current project.  My data is in arrays, so in a way its more straightforward.  </p>
<p>I created 2 filter types &#8211; 1 for enums and 1 for range filtering.  Everything is bound to a WPF UI so when the user selects the field, they&#8217;re also selecting the index into the array (as a property of the Field type).  Also, the user selects in a slider for ranges and a list for enums.  In the UI you show, how do you select both London &amp; NY.  That doesn&#8217;t seem to work the code either.</p>
<p>In the end, my filtering in Linq looks very similar to yours and the whole system is nearly logically identical.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on .NET Development on a Mac &#8211; Fusion or Parallels? by Marcus</title>
		<link>http://www.marcuswhitworth.com/2009/09/dotnet-development-on-a-mac-fusion-or-parallels/comment-page-1/#comment-3</link>
		<dc:creator>Marcus</dc:creator>
		<pubDate>Sat, 26 Sep 2009 18:23:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=34#comment-3</guid>
		<description>I&#039;m running 10.5.8, and Windows 7 64-bit (I originally went for 64 bit due to &lt;a href=&quot;http://blogs.vmware.com/teamfusion/2009/01/windows-7-on-mac-with-vmware-fusion-a-practical-guide.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;a note on the VMware blog&lt;/a&gt; noting some people were getting better performance out of 64-bit).  Do you have enough RAM?  You could always install under Bootcamp, then get Parallels to just mount your Bootcamp partition - that way it&#039;s potentially the best of both worlds.  For more intensive work you can run natively, for regular stuff just run in the VM.

Was the &#039;Slow Leopard&#039; pun intentional? :)</description>
		<content:encoded><![CDATA[<p>I&#8217;m running 10.5.8, and Windows 7 64-bit (I originally went for 64 bit due to <a href="http://blogs.vmware.com/teamfusion/2009/01/windows-7-on-mac-with-vmware-fusion-a-practical-guide.html" target="_blank" rel="nofollow">a note on the VMware blog</a> noting some people were getting better performance out of 64-bit).  Do you have enough RAM?  You could always install under Bootcamp, then get Parallels to just mount your Bootcamp partition &#8211; that way it&#8217;s potentially the best of both worlds.  For more intensive work you can run natively, for regular stuff just run in the VM.</p>
<p>Was the &#8216;Slow Leopard&#8217; pun intentional? :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on .NET Development on a Mac &#8211; Fusion or Parallels? by Danish Munir</title>
		<link>http://www.marcuswhitworth.com/2009/09/dotnet-development-on-a-mac-fusion-or-parallels/comment-page-1/#comment-2</link>
		<dc:creator>Danish Munir</dc:creator>
		<pubDate>Sat, 26 Sep 2009 17:52:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.marcuswhitworth.com/?p=34#comment-2</guid>
		<description>Thanks for sharing that.
Where you using 10.5 or 10.6? I&#039;m trying the same thing on a brand new Macbook Pro 15&quot; 2.53 Ghz running Slow Leopard and both Parallels and Fusion are painfully slow. I&#039;ve tried both Win 7 and Win Xp.

Whats a developer to do?</description>
		<content:encoded><![CDATA[<p>Thanks for sharing that.<br />
Where you using 10.5 or 10.6? I&#8217;m trying the same thing on a brand new Macbook Pro 15&#8243; 2.53 Ghz running Slow Leopard and both Parallels and Fusion are painfully slow. I&#8217;ve tried both Win 7 and Win Xp.</p>
<p>Whats a developer to do?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching using disk: basic
Object Caching 560/564 objects using disk: basic

Served from: www.marcuswhitworth.com @ 2012-02-22 20:04:32 -->
