From 982c46a657f86b6d561b08aeeaf78bd16ee42bd9 Mon Sep 17 00:00:00 2001 From: Jan Trejbal Date: Mon, 8 Jan 2024 16:38:06 +0100 Subject: [PATCH] Add IMysqlJsonOptions into the EF serviceCollection --- .../Design/Internal/MySqlJsonMicrosoftDesignTimeServices.cs | 3 +++ .../MySqlJsonMicrosoftServiceCollectionExtensions.cs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/EFCore.MySql.Json.Microsoft/Design/Internal/MySqlJsonMicrosoftDesignTimeServices.cs b/src/EFCore.MySql.Json.Microsoft/Design/Internal/MySqlJsonMicrosoftDesignTimeServices.cs index 72593fa78..e5193d9ea 100644 --- a/src/EFCore.MySql.Json.Microsoft/Design/Internal/MySqlJsonMicrosoftDesignTimeServices.cs +++ b/src/EFCore.MySql.Json.Microsoft/Design/Internal/MySqlJsonMicrosoftDesignTimeServices.cs @@ -7,6 +7,8 @@ using Pomelo.EntityFrameworkCore.MySql.Json.Microsoft.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.Extensions.DependencyInjection; +using Pomelo.EntityFrameworkCore.MySql.Json.Microsoft.Infrastructure; +using Pomelo.EntityFrameworkCore.MySql.Json.Microsoft.Infrastructure.Internal; namespace Pomelo.EntityFrameworkCore.MySql.Json.Microsoft.Design.Internal { @@ -26,6 +28,7 @@ public class MySqlJsonMicrosoftDesignTimeServices : IDesignTimeServices /// public virtual void ConfigureDesignTimeServices(IServiceCollection serviceCollection) => serviceCollection + .AddSingleton() .AddSingleton() .AddSingleton(); } diff --git a/src/EFCore.MySql.Json.Microsoft/Extensions/MySqlJsonMicrosoftServiceCollectionExtensions.cs b/src/EFCore.MySql.Json.Microsoft/Extensions/MySqlJsonMicrosoftServiceCollectionExtensions.cs index 18f35e7d8..d94a4d283 100644 --- a/src/EFCore.MySql.Json.Microsoft/Extensions/MySqlJsonMicrosoftServiceCollectionExtensions.cs +++ b/src/EFCore.MySql.Json.Microsoft/Extensions/MySqlJsonMicrosoftServiceCollectionExtensions.cs @@ -8,6 +8,8 @@ using Pomelo.EntityFrameworkCore.MySql.Json.Microsoft.Storage.Internal; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Utilities; +using Pomelo.EntityFrameworkCore.MySql.Json.Microsoft.Infrastructure; +using Pomelo.EntityFrameworkCore.MySql.Json.Microsoft.Infrastructure.Internal; using Pomelo.EntityFrameworkCore.MySql.Query.ExpressionTranslators.Internal; // ReSharper disable once CheckNamespace @@ -33,7 +35,9 @@ public static IServiceCollection AddEntityFrameworkMySqlJsonMicrosoft( .TryAdd() .TryAdd() .TryAddProviderSpecificServices( - x => x.TryAddScopedEnumerable()); + x => x + .TryAddSingleton() + .TryAddScopedEnumerable()); return serviceCollection; }