<?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 : Serialize EF Entity Properties as XML</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : Serialize EF Entity Properties as XML</description>
  <pubDate>Tue, 28 Apr 2026 22:57:57 -700</pubDate>
  <lastBuildDate>Fri, 06 Nov 2009 10:22:50 -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=1371</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>Serialize EF Entity Properties as XML : mtx_252, can you provide a larger...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=5756#5756</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> 1371<br /><strong>Posted:</strong> 06-Nov-2009 at 10:22am<br /><br />mtx_252, can you provide a larger code sample showing how you're converting from an IsolatedStorageFileStream to a MemoryStream, and also how you're doing the SaveCacheState?&nbsp; If you can't post it here, please send to IdeaBladeSupportTrack@.&nbsp; Also, because it works for a few test runs, is there any possibility you're hitting the storage limits for that store?&nbsp; Do you delete the file after the cache is restored?]]>
   </description>
   <pubDate>Fri, 06 Nov 2009 10:22:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=5756#5756</guid>
  </item> 
  <item>
   <title>Serialize EF Entity Properties as XML : Hello,I am working in Silverlight...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=5755#5755</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=557" rel="nofollow">mtx_252</a><br /><strong>Subject:</strong> 1371<br /><strong>Posted:</strong> 06-Nov-2009 at 7:42am<br /><br />Hello,<br><br>I am working in Silverlight - devForce version 5.2.3.1.<br><br>I am trying to restore from a memory stream using the following code:<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MemoryStream cacheStream = (MemoryStream)ISManager.get_ISStream(cENTITYMANAGER);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; entityManager.CacheStateManager.RestoreCacheState(cacheStream, RestoreStrategy.Normal, false);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cacheStream.Close();<br><br>&nbsp;It seems like once I get an exception thrown by the CacheStateManager, I cant restore from Stream even if I re-add the reference DLLs and do a clean build.&nbsp; I had the same problem in version 5.2.2.0, the very first time restore cache was working and once I got this error(not sure how) it stopped working on my machine, however the same project worked on a different computer until the error was thrown. I switched from version 5.2.2 to 5.2.3 and the same project was restoring from cache but stopped working after few test runs of the application. I have built a new project but still unable to use the RestoreCache method properly.<br><br>I am getting the following exception thrown from the CacheStateManager:<br><br>A first chance exception of type 'System.Runtime.Serialization.SerializationException' occurred in IdeaBlade.EntityModel.SL<br>A first chance exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.dll<br><br>There was an error deserializing the object of type IdeaBlade.EntityModel.EntityCacheState. The input source is not correctly formatted.<br>&nbsp;&nbsp;&nbsp;&nbsp; at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)<br>&nbsp;&nbsp; at System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader)<br>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityCacheState.Load(Stream stream, Boolean closeOnExit)<br>&nbsp;&nbsp; at IdeaBlade.EntityModel.CacheStateManager.RestoreCacheState(Stream stream, RestoreStrategy strategy, Boolean closeOnExit)<br>]]>
   </description>
   <pubDate>Fri, 06 Nov 2009 07:42:26 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=5755#5755</guid>
  </item> 
  <item>
   <title>Serialize EF Entity Properties as XML : The problem mentioned in the earlier...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=5745#5745</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> 1371<br /><strong>Posted:</strong> 05-Nov-2009 at 1:36pm<br /><br />The problem mentioned in the earlier post should be fixed in the 5.2.3.1 release (it was actually fixed in an earlier release), and there are no "known" issues right now.&nbsp; Can you provide some more information on the error you're seeing?&nbsp; Also, are you working in WinClient/Universal or Silverlight?]]>
   </description>
   <pubDate>Thu, 05 Nov 2009 13:36:39 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=5745#5745</guid>
  </item> 
  <item>
   <title>Serialize EF Entity Properties as XML : Hello,I am using version 5.2.3.1...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=5744#5744</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=557" rel="nofollow">mtx_252</a><br /><strong>Subject:</strong> 1371<br /><strong>Posted:</strong> 05-Nov-2009 at 6:19am<br /><br />Hello,<br><br>I am using version 5.2.3.1 and having the same problem with RestoreCacheState.&nbsp; Is there another workaround or a fix fore this issue?<br><br>Thanks<br>]]>
   </description>
   <pubDate>Thu, 05 Nov 2009 06:19:25 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=5744#5744</guid>
  </item> 
  <item>
   <title>Serialize EF Entity Properties as XML : I&amp;#039;ll give that a try.  Thanks...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=5142#5142</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=538" rel="nofollow">caine.chow</a><br /><strong>Subject:</strong> 1371<br /><strong>Posted:</strong> 10-Aug-2009 at 2:23pm<br /><br />I'll give that a try.<br /><br />Thanks very much.<br /><br />]]>
   </description>
   <pubDate>Mon, 10 Aug 2009 14:23:49 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=5142#5142</guid>
  </item> 
  <item>
   <title>Serialize EF Entity Properties as XML : We had a problem with not flushing...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=4941#4941</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> 1371<br /><strong>Posted:</strong> 13-Jul-2009 at 11:25am<br /><br />We had a problem with not flushing the stream correctly, which was fixed in version 5.1.1.&nbsp;&nbsp;The workaround in prior versions is to pass 'true' for the closeOnExit argument to SaveCacheState.]]>
   </description>
   <pubDate>Mon, 13 Jul 2009 11:25:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=4941#4941</guid>
  </item> 
  <item>
   <title>Serialize EF Entity Properties as XML : Thanks Kimj,  I did eventually...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=4940#4940</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=538" rel="nofollow">caine.chow</a><br /><strong>Subject:</strong> 1371<br /><strong>Posted:</strong> 13-Jul-2009 at 7:45am<br /><br />Thanks Kimj,<br /><br />I did eventually get to the entityManager.CacheStateManager and saving and restoration from file works perfectly. However, when I try to save and restore to and from a MemoryStream it does not restore properly and fails with the following error:<br /><br />System.Runtime.Serialization.SerializationException : There was an error deserializing the object . Unexpected end of file. Following elements are not closed: PersistenceOrderWrapper, SaveOptionsSurrogate, EntityCacheState.<br />  ----&gt; System.Xml.XmlException : Unexpected end of file. Following elements are not closed: PersistenceOrderWrapper, SaveOptionsSurrogate, EntityCacheState.<br /><br />My test code looks like the following:<br /><br />System.IO.MemoryStream ms = new System.IO.MemoryStream();<br />IdeaBlade.EntityModel.v4.EntityManager entityMgr = new EntityManager();<br />entityMgr.AddEntity(workflowEntity);<br />entityMgr.CacheStateManager.SaveCacheState(ms, false);<br /><br />ms.Position = 0;<br /><br />IdeaBlade.EntityModel.v4.EntityManager entityMgr2 = new EntityManager();<br />entityMgr2.CacheStateManager.RestoreCacheState(ms, RestoreStrategy.Normal, false);<br /><br />I have also been trying to serialize the CachedState using NetDataContractSerialization as well as DataContractSerialization w/o success.<br /><br />Any ideas as to why saving and restoring to/from a memory stream isn't working for me?<br /><br />Thanks very much.]]>
   </description>
   <pubDate>Mon, 13 Jul 2009 07:45:19 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=4940#4940</guid>
  </item> 
  <item>
   <title>Serialize EF Entity Properties as XML : DevForce entities are not currently...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=4937#4937</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> 1371<br /><strong>Posted:</strong> 10-Jul-2009 at 6:36pm<br /><br />DevForce entities are not currently serializable to XML.&nbsp; This is a long-standing planned feature which always seems to get bumped when prioritizing.&nbsp; It is not currently possible using the Object Mapper to add a DataMember attribute to members to be serialized.&nbsp;&nbsp;&nbsp;<DIV>&nbsp;</DIV><DIV>You should be able to do what you need with the EntityCacheState, however.&nbsp; You can save some or all entities loaded into the EntityManager cache to a file using:</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;&nbsp; entityManager.CacheStateManager.SaveCacheState(@"c:\temp\entitycache.bin");</DIV><DIV>&nbsp;</DIV><DIV>And load a saved EnttyCacheState back into an EntityManager with:</DIV><DIV>&nbsp;</DIV><DIV>&nbsp; entityManager.CacheStateManager.RestoreCacheState(@"c:\temp\entitycache.bin");</DIV><DIV>&nbsp;</DIV><DIV>There are other overloads available, so check the documentation for more information.</DIV>]]>
   </description>
   <pubDate>Fri, 10 Jul 2009 18:36:57 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=4937#4937</guid>
  </item> 
  <item>
   <title>Serialize EF Entity Properties as XML : We are trying to serialize some...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=4928#4928</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=538" rel="nofollow">caine.chow</a><br /><strong>Subject:</strong> 1371<br /><strong>Posted:</strong> 09-Jul-2009 at 11:14am<br /><br />We are trying to serialize some of our EF Entities as XML so that we can persist that XML when we want to save the data but not commit that data to the database.<br /><br />Apart from implementing IXMLSerializable on every entity to be serialized, do we have any built in DevForce options? Is it possible to mark our generated EF Entity members with &#091;DataMember&#093; (http://www.ideablade.com/forum/forum_posts.asp?TID=1238&KW=datamember&PID=4462#4462 suggests that this is not possible and very bad)?<br /><br />Any help would be greatly appreciated.<br /><br />CC]]>
   </description>
   <pubDate>Thu, 09 Jul 2009 11:14:43 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1371&amp;PID=4928#4928</guid>
  </item> 
 </channel>
</rss>