Add null checks
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.ApplicationParts;
|
||||
|
||||
@ -8,6 +9,11 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
{
|
||||
public static IMvcBuilder AddOqtaneApplicationParts(this IMvcBuilder mvcBuilder)
|
||||
{
|
||||
if (mvcBuilder is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(mvcBuilder));
|
||||
}
|
||||
|
||||
// load MVC application parts from module assemblies
|
||||
foreach (var assembly in OqtaneServiceCollectionExtensions.GetOqtaneModuleAssemblies())
|
||||
{
|
||||
|
@ -20,6 +20,11 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
|
||||
public static IServiceCollection AddOqtaneModules(this IServiceCollection services)
|
||||
{
|
||||
if (services is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(services));
|
||||
}
|
||||
|
||||
LoadAssemblies("Module");
|
||||
|
||||
return services;
|
||||
@ -27,6 +32,11 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
|
||||
public static IServiceCollection AddOqtaneThemes(this IServiceCollection services)
|
||||
{
|
||||
if (services is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(services));
|
||||
}
|
||||
|
||||
LoadAssemblies("Theme");
|
||||
|
||||
return services;
|
||||
@ -34,6 +44,11 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
|
||||
public static IServiceCollection AddOqtaneServices(this IServiceCollection services)
|
||||
{
|
||||
if (services is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(services));
|
||||
}
|
||||
|
||||
// dynamically register module services, contexts, and repository classes
|
||||
var assemblies = Assemblies.
|
||||
Where(item => item.FullName.StartsWith("Oqtane.") || item.FullName.Contains(".Module.")).ToArray();
|
||||
@ -52,6 +67,11 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
|
||||
public static IServiceCollection AddOqtaneHostedServices(this IServiceCollection services)
|
||||
{
|
||||
if (services is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(services));
|
||||
}
|
||||
|
||||
// dynamically register hosted services
|
||||
var hostedServiceType = typeof(IHostedService);
|
||||
foreach (var assembly in Assemblies)
|
||||
|
Reference in New Issue
Block a user