<?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 : Saving Changes to POCOs</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Saving Changes to POCOs</description>
  <pubDate>Tue, 12 May 2026 23:24:33 -700</pubDate>
  <lastBuildDate>Fri, 30 Nov 2012 12:31:57 -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=3829</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>Saving Changes to POCOs :   You have a few different options.I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3829&amp;PID=15311#15311</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3829<br /><strong>Posted:</strong> 30-Nov-2012 at 12:31pm<br /><br />You have a few different options.<div>&nbsp;</div><div>I assume you're projecting into the PlayerLite type from a query, so you shouldn't need a POCO service provider or adapter at all.</div><div>&nbsp;</div><div>One option would be to query for the full Player entity when changes are required.&nbsp; The Player would then be changed and saved.</div><div>&nbsp;</div><div>Another option would be to make changes to the PlayerLite object, and in an EntityQuerySaveInterceptor intercept the save of the PlayerLite, and there query for and modify the Player in the provided EntityManager.&nbsp; You'd also have to detach the PlayerLite from the EM so that DevForce won't still try to save it as a POCO, or alternately keep a stub POCO save method.</div><div>&nbsp;</div><div>Another option would be to use table splitting for these entities, so that both are full-fledged entities with a 1-1 relationship between them, and either could be modified as needed.&nbsp; </div>]]>
   </description>
   <pubDate>Fri, 30 Nov 2012 12:31:57 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3829&amp;PID=15311#15311</guid>
  </item> 
  <item>
   <title>Saving Changes to POCOs :  My use case is as follows.Given...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3829&amp;PID=15308#15308</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1499" rel="nofollow">matt.cavagnaro</a><br /><strong>Subject:</strong> 3829<br /><strong>Posted:</strong> 30-Nov-2012 at 10:50am<br /><br />My use case is as follows.<br><br>Given a DB backed entity like Player<br><table width="99%"><tr><td><pre class="BBcode">class Player()<br>{<br>&nbsp;&nbsp;&nbsp; Guid UniqueID { get; set; }<br>&nbsp;&nbsp;&nbsp; string FirstName { get; set; }<br>&nbsp;&nbsp;&nbsp; string LastName { get; set; }<br>&nbsp;&nbsp;&nbsp; bool IsActive { get; set; }<br>&nbsp;&nbsp;&nbsp; string TeamName { get; set; }<br>&nbsp;&nbsp;&nbsp; string Position { get; set; }<br>&nbsp;&nbsp;&nbsp; byte&#091;&#093; Picture { get; set; }<br>}<br></pre></td></tr></table><br><br>And a POCO class for a query on Players to project into:<br><table width="99%"><tr><td><pre class="BBcode">class PlayerLite()<br>{<br>&nbsp;&nbsp;&nbsp; Guid UniqueID { get; set; }<br>&nbsp;&nbsp;&nbsp; string LastName { get; set; }<br>&nbsp;&nbsp;&nbsp; bool IsActive { get; set; }<br>}<br></pre></td></tr></table><br><br>I need to query many objects like Player at once. to make the query more performant I've used a POCO to only pull down the data I need to interact with. In reality my Player table is much larger than this. And I'd like to avoid pulling down heavier properties like Images and other Navigation Properties.<br><br>In the portion of the app this is used for the User is only ever expecting to modify a handful of properties for a given Player entity.<br><br>I guess I don't understand the function of wanting to save the POCO to somewhere that is not it's data source, like an XML file. To me this sounds like I could query for a subset of the object I wanted to modify, make a few changes, and be able to map the properties on the POCO back to the DB backed Entity.<br><br>Is there another way you'd suggest doing this?<br>]]>
   </description>
   <pubDate>Fri, 30 Nov 2012 10:50:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3829&amp;PID=15308#15308</guid>
  </item> 
  <item>
   <title>Saving Changes to POCOs :   As you&amp;#039;ve found,you can&amp;#039;t...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3829&amp;PID=15307#15307</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3829<br /><strong>Posted:</strong> 30-Nov-2012 at 10:38am<br /><br />As you've found,&nbsp;you can't use an EntityManager from your POCO service provider or adapter to save an entity.&nbsp; The save is recursive to DevForce, and&nbsp;once a save is in progress additional SaveChanges calls are not supported.<div>&nbsp;</div><div>In general, POCO is not really intended for database-backed objects, and any insert/update/delete activities should not be using an EntityManager in the provider or adapter.</div><div>&nbsp;</div><div>I'm not sure I understand your use case, though, and maybe POCO is not a good fit for this anyway.&nbsp; If your FCC type is a subset of an existing entity type, will standard inheritance work - maybe&nbsp;with an abstract base&nbsp;entity&nbsp;having the FCC and other entity type as sub-types?&nbsp;&nbsp; More information on inheritance is here - <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/model-advanced" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/model-advanced</a>.</div><div>&nbsp;</div><div>&nbsp;</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Fri, 30 Nov 2012 10:38:28 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3829&amp;PID=15307#15307</guid>
  </item> 
  <item>
   <title>Saving Changes to POCOs :  I&amp;#039;ve recently implemented...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3829&amp;PID=15306#15306</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1499" rel="nofollow">matt.cavagnaro</a><br /><strong>Subject:</strong> 3829<br /><strong>Posted:</strong> 30-Nov-2012 at 8:55am<br /><br />I've recently implemented a ConventionBased ServiceProvider to Query for a FCC POCO object which is a subset of an existing Entity.<br><br>I have not been able to figure out how to persist changes made to the POCO to the table it is a subset for during SaveChanges.<br><br>I've read through these links multiple times and have not been able to figure out how to make this work.<br><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/poco-service-provider-class" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/poco-service-provider-class</a><br><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/poco-save-mechanisms" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/poco-save-mechanisms</a><br><br>I've tried using the EntityManager from the POCO to query for and save changes to the original object in the DB but an error is thrown stating recursive saves are not supported.<br><br>Is there any better documentation/code samples for this?<br><span style="font-size:10px"><br /><br />Edited by matt.cavagnaro - 30-Nov-2012 at 8:56am</span>]]>
   </description>
   <pubDate>Fri, 30 Nov 2012 08:55:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3829&amp;PID=15306#15306</guid>
  </item> 
 </channel>
</rss>