I am querying built-in TimeoutData entity in RavenDB using Raven.Client.Lightweight 2.5 library to get specific timeout document. It is possible that TimeoutData does not exist in the database because no document is stored there yet. In that case NotSupportedException is thrown when you try to query it.
Currently I have created workaround for this situation:
try
{
timeoutData = _session.Query<TimeoutData>().FirstOrDefault(t => t.Headers.ContainsValue(someValue));
}
catch (NotSupportedException)
{
return null;
}
Is it possible to verify if TimeoutData exist without using try-catch? I have also tried the following code but it returns false when documents exist in TimeoutData entity:
if (!_session.Query<TimeoutData>().Any())
{
}
Turns out that I had to turn off pluralization of entity names and after that _session.Query<TimeoutData>().Any()
started to work. Before doing that query tried to find entity named TimeoutDatas
.
This post helped me: RavenDB changes metadata "Raven-Entity-Name".
And also I forgot to mention that TimeoutData
is NServiceBus entity for storing deferred messages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With