minor fixes

This commit is contained in:
2022-01-15 15:50:05 +01:00
parent 80e293d4fe
commit 90b647e4d6
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ public class ZeroOptions : IZeroOptions
{
Type type = typeof(TOptions);
if (!OptionsCache.TryGetValue(type, out object value))
if (!OptionsCache.TryGetValue(type, out object value) && ServiceProvider != null)
{
IOptions<TOptions> options = ServiceProvider.GetService<IOptions<TOptions>>();
value = options.Value;
@@ -123,7 +123,7 @@ public class ZeroDocumentConventionsBuilder : IZeroDocumentConventionsBuilder
protected virtual string TransformTypeCollectionNameToDocumentIdPrefix(string name)
{
RavenOptions options = Options.For<RavenOptions>();
if (!options.CollectionPrefix.IsNullOrWhiteSpace())
if (options != null && !options.CollectionPrefix.IsNullOrWhiteSpace())
{
name = options.CollectionPrefix.EnsureEndsWith(IdentityPartsSeparator) + name.TrimStart(options.CollectionPrefix);
}