diff --git a/SlnMesnac.Ioc/DependencyConfigurator.cs b/SlnMesnac.Ioc/DependencyConfigurator.cs index 0a5c76c..ff2844f 100644 --- a/SlnMesnac.Ioc/DependencyConfigurator.cs +++ b/SlnMesnac.Ioc/DependencyConfigurator.cs @@ -72,7 +72,7 @@ namespace SlnMesnac.Ioc { //自动注入仓储层的接口实现类 var types = assembly.GetTypes() - .Where(t => t.IsClass && !t.IsAbstract && !t.IsGenericType) + .Where(t => t.IsClass && t is { IsAbstract: false, IsGenericType: false }) .ToList(); foreach (var type in types) @@ -125,7 +125,7 @@ namespace SlnMesnac.Ioc private static void RegisterTypeTransient(ContainerBuilder builder, Assembly assembly) { var types = assembly.GetTypes() - .Where(t => t.IsClass && !t.IsAbstract && !t.IsGenericType) + .Where(t => t.IsClass && t is { IsAbstract: false, IsGenericType: false }) .ToList(); foreach (var type in types)