Closed Leon99 closed 4 years ago
It looks like the embedded server does document store init implicitly so it's getting locked right after GetDocumentStore()
. I managed to get past the exception by leveraging the code from ConfigureForNodaTime()
and adding a converter (I only needed LocalDate)/calling RegisterQueryValueConverter()
on DatabaseOptions
. I also had to copy CustomQueryValueConverters
as it's marked as internal.
My questions so far:
Initialize()
?DatabaseOptions
, on deserialization from the DB I had string
instead of LocalDate
- is that expected? I suspect it's caused by using IDictionary<string, object>
for the field that was the deserialization target - if so, are there any workarounds to get boxed LocalDate
instead of string
?According to https://ravendb.net/docs/article-page/4.2/csharp/client-api/creating-document-store,
The Document Store is immutable - all above configuration are frozen upon calling .Initialize().
Does that mean that https://github.com/ryanheath/RavenDB-NodaTime/wiki/Installation-and-Configuration is incorrect (outdated)?
Calling documentStore.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); before the Initialize should work, as that is what we are doing within the unit tests see MyRavenTestDriver.cs and RavenTestDriver.cs
As far as I can see, it looks like the test driver is not using the embedded documentstore for the client, but it creates a client separately, see
For your question about the deserialization of LocalDate into string, do you have a project I can take a look at?
I have update the wiki to reflect the 4.x initialization order.
I found workaround!
var dbOptions = new DatabaseOptions(dbRecord);
var store = new DocumentStore{Conventions = dbOptions.Conventions};
store.ConfigureForNodaTime();
I created pull request
I'm getting this exception:
Code:
Moving
ConfigureForNodaTime()
beforeInitialize()
produces the same exception.Any ideas appreciated.