New Posts New Posts RSS Feed: Debugging the EntityManager Cache
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Debugging the EntityManager Cache

 Post Reply Post Reply
Author
c63205 View Drop Down
Newbie
Newbie


Joined: 28-Dec-2010
Location: Houston, TX
Posts: 10
Post Options Post Options   Quote c63205 Quote  Post ReplyReply Direct Link To This Post Topic: Debugging the EntityManager Cache
    Posted: 05-Jan-2011 at 4:10pm
I'm getting a FK constraint error on saving my entitymanager's data to the DB.  Is there a way to dynamically just purge/serialize the entities that are in the Cache to xml or some readable format.  I tried using the savecachestate() but its not readable (as expected).  This would purely be for development and debugging.

Perhaps someone has a tool or utility for this?

Thanks,
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jan-2011 at 1:09pm
Hi c63205;

As of 6.0.6, the SaveCacheState method now has an option to save in binary or text format.
Back to Top
c63205 View Drop Down
Newbie
Newbie


Joined: 28-Dec-2010
Location: Houston, TX
Posts: 10
Post Options Post Options   Quote c63205 Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jan-2011 at 2:27pm
OK, perhaps I wasn't using the correct encoding when reading from the stream.  I had entered 'false' for the binary parameter but the data wasn't readable.  Is the text structured at all (xml, etc?)  

It might be cool for 'someone' to create a little utility to traverse the EntityManagers entity graph and visualize the contents.  Perhaps a visual studio debugging visualizer widget.  Obviously not a big priority, but would be cool and perhaps useful. 
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jan-2011 at 2:53pm
c63205;

When flag sets to true, the EntityCacheState is written into a binary xml format.

When flag sets to false, the EntityCacheState is written into a text xml format. 

I have tested the following code and made sure that the output was correct for each option.

var mgr = new NorthwindIBEntityManager();
var customers = mgr.Customers.FirstOrNullEntity();
mgr.CacheStateManager.SaveCacheState(@"C:\temp\EntityCacheStateXml.xml", false);
mgr.CacheStateManager.SaveCacheState(@"C:\temp\EntityCacheStateBin.bin", true);


Edited by DenisK - 06-Jan-2011 at 4:01pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down