use IServerStartup rather than class naming convention to register server service class
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user