diff --git a/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs b/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs index f3a04ed8..8f73661d 100644 --- a/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs +++ b/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs @@ -291,7 +291,7 @@ namespace Microsoft.Extensions.DependencyInjection { if (implementationType.AssemblyQualifiedName != null) { - var serviceType = Type.GetType(implementationType.AssemblyQualifiedName.Replace(implementationType.Name, $"I{implementationType.Name}")); var serviceName = implementationType.AssemblyQualifiedName.Replace(implementationType.Name, $"I{implementationType.Name}"); + var serviceType = Type.GetType(implementationType.AssemblyQualifiedName.Replace(implementationType.Name, $"I{implementationType.Name}")); services.AddScoped(serviceType ?? implementationType, implementationType); } } @@ -303,14 +303,6 @@ namespace Microsoft.Extensions.DependencyInjection if (implementationType.AssemblyQualifiedName != null) { var serviceType = Type.GetType(implementationType.AssemblyQualifiedName.Replace(implementationType.Name, $"I{implementationType.Name}")); - if (serviceType == null && implementationType.AssemblyQualifiedName.Contains("Services.Server")) - { - // module server services reference a common interface which is located in the client assembly - var serviceName = implementationType.AssemblyQualifiedName - // convert implementation type name to interface name and change Server assembly to Client - .Replace(".Services.Server", ".Services.I").Replace(".Server,", ".Client,"); - serviceType = Type.GetType(serviceName); - } services.AddTransient(serviceType ?? implementationType, implementationType); } } diff --git a/Oqtane.Server/Modules/HtmlText/Repository/HtmlTextDbContextFactory.cs b/Oqtane.Server/Modules/HtmlText/Startup/ServerStartup.cs similarity index 70% rename from Oqtane.Server/Modules/HtmlText/Repository/HtmlTextDbContextFactory.cs rename to Oqtane.Server/Modules/HtmlText/Startup/ServerStartup.cs index 88eebf06..ca3ef2e6 100644 --- a/Oqtane.Server/Modules/HtmlText/Repository/HtmlTextDbContextFactory.cs +++ b/Oqtane.Server/Modules/HtmlText/Startup/ServerStartup.cs @@ -2,10 +2,12 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Oqtane.Infrastructure; +using Oqtane.Modules.HtmlText.Repository; +using Oqtane.Modules.HtmlText.Services; -namespace Oqtane.Modules.HtmlText.Repository +namespace Oqtane.Modules.HtmlText.Startup { - public class HtmlTextDbContextFactory : IServerStartup + public class ServerStartup : IServerStartup { public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { @@ -19,6 +21,7 @@ namespace Oqtane.Modules.HtmlText.Repository public void ConfigureServices(IServiceCollection services) { + services.AddTransient(); services.AddDbContextFactory(opt => { }, ServiceLifetime.Transient); } }