Merge pull request #185 from sbwalker/master

resolve ihostedservice registration
This commit is contained in:
Shaun Walker 2020-01-10 11:08:37 -05:00 committed by GitHub
commit 0b9973501f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -42,7 +42,7 @@ namespace Oqtane.Controllers
[HttpGet("{id}")]
public Page Get(int id, string userid)
{
if (userid == "")
if (string.IsNullOrEmpty(userid))
{
return Pages.GetPage(id);
}

View File

@ -79,7 +79,7 @@ namespace Microsoft.Extensions.DependencyInjection
var serviceTypes = assembly.GetTypes(hostedServiceType);
foreach (var serviceType in serviceTypes)
{
if (serviceType.Name != nameof(HostedServiceBase))
if (serviceType.IsSubclassOf(typeof(HostedServiceBase)))
{
services.AddSingleton(hostedServiceType, serviceType);
}
@ -103,7 +103,11 @@ namespace Microsoft.Extensions.DependencyInjection
{
// load assembly from stream to prevent locking file ( as long as dependencies are in /bin they will load as well )
assembly = AssemblyLoadContext.Default.LoadFromStream(new MemoryStream(File.ReadAllBytes(file.FullName)));
_oqtaneModuleAssemblies.Add(assembly);
if (pattern == "Module")
{
// build a list of module assemblies
_oqtaneModuleAssemblies.Add(assembly);
}
}
}
}