move flavors + utils from zero.Raven to zero
This commit is contained in:
+3
-3
@@ -6,7 +6,7 @@ using Rv = Raven.Client;
|
||||
|
||||
namespace zero.Raven;
|
||||
|
||||
public class ZeroDocumentConventionsBuilder : IZeroDocumentConventionsBuilder
|
||||
public class RavenDocumentConventionsBuilder : IRavenDocumentConventionsBuilder
|
||||
{
|
||||
protected HashSet<Type> PolymorphTypes { get; private set; } = new();
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ZeroDocumentConventionsBuilder : IZeroDocumentConventionsBuilder
|
||||
protected static ConcurrentDictionary<Type, string> CachedTypeCollectionNameMap = new();
|
||||
|
||||
|
||||
public ZeroDocumentConventionsBuilder(IZeroOptions options)
|
||||
public RavenDocumentConventionsBuilder(IZeroOptions options)
|
||||
{
|
||||
Options = options;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public class ZeroDocumentConventionsBuilder : IZeroDocumentConventionsBuilder
|
||||
}
|
||||
|
||||
|
||||
public interface IZeroDocumentConventionsBuilder
|
||||
public interface IRavenDocumentConventionsBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// Applies internal rules to the RavenDB document conventions
|
||||
@@ -1,12 +0,0 @@
|
||||
using zero.Raven;
|
||||
|
||||
namespace zero;
|
||||
|
||||
public static class ZeroBuilderExtensions
|
||||
{
|
||||
public static ZeroBuilder AddRavenDb(this ZeroBuilder builder)
|
||||
{
|
||||
builder.AddModule<ZeroRavenModule>();
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,20 @@ using Raven.Client.Http;
|
||||
|
||||
namespace zero.Raven;
|
||||
|
||||
public static class ZeroBuilderExtensions
|
||||
{
|
||||
public static ZeroBuilder AddRavenDb(this ZeroBuilder builder)
|
||||
{
|
||||
builder.AddModule<ZeroRavenModule>();
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
|
||||
internal class ZeroRavenModule : ZeroModule
|
||||
{
|
||||
public override void ConfigureServices(IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddSingleton<IZeroDocumentConventionsBuilder, ZeroDocumentConventionsBuilder>();
|
||||
services.AddSingleton<IRavenDocumentConventionsBuilder, RavenDocumentConventionsBuilder>();
|
||||
services.AddSingleton<IZeroDocumentStore, ZeroDocumentStore>(CreateRavenStore);
|
||||
services.AddScoped<IZeroStore, ZeroStore>();
|
||||
services.AddScoped<IZeroTokenProvider, ZeroTokenProvider>();
|
||||
@@ -30,7 +39,7 @@ internal class ZeroRavenModule : ZeroModule
|
||||
{
|
||||
IZeroOptions options = services.GetService<IZeroOptions>();
|
||||
RavenOptions ravenOptions = options.For<RavenOptions>();
|
||||
IZeroDocumentConventionsBuilder conventionsBuilder = services.GetService<IZeroDocumentConventionsBuilder>();
|
||||
IRavenDocumentConventionsBuilder conventionsBuilder = services.GetService<IRavenDocumentConventionsBuilder>();
|
||||
|
||||
IZeroDocumentStore store = new ZeroDocumentStore(options)
|
||||
{
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace zero.Raven;
|
||||
namespace zero.Models;
|
||||
|
||||
|
||||
public class ConfigureFlavorJsonOptions : IConfigureOptions<JsonOptions>
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace zero.Raven;
|
||||
namespace zero.Models;
|
||||
|
||||
/// <summary>
|
||||
/// A flavor config holds information about a flavor implementation
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace zero.Raven;
|
||||
namespace zero.Models;
|
||||
|
||||
public class FlavorOptions
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace zero.Raven;
|
||||
namespace zero.Models;
|
||||
|
||||
/// <summary>
|
||||
/// A flavor provider is attached to an entity (which has ISupportsFlavors) and contains all flavors
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace zero.Raven;
|
||||
namespace zero.Models;
|
||||
|
||||
public class FlavorProviderOptions<TEntity> where TEntity : class, ISupportsFlavors, new()
|
||||
{
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace zero.Raven;
|
||||
namespace zero.Models;
|
||||
|
||||
internal class JsonFlavorVariantConverter<T> : JsonDiscriminatorConverter<T> where T : class, ISupportsFlavors, new()
|
||||
{
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace zero.Raven;
|
||||
namespace zero.Models;
|
||||
|
||||
public class JsonFlavorVariantConverterFactory : JsonConverterFactory
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace zero.Raven;
|
||||
namespace zero.Utils;
|
||||
|
||||
/// <summary>
|
||||
/// Automatically generate ID with the specified length and insert it into this property on entity save
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace zero.Raven;
|
||||
namespace zero.Utils;
|
||||
|
||||
public class IdGenerator
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace zero.Raven;
|
||||
namespace zero.Utils;
|
||||
|
||||
public class Safenames
|
||||
{
|
||||
Reference in New Issue
Block a user