diff --git a/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs b/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs index 58cb0a6b..02f9ef16 100644 --- a/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs +++ b/Oqtane.Server/Extensions/OqtaneServiceCollectionExtensions.cs @@ -297,24 +297,6 @@ namespace Microsoft.Extensions.DependencyInjection } } - // dynamically register module server transient services (using conventions) - implementationTypes = assembly.GetInterfaces(); - foreach (var implementationType in implementationTypes) - { - if (implementationType.AssemblyQualifiedName != 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,"); - var serviceType = Type.GetType(serviceName); - if (serviceType != null) - { - services.AddTransient(serviceType, implementationType); - } - } - } - // dynamically register module transient services (ie. server DBContext, repository classes) implementationTypes = assembly.GetInterfaces(); foreach (var implementationType in implementationTypes) @@ -322,6 +304,14 @@ 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/Services/HtmlTextService.cs b/Oqtane.Server/Modules/HtmlText/Services/HtmlTextService.cs index 9cbf4ed8..b3a15549 100644 --- a/Oqtane.Server/Modules/HtmlText/Services/HtmlTextService.cs +++ b/Oqtane.Server/Modules/HtmlText/Services/HtmlTextService.cs @@ -12,7 +12,7 @@ using Oqtane.Shared; namespace Oqtane.Modules.HtmlText.Services { [PrivateApi("Mark HtmlText classes as private, since it's not very useful in the public docs")] - public class ServerHtmlTextService : IHtmlTextService, IServerService + public class ServerHtmlTextService : IHtmlTextService, ITransientService { private readonly IHtmlTextRepository _htmlText; private readonly IUserPermissions _userPermissions; diff --git a/Oqtane.Shared/Interfaces/IServerService.cs b/Oqtane.Shared/Interfaces/IServerService.cs deleted file mode 100644 index d5d888fd..00000000 --- a/Oqtane.Shared/Interfaces/IServerService.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Oqtane.Modules -{ - /// - /// Empty interface used to decorate server module services for auto registration as scoped - /// - public interface IServerService - { - } -}