<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Is it possibale to cast a entity into a interface with a linq Query</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Is it possibale to cast a entity into a interface with a linq Query</description>
  <pubDate>Thu, 23 May 2013 00:31:47 -700</pubDate>
  <lastBuildDate>Tue, 30 Aug 2011 03:36:56 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=2925</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Is it possibale to cast a entity into a interface with a linq Query : I found a solution in collaboration...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2925&amp;PID=11595#11595</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1248" rel="nofollow">JJANSSEN</a><br /><strong>Subject:</strong> 2925<br /><strong>Posted:</strong> 30-Aug-2011 at 3:36am<br /><br />I found a solution <span id="result_" ="short_text" lang="en"><span ="hps">in collaboration with </span></span>Marcel Good:<br><br><pre style="font-family: C&#111;nsolas; font-size: 13px; color: black; : n&#111;ne repeat scroll 0% 0% white;"><span style="color:blue;">public</span>&nbsp;<span style="color:#2b91af;">INotifyCompleted</span>&nbsp;LoadHierarchieStruktur(<span style="color:#2b91af;">Action</span>&lt;<span style="color:#2b91af;">IEnumerable</span>&lt;<span style="color:#2b91af;">IHierarchieElement</span>&gt;&gt;&nbsp;onSuccess,&nbsp;<span style="color:#2b91af;">Action</span>&lt;<span style="color:#2b91af;">Exception</span>&gt;&nbsp;onFail){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#2b91af;">ITypedEntityQuery</span>&nbsp;baseQuery&nbsp;&nbsp;=&nbsp;Manager.Sortiment.Include(<span style="color:#a31515;">"UnterSortimente"</span>); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;predicate&nbsp;=&nbsp;<span style="color:#2b91af;">PredicateBuilder</span>.Make(<span style="color:#a31515;">"Ebene"</span>,&nbsp;<span style="color:#2b91af;">FilterOperator</span>.IsEqualTo,&nbsp;<span style="color:#a31515;">"1"</span>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;op&nbsp;=&nbsp;baseQuery.Where(predicate).ExecuteAsync();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">return</span>&nbsp;op.OnComplete(result&nbsp;=&gt;&nbsp;{&nbsp;<span style="color:blue;">if</span>&nbsp;(onSuccess&nbsp;!=&nbsp;<span style="color:blue;">null</span>)&nbsp;onSuccess(result.Cast&lt;<span style="color:#2b91af;">IHierarchieElement</span>&gt;());&nbsp;},&nbsp;onFail);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br><br><span id="result_" ="" lang="en"><span ="hps">An</span> <span ="hps">approach</span> <span ="hps">for</span> <span ="hps">the solution was</span> <span ="hps">found</span> <span ="hps">in the</span> <span ="hps">documentation</span> <span ="hps">section</span></span>.<br>http://drc.ideablade.com/xwiki/bin/view/Documentation/predicatebuilder-methods<br><br></pre><div>Regards,&nbsp; Johannes</div><pre style="font-family:C&#111;nsolas;font-size:13;color:black;:white;"><br></pre>]]>
   </description>
   <pubDate>Tue, 30 Aug 2011 03:36:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2925&amp;PID=11595#11595</guid>
  </item> 
  <item>
   <title>Is it possibale to cast a entity into a interface with a linq Query : Hi Silvio,we have an GUI-Componten...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2925&amp;PID=11540#11540</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1248" rel="nofollow">JJANSSEN</a><br /><strong>Subject:</strong> 2925<br /><strong>Posted:</strong> 26-Aug-2011 at 12:22am<br /><br />Hi Silvio,<br><br>we have an GUI-Componten to display Data in a TreeView. The general Component did not know which Entity are inside in the model but know the entity has the Interface like "IHierarchieElement" with the methode "GetName(), GetNumber()". <br><br>We have an idea to find a solution, while we transfor the entity in the GUI into another objekt with the interface "IHierarchieElement". A disadvantage is that it is complex and more code.<br><br><div>Regards,</div><div>&nbsp;&nbsp; Johannes.</div><br>]]>
   </description>
   <pubDate>Fri, 26 Aug 2011 00:22:27 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2925&amp;PID=11540#11540</guid>
  </item> 
  <item>
   <title>Is it possibale to cast a entity into a interface with a linq Query :   Hi Jjanssen,Unfortunatelly...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2925&amp;PID=11534#11534</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 2925<br /><strong>Posted:</strong> 25-Aug-2011 at 5:05pm<br /><br />Hi Jjanssen,<div>&nbsp;</div><div>Unfortunatelly this will not be possible.</div><div>&nbsp;</div><div>The issue is that the DF don't have enough information to serialize the results back to the client for non-scalar query results.&nbsp;</div><div>It will try to send a List&lt;ICustomer&gt; back to the client, and the serializer doesn't know what a List&lt;ICustomer&gt; is.  </div><div>So the list form of the query will always fail, for any entity type.</div><div>&nbsp;</div><div>Can you elaborate on why you are trying this approach, so I can better understand and assist?</div><div>&nbsp;</div><div>Regards,</div><div>&nbsp;&nbsp; Silvio.</div>]]>
   </description>
   <pubDate>Thu, 25 Aug 2011 17:05:22 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2925&amp;PID=11534#11534</guid>
  </item> 
  <item>
   <title>Is it possibale to cast a entity into a interface with a linq Query : Header ofthe partial class  ...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2925&amp;PID=11522#11522</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1248" rel="nofollow">JJANSSEN</a><br /><strong>Subject:</strong> 2925<br /><strong>Posted:</strong> 25-Aug-2011 at 9:06am<br /><br />Header of&nbsp;the partial class<DIV><SPAN style="COLOR: blue"></SPAN>&nbsp;</DIV><DIV><SPAN style="COLOR: blue"><table width="99%"><tr><td><pre class="BBcode"></DIV><PRE style="FONT-FAMILY: C&#111;nsolas; : white; COLOR: black; FONT-SIZE: 13px"><SPAN style="COLOR: blue">public</SPAN>&nbsp;<SPAN style="COLOR: blue">partial</SPAN>&nbsp;<SPAN style="COLOR: blue">class</SPAN>&nbsp;<SPAN style="COLOR: #2b91af">Sortiment</SPAN>&nbsp;:&nbsp;IbEm.<SPAN style="COLOR: #2b91af">Entity</SPAN>&nbsp;,&nbsp;<SPAN style="COLOR: #2b91af">IHierarchieElement</SPAN></PRE><PRE style="FONT-FAMILY: C&#111;nsolas; : white; COLOR: black; FONT-SIZE: 13px"><SPAN style="COLOR: #2b91af"></SPAN></SPAN>&nbsp;</pre></td></tr></table></PRE><DIV>&nbsp;</DIV><DIV>Methode to invoke a query with Linq and Cast it.</DIV><DIV><DIV><SPAN style="COLOR: blue"><table width="99%"><tr><td><pre class="BBcode"></DIV></SPAN></DIV><DIV><PRE style="FONT-FAMILY: C&#111;nsolas; : white; COLOR: black; FONT-SIZE: 13px">&nbsp;<SPAN style="COLOR: blue">public</SPAN>&nbsp;<SPAN style="COLOR: #2b91af">INotifyCompleted</SPAN>&nbsp;LoadHierarchieStruktur(<SPAN style="COLOR: #2b91af">Action</SPAN>&lt;<SPAN style="COLOR: #2b91af">IEnumerable</SPAN>&lt;<SPAN style="COLOR: #2b91af">IHierarchieElement</SPAN>&gt;&gt;&nbsp;onSuccess,&nbsp;<SPAN style="COLOR: #2b91af">Action</SPAN>&lt;<SPAN style="COLOR: #2b91af">Exception</SPAN>&gt;&nbsp;onFail)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #2b91af">EntityQueryOperation</SPAN>&lt;<SPAN style="COLOR: #2b91af">IHierarchieElement</SPAN>&gt;&nbsp;op&nbsp;=&nbsp;Manager.Sortiment.Cast&lt;<SPAN style="COLOR: #2b91af">IHierarchieElement</SPAN>&gt;()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Where(c&nbsp;=&gt;&nbsp;c.GetEbene().Equals(<SPAN style="COLOR: #a31515">"1"</SPAN>))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.ExecuteAsync(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">return</SPAN>&nbsp;op.OnComplete(onSuccess,&nbsp;onFail);&nbsp;}</PRE><PRE style="FONT-FAMILY: C&#111;nsolas; : white; COLOR: black; FONT-SIZE: 13px"></pre></td></tr></table></PRE><PRE style="FONT-FAMILY: C&#111;nsolas; : white; COLOR: black; FONT-SIZE: 13px">&nbsp;</PRE><PRE style="FONT-FAMILY: C&#111;nsolas; : white; COLOR: black; FONT-SIZE: 13px"><FONT color=#0066ff><SPAN id=result_ lang=en =short_text><SPAN =hps>I</SPAN> <SPAN =hps>ask because</SPAN> <SPAN =hps>we</SPAN> <SPAN =hps>get</SPAN> <SPAN =hps>an exception</SPAN></SPAN>:</FONT></PRE><PRE style="FONT-FAMILY: C&#111;nsolas; : white; COLOR: black; FONT-SIZE: 13px">Unable to locate type: System.Linq.IQueryable`1&#091;&#091;~.IHierarchieElement, Common.SL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null&#093;&#093;, System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e. Check that the assembly holding this type is available in the bin/exe folder. Also check that both your assemblies and DevForce assemblies have the expected version number on both client and server.</PRE><PRE style="FONT-FAMILY: C&#111;nsolas; : white; COLOR: black; FONT-SIZE: 13px">&nbsp;</PRE></DIV><DIV>&nbsp;</DIV><DIV>We checked&nbsp;assemblies&nbsp;and do not find the solution :-(.</DIV><DIV><TABLE =tableBorder cellSpacing=1 cellPadding=3 width=510 align=center><T><TR =tableSubLedger><TD colSpan=2>Code and Fixed Width Data</TD></TR><TR =tableRow><TD colSpan=2>&#091;CODE&#093;</TD></TR></T></TABLE></DIV><DIV><BR></DIV><DIV><TABLE =tableBorder cellSpacing=1 cellPadding=3 width=510 align=center><T><TR =tableSubLedger><TD colSpan=2>Code and Fixed Width Data</TD></TR><TR =tableRow><TD colSpan=2>&#091;CODE&#093;</TD></TR></T></TABLE></DIV>]]>
   </description>
   <pubDate>Thu, 25 Aug 2011 09:06:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2925&amp;PID=11522#11522</guid>
  </item> 
 </channel>
</rss>