Open PersistentDictionary using a different value type


I have been using PersistentDictionary in a windows service with a custom, private type for the value. This has worked well, however I wanted to read the PersistentDictionary files with a separate utility for debugging purposes (while the service is off), however I realized that PersistentDictionary does a validation of the type and will throw if you do not have the exact same .NET type used to create it. Therefore I cannot read these files with any other program than the one that created them (types are internal or private and the assembly is signed). Would it be possible to add the capability to allow a different but compatible type to be used?


mthorp wrote Aug 23, 2016 at 5:34 PM

PersistentDictionary, under the covers, creates an ESENT database; so if you want access to the database outside the constraints of PersistentDictionary, you can switch to using the ManagedEsent APIs to read it.

I would strongly recommend against doing any writes to the database as you might mess up PersistentDictionary's schema, but you should be able to read it with no problems.

~ Michael

mzboray wrote Aug 23, 2016 at 6:45 PM

Right. I could do that but it would require a bit more understanding about the raw ESENT APIs and how PersistentDictionary uses them on my part. I think my starting point would be to fork the project, modify the Collections project to remove the type check in PersistentDictionary.CheckDatabaseMetaData, and see if that works.