问题
I am trying to set the RavenDB DocumentStore.ApiKey
in NServiceBus 3.2.3. According to this thread, this is not able to be read directly from the connection string by the version of RavenDB used in NSB 3.2.3.
The DocumentStore
instance in NSB is registered as an IDocumentStore
, which means I cannot use a custom action like this as IDocumentStore
does not expose ApiKey
:
Configure.With()
.DefaultBuilder()
.RavenPersistence()
.RunCustomAction(() =>
Configure.Instance.Configurer
.ConfigureProperty<IDocumentStore>(store => store.ApiKey, "my-api-key"));
There doesn't seem to be overload of the RavenPersistence
extension that allows me to supply an IDocumentStore
. Is there any way I can set the ApiKey
?
回答1:
We internalize the Raven client so there is no way for you to set that property. The only work around that comes to mind is to use the core only version of nservicebus (that would make the code you mention in your question to work properly) The development version of NSB has been upgraded to Raven 960 so another option would be to upgrade to the CI version of NServiceBus (http://builds.nservicebus.com/guestAuth/app/nuget/v1/FeedService.svc)
来源:https://stackoverflow.com/questions/11240353/setting-ravendb-apikey-in-nservicebus-3-2-3