<?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: Client-side properties and any remote LINQ provider</title>
	<atom:link href="http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider/feed" rel="self" type="application/rss+xml" />
	<link>http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=client-side-properties-and-any-remote-linq-provider</link>
	<description>A .NET developer in silicon valley</description>
	<lastBuildDate>Fri, 18 May 2012 15:31:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Damien Guard</title>
		<link>http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider#comment-47961</link>
		<dc:creator>Damien Guard</dc:creator>
		<pubDate>Wed, 11 Apr 2012 18:41:57 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1202#comment-47961</guid>
		<description>They should work just fine but bear in mind that even on the server an order by based on a calculation (which is what this effectively is) will not be as fast as one based on a stored value.</description>
		<content:encoded><![CDATA[<p>They should work just fine but bear in mind that even on the server an order by based on a calculation (which is what this effectively is) will not be as fast as one based on a stored value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider#comment-47960</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Wed, 11 Apr 2012 17:54:08 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1202#comment-47960</guid>
		<description>Great work Damien!  Are there any tricks to setting up these client side properties so that they can be used in OrderBy without needing to jump out to Ling to Objects?</description>
		<content:encoded><![CDATA[<p>Great work Damien!  Are there any tricks to setting up these client side properties so that they can be used in OrderBy without needing to jump out to Ling to Objects?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Damien Guard</title>
		<link>http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider#comment-47860</link>
		<dc:creator>Damien Guard</dc:creator>
		<pubDate>Tue, 20 Mar 2012 20:29:14 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1202#comment-47860</guid>
		<description>You can indeed - TranslationMap is a dictionary of PropertyInfo to CompiledExpression.

You&#039;ll need to add a getter to CompiledExpression to get out the Expression though.

[)amien</description>
		<content:encoded><![CDATA[<p>You can indeed &#8211; TranslationMap is a dictionary of PropertyInfo to CompiledExpression.</p>
<p>You&#8217;ll need to add a getter to CompiledExpression to get out the Expression though.</p>
<p>[)amien</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan</title>
		<link>http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider#comment-47859</link>
		<dc:creator>Stefan</dc:creator>
		<pubDate>Tue, 20 Mar 2012 20:14:35 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1202#comment-47859</guid>
		<description>Simple question: Can I get an expression for a property out of the TranslationMap?</description>
		<content:encoded><![CDATA[<p>Simple question: Can I get an expression for a property out of the TranslationMap?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LINQ: How to dynamically map properties &#124; peschuster</title>
		<link>http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider#comment-47731</link>
		<dc:creator>LINQ: How to dynamically map properties &#124; peschuster</dc:creator>
		<pubDate>Tue, 06 Mar 2012 19:36:12 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1202#comment-47731</guid>
		<description>[...] I did some research and discovered a blog post by Damien Guard and David Fowler: http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider. They described exactly what I was trying to do and also provided a ready solution for translating [...]</description>
		<content:encoded><![CDATA[<p>[...] I did some research and discovered a blog post by Damien Guard and David Fowler: <a href="http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider" rel="nofollow">http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider</a>. They described exactly what I was trying to do and also provided a ready solution for translating [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider#comment-47000</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Sat, 10 Dec 2011 02:52:18 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1202#comment-47000</guid>
		<description>Great work!  Any suggestions on how this might be used with interfaces?

Say you have the interface:
&lt;pre&gt;&lt;code&gt;public interface IElement {
  int UniqueId { get; }
}&lt;/code&gt;&lt;/pre&gt;
and various classes that implement the interface such as:

&lt;pre&gt;&lt;code&gt;public class User : IElement {
  private static readonly CompiledExpression _idExpression
            = DefaultTranslationOf.Property(x =&gt; x.UniqueId).Is(x =&gt; x.UserId);
  public int UniqueId { get { return _idExpression.Evaluate(this); } }
  public int UserId { get; set; }
}&lt;/code&gt;&lt;/pre&gt;

Here&#039;s what I&#039;m attempting to do at the moment, which doesn&#039;t work because the interface is being used:

&lt;pre&gt;&lt;code&gt;IQueryable source; // (could be assigned with an IQueryable on instantiation)
IList results = source.Where(x =&gt; x.UniqueId == 1).WithTranslations().ToList(); // this line causes the problem, as long as the interface is used.&lt;/code&gt;&lt;/pre&gt;

Any ideas?  I think the post above was attempting something similar.  I found another post at the following address, but couldn&#039;t quite figure out what the solution was:
http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/3b401086-2c58-4bd0-845b-e0209f9cdcf5

Thanks!</description>
		<content:encoded><![CDATA[<p>Great work!  Any suggestions on how this might be used with interfaces?</p>
<p>Say you have the interface:</p>
<pre><code>public interface IElement {
  int UniqueId { get; }
}</code></pre>
<p>and various classes that implement the interface such as:</p>
<pre><code>public class User : IElement {
  private static readonly CompiledExpression _idExpression
            = DefaultTranslationOf.Property(x =&gt; x.UniqueId).Is(x =&gt; x.UserId);
  public int UniqueId { get { return _idExpression.Evaluate(this); } }
  public int UserId { get; set; }
}</code></pre>
<p>Here&#8217;s what I&#8217;m attempting to do at the moment, which doesn&#8217;t work because the interface is being used:</p>
<pre><code>IQueryable source; // (could be assigned with an IQueryable on instantiation)
IList results = source.Where(x =&gt; x.UniqueId == 1).WithTranslations().ToList(); // this line causes the problem, as long as the interface is used.</code></pre>
<p>Any ideas?  I think the post above was attempting something similar.  I found another post at the following address, but couldn&#8217;t quite figure out what the solution was:<br />
<a href="http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/3b401086-2c58-4bd0-845b-e0209f9cdcf5" rel="nofollow">http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/3b401086-2c58-4bd0-845b-e0209f9cdcf5</a></p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Damien Guard</title>
		<link>http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider#comment-46897</link>
		<dc:creator>Damien Guard</dc:creator>
		<pubDate>Thu, 10 Nov 2011 16:49:50 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1202#comment-46897</guid>
		<description>You can grab a copy of the ExpressionVisitor class from the IQToolkit at http://iqtoolkit.codeplex.com/

[)amien</description>
		<content:encoded><![CDATA[<p>You can grab a copy of the ExpressionVisitor class from the IQToolkit at <a href="http://iqtoolkit.codeplex.com/" rel="nofollow">http://iqtoolkit.codeplex.com/</a></p>
<p>[)amien</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Don Wilcox</title>
		<link>http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider#comment-46872</link>
		<dc:creator>Don Wilcox</dc:creator>
		<pubDate>Mon, 07 Nov 2011 17:13:03 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1202#comment-46872</guid>
		<description>Damien,

I have attempted to use your library so solve a problem I originally asked in StackOverflow. I have a class ClientID to wrap an Int64 ID:

class ClientID {
  public Int64 Value { 
    get { return cidExpression.Evaluate(this); } 
    private set { m_Value = value; } 
  }
  public static bool operator ==(ClientID lhs, Int64 rhs) { return lhs.Value == rhs; }
  public static bool operator ==(Int64 lhs, ClientID rhs) { return rhs == lhs; }
  private Int64 m_Value;
  private static readonly CompiledExpression cidExpression = DefaultTranslationOf.Property(e =&gt; e.Value).Is(e =&gt; e.m_Value);
}

I use it as:
  var q = dc.Notes.Where(f =&gt; f.CreatorParty.ClientID == clientID).WithTranslations().ToList();

but I still receive the &quot;Could not format node &#039;Value&#039; for execute as SQL.&quot; error. I know the class is being initialized, because I am passing a ClientID as a parameter to the search method containing the LINQ code.</description>
		<content:encoded><![CDATA[<p>Damien,</p>
<p>I have attempted to use your library so solve a problem I originally asked in StackOverflow. I have a class ClientID to wrap an Int64 ID:</p>
<p>class ClientID {<br />
  public Int64 Value {<br />
    get { return cidExpression.Evaluate(this); }<br />
    private set { m_Value = value; }<br />
  }<br />
  public static bool operator ==(ClientID lhs, Int64 rhs) { return lhs.Value == rhs; }<br />
  public static bool operator ==(Int64 lhs, ClientID rhs) { return rhs == lhs; }<br />
  private Int64 m_Value;<br />
  private static readonly CompiledExpression cidExpression = DefaultTranslationOf.Property(e =&gt; e.Value).Is(e =&gt; e.m_Value);<br />
}</p>
<p>I use it as:<br />
  var q = dc.Notes.Where(f =&gt; f.CreatorParty.ClientID == clientID).WithTranslations().ToList();</p>
<p>but I still receive the &#8220;Could not format node &#8216;Value&#8217; for execute as SQL.&#8221; error. I know the class is being initialized, because I am passing a ClientID as a parameter to the search method containing the LINQ code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Radek</title>
		<link>http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider#comment-46871</link>
		<dc:creator>Radek</dc:creator>
		<pubDate>Mon, 07 Nov 2011 10:44:34 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1202#comment-46871</guid>
		<description>Great lib, thanks!

Unfortunately, I am unable to build it for .NET 3.5, because I am missing ExpressionVisitor class.

Any suggestions for this one?

Thanks.</description>
		<content:encoded><![CDATA[<p>Great lib, thanks!</p>
<p>Unfortunately, I am unable to build it for .NET 3.5, because I am missing ExpressionVisitor class.</p>
<p>Any suggestions for this one?</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fred the frog</title>
		<link>http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider#comment-46445</link>
		<dc:creator>Fred the frog</dc:creator>
		<pubDate>Fri, 23 Sep 2011 19:34:41 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1202#comment-46445</guid>
		<description>Good job.

I easily managed to make it work in a standard way.

But I hurt myself banging my head on a brick wall. I wish to have  two levels of translation and don&#039;t seem to be capable of.

My &quot;mission&quot; is to declare the client side property in an interface and having the implementation of the property made in the extension class of the interface so that many entities can expose the new client property.

One of the trick was to transform the code so that to now accept a method instead of a property as client side (interface extension cannot extend properties if I&#039;m right). That I managed ok, me thinks.

The second trick that gets me crazy is now I need to implement a second level of client side property so that in the expression of the DefaultTranslationOf, I want to use a second level of client side property so that classes that implement the interface can specify the server side fields to use in the expression. (Hope I am not talking german now).

So to illustrate

interface:&lt;pre&gt;&lt;code&gt;public interface IDataStatus { Guid StatusId { get; } }&lt;/code&gt;&lt;/pre&gt;

InterfaceExtension:&lt;pre&gt;&lt;code&gt;public static class DataStatusExtensions {
	private static readonly CompiledExpression closeStatusExpression = DefaultTranslationOf.Property(e =&gt; e.CloseStatus()).Is(e =&gt; (e.StatusId == EnumStatusIDs.Closed) &#124;&#124; (e.StatusId == EnumStatusIDs.Detached));

	public static Boolean CloseStatus(this IDataStatus dataStatus) {
		return closeStatusExpression.Evaluate(dataStatus);
	}
}&lt;/code&gt;&lt;/pre&gt;

Now in the derived class:&lt;pre&gt;&lt;code&gt;partial class Connection : IDataStatus {
	private static readonly CompiledExpression statusIdExpression = DefaultTranslationOf.Property(e =&gt; e.StatusId).Is(e =&gt; (e.EnumConnectionStatusID == null) ? Guid.Empty : e.EnumConnectionStatusID.Value);

	public Guid StatusId { get { return statusIdExpression.Evaluate(this); }
}&lt;/code&gt;&lt;/pre&gt;
... and finally some query method ...&lt;pre&gt;&lt;code&gt;query = query.Where(it =&gt; it.CloseStatus()).WithTranslations();&lt;/code&gt;&lt;/pre&gt;

My thinking is that my problem is that it does not manage to translate a IDataStatus.StatusId because the declaration in the map is a Connection.StatusId...

What do you think?

Sorry for the long post but I wished to illustrate my saying.

Thanks.</description>
		<content:encoded><![CDATA[<p>Good job.</p>
<p>I easily managed to make it work in a standard way.</p>
<p>But I hurt myself banging my head on a brick wall. I wish to have  two levels of translation and don&#8217;t seem to be capable of.</p>
<p>My &#8220;mission&#8221; is to declare the client side property in an interface and having the implementation of the property made in the extension class of the interface so that many entities can expose the new client property.</p>
<p>One of the trick was to transform the code so that to now accept a method instead of a property as client side (interface extension cannot extend properties if I&#8217;m right). That I managed ok, me thinks.</p>
<p>The second trick that gets me crazy is now I need to implement a second level of client side property so that in the expression of the DefaultTranslationOf, I want to use a second level of client side property so that classes that implement the interface can specify the server side fields to use in the expression. (Hope I am not talking german now).</p>
<p>So to illustrate</p>
<p>interface:
<pre><code>public interface IDataStatus { Guid StatusId { get; } }</code></pre>
<p>InterfaceExtension:
<pre><code>public static class DataStatusExtensions {
	private static readonly CompiledExpression closeStatusExpression = DefaultTranslationOf.Property(e =&gt; e.CloseStatus()).Is(e =&gt; (e.StatusId == EnumStatusIDs.Closed) || (e.StatusId == EnumStatusIDs.Detached));

	public static Boolean CloseStatus(this IDataStatus dataStatus) {
		return closeStatusExpression.Evaluate(dataStatus);
	}
}</code></pre>
<p>Now in the derived class:
<pre><code>partial class Connection : IDataStatus {
	private static readonly CompiledExpression statusIdExpression = DefaultTranslationOf.Property(e =&gt; e.StatusId).Is(e =&gt; (e.EnumConnectionStatusID == null) ? Guid.Empty : e.EnumConnectionStatusID.Value);

	public Guid StatusId { get { return statusIdExpression.Evaluate(this); }
}</code></pre>
<p>&#8230; and finally some query method &#8230;
<pre><code>query = query.Where(it =&gt; it.CloseStatus()).WithTranslations();</code></pre>
<p>My thinking is that my problem is that it does not manage to translate a IDataStatus.StatusId because the declaration in the map is a Connection.StatusId&#8230;</p>
<p>What do you think?</p>
<p>Sorry for the long post but I wished to illustrate my saying.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

