<?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 : Selecting certain properties of a DF/EF object.</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Selecting certain properties of a DF/EF object.</description>
  <pubDate>Mon, 13 Apr 2026 14:40:37 -700</pubDate>
  <lastBuildDate>Wed, 20 Oct 2010 10:18:18 -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=2245</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>Selecting certain properties of a DF/EF object. : geo,  you can try:  .  . ...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2245&amp;PID=8855#8855</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> 2245<br /><strong>Posted:</strong> 20-Oct-2010 at 10:18am<br /><br />geo,<DIV>&nbsp;</DIV><DIV>you can try:</DIV><DIV>&nbsp; .</DIV><DIV>&nbsp; .</DIV><DIV>&nbsp; .</DIV><DIV>&nbsp; .Select(e =&gt; new { id = e.Employee_ID, fname = e.Person.FirstName, lname = e.Person.LastName })</DIV><DIV>&nbsp; .</DIV><DIV>&nbsp; .</DIV><DIV>&nbsp; .</DIV><DIV>&nbsp; foreach (var item in op.Results){</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;Employee.Employee_ID = item.id;</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;Employee.Person.FirstName = item.fname;</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;Employee.Person.LastName = item.lname;</DIV><DIV>&nbsp;&nbsp;}</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Wed, 20 Oct 2010 10:18:18 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2245&amp;PID=8855#8855</guid>
  </item> 
  <item>
   <title>Selecting certain properties of a DF/EF object. : How can I select certain properties...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2245&amp;PID=8837#8837</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=976" rel="nofollow">geo</a><br /><strong>Subject:</strong> 2245<br /><strong>Posted:</strong> 19-Oct-2010 at 5:56pm<br /><br /><div style=": rgb255, 255, 255; margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb0, 0, 0; font-weight: normal; font-size: 12px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; "><div>How can I select certain properties to return without creating a new anonymous object? My goal is to use the Employee object I would normally get back but only fill certain properties in an effort to reduce the data going across my WCF service. Is this possible? With this code I get this error where I set Employee=item within my foreach loop.</div><div><br></div><div><div>Cannot implicitly convert type 'AnonymousType#1' to 'AmberStream.Model.Payroll.Employee'</div></div><div><br></div><div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var query = _entityManager</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.Employees</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.AddIncludePaths("Person")</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.Where(col =&gt; col.Employee_ID == id)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.Select(e =&gt; new { e.Employee_ID, e.Person.FirstName, e.Person.LastName })</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.ExecuteAsync(op =&gt; {</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (op.HasError)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;throw op.Error;</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;foreach (var item in op.Results)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Employee = item;&nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// debugging log</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ObjectDumper.Write(Employee);</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ObjectDumper.Write(Employee.Person.FirstName);</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ObjectDumper.Write(Employee.Person.LastName);</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;});</div></div></div>]]>
   </description>
   <pubDate>Tue, 19 Oct 2010 17:56:28 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2245&amp;PID=8837#8837</guid>
  </item> 
 </channel>
</rss>