Add ServiceManager support for parent manager (#16)

Prepare integration project
This commit is contained in:
2022-09-09 11:53:35 +02:00
committed by GitHub
parent a9ca960106
commit 820b1c9c2e
51 changed files with 2445 additions and 2231 deletions
+166
View File
@@ -0,0 +1,166 @@
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
###############################
# Core EditorConfig Options #
###############################
# All files
[*]
indent_style = space
# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom
###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = true
# this. preferences
dotnet_style_qualification_for_field = true:error
dotnet_style_qualification_for_property = true:error
dotnet_style_qualification_for_method = true:error
dotnet_style_qualification_for_event = true:error
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
###############################
# Naming Conventions #
###############################
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
end_of_line = crlf
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
dotnet_style_allow_statement_immediately_after_block_experimental = false:suggestion
dotnet_code_quality_unused_parameters = all:error
###############################
# C# Coding Conventions #
###############################
[*.cs]
# var preferences
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent
# Expression-bodied members
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Expression-level preferences
csharp_prefer_braces = true:silent
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
###############################
# C# Formatting Rules #
###############################
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
csharp_using_directive_placement = outside_namespace:error
csharp_prefer_simple_using_statement = true:error
csharp_style_namespace_declarations = file_scoped:error
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_indent_braces = false
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:error
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:error
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_prefer_static_local_function = true:suggestion
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:suggestion
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
csharp_style_prefer_parameter_null_checking = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
###############################
# VB Coding Conventions #
###############################
[*.vb]
# Modifier preferences
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
+25
View File
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<LangVersion>latest</LangVersion>
<Authors>Alexandru Macocian</Authors>
<Company />
<Product></Product>
<Description>Integration with Microsoft.DependencyInjection library.</Description>
<AssemblyVersion>1.0.0</AssemblyVersion>
<FileVersion>1.0.0</FileVersion>
<PackageProjectUrl>https://github.com/AlexMacocian/Slim</PackageProjectUrl>
<Version>1.0.0</Version>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Slim" Version="1.8.1" />
</ItemGroup>
</Project>
+30 -31
View File
@@ -4,42 +4,41 @@ using Slim.Tests.Models;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Slim.Tests namespace Slim.Tests;
[TestClass]
public sealed class MemoryLeakTests
{ {
[TestClass] private const int ScopesCount = 10000;
public sealed class MemoryLeakTests
[TestMethod]
public async Task CreateAndReleaseScopesDisposeManagerGCCollects()
{ {
private const int ScopesCount = 10000; var di = new ServiceManager();
di.RegisterSingleton<IIndependentService, IndependentService>();
di.RegisterScoped<IDependentService, DependentService>();
var independentService = di.GetService<IIndependentService>();
var dependentService = di.GetService<IDependentService>();
[TestMethod] var weakRefs = new WeakReference[ScopesCount];
public async Task CreateAndReleaseScopesDisposeManagerGCCollects() for (int i = 0; i < ScopesCount; i++)
{ {
var di = new ServiceManager(); var scopedDi = di.CreateScope();
di.RegisterSingleton<IIndependentService, IndependentService>(); weakRefs[i] = new WeakReference(scopedDi);
di.RegisterScoped<IDependentService, DependentService>(); var scopedDependentService = scopedDi.GetService<IDependentService>();
var independentService = di.GetService<IIndependentService>(); scopedDependentService.Should().NotBeNull();
var dependentService = di.GetService<IDependentService>(); scopedDependentService.Should().NotBe(dependentService);
scopedDependentService.IndependentService.Should().NotBeNull();
scopedDependentService.IndependentService.Should().Be(independentService);
}
var weakRefs = new WeakReference[ScopesCount]; await Task.Delay(1500);
for (int i = 0; i < ScopesCount; i++) GC.Collect();
{ GC.WaitForPendingFinalizers();
var scopedDi = di.CreateScope(); GC.Collect();
weakRefs[i] = new WeakReference(scopedDi); foreach (var weakRef in weakRefs)
var scopedDependentService = scopedDi.GetService<IDependentService>(); {
scopedDependentService.Should().NotBeNull(); weakRef.IsAlive.Should().BeFalse();
scopedDependentService.Should().NotBe(dependentService);
scopedDependentService.IndependentService.Should().NotBeNull();
scopedDependentService.IndependentService.Should().Be(independentService);
}
await Task.Delay(1500);
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
foreach(var weakRef in weakRefs)
{
weakRef.IsAlive.Should().BeFalse();
}
} }
} }
} }
@@ -1,13 +1,12 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
{
public sealed class DependentOnPrivateCtrService : IDependentOnPrivateCtrService
{
private readonly IPrivateConstructorService privateConstructorService;
public DependentOnPrivateCtrService( public sealed class DependentOnPrivateCtrService : IDependentOnPrivateCtrService
IPrivateConstructorService privateConstructorService) {
{ private readonly IPrivateConstructorService privateConstructorService;
this.privateConstructorService = privateConstructorService;
} public DependentOnPrivateCtrService(
IPrivateConstructorService privateConstructorService)
{
this.privateConstructorService = privateConstructorService;
} }
} }
@@ -1,19 +1,18 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
{
public class DependentOnServiceManagerService : IDependentOnServiceManagerService
{
public IServiceManager ServiceManager { get; }
public IServiceProducer ServiceProducer { get; }
public IServiceProvider ServiceProvider { get; }
public DependentOnServiceManagerService( public class DependentOnServiceManagerService : IDependentOnServiceManagerService
IServiceManager serviceManager, {
IServiceProvider serviceProvider, public IServiceManager ServiceManager { get; }
IServiceProducer serviceProducer) public IServiceProducer ServiceProducer { get; }
{ public IServiceProvider ServiceProvider { get; }
this.ServiceManager = serviceManager;
this.ServiceProvider = serviceProvider; public DependentOnServiceManagerService(
this.ServiceProducer = serviceProducer; IServiceManager serviceManager,
} IServiceProvider serviceProvider,
IServiceProducer serviceProducer)
{
this.ServiceManager = serviceManager;
this.ServiceProvider = serviceProvider;
this.ServiceProducer = serviceProducer;
} }
} }
@@ -1,12 +1,11 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
{
public sealed class DependentOnThrowingService : IDependentOnThrowingService
{
private readonly IThrowingService throwingService;
public DependentOnThrowingService(IThrowingService throwingService) public sealed class DependentOnThrowingService : IDependentOnThrowingService
{ {
this.throwingService = throwingService; private readonly IThrowingService throwingService;
}
public DependentOnThrowingService(IThrowingService throwingService)
{
this.throwingService = throwingService;
} }
} }
+8 -9
View File
@@ -1,12 +1,11 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
{
public class DependentService : IDependentService
{
public DependentService(IIndependentService independentService)
{
this.IndependentService = independentService;
}
public IIndependentService IndependentService { get; } public class DependentService : IDependentService
{
public DependentService(IIndependentService independentService)
{
this.IndependentService = independentService;
} }
public IIndependentService IndependentService { get; }
} }
+8 -9
View File
@@ -1,12 +1,11 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
{
public sealed class DependentService2 : IDependentService2
{
public IndependentService IndependentService { get; }
public DependentService2(IndependentService independentService) public sealed class DependentService2 : IDependentService2
{ {
this.IndependentService = independentService; public IndependentService IndependentService { get; }
}
public DependentService2(IndependentService independentService)
{
this.IndependentService = independentService;
} }
} }
@@ -1,12 +1,11 @@
using Slim.Attributes; using Slim.Attributes;
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public sealed class DoNotInjectConstructorService
{ {
public sealed class DoNotInjectConstructorService [DoNotInject]
public DoNotInjectConstructorService()
{ {
[DoNotInject]
public DoNotInjectConstructorService()
{
}
} }
} }
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface IDependentOnPrivateCtrService
{ {
public interface IDependentOnPrivateCtrService
{
}
} }
@@ -1,9 +1,8 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface IDependentOnServiceManagerService
{ {
public interface IDependentOnServiceManagerService IServiceManager ServiceManager { get; }
{ IServiceProducer ServiceProducer { get; }
IServiceManager ServiceManager { get; } IServiceProvider ServiceProvider { get; }
IServiceProducer ServiceProducer { get; }
IServiceProvider ServiceProvider { get; }
}
} }
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface IDependentOnThrowingService
{ {
public interface IDependentOnThrowingService
{
}
} }
+4 -5
View File
@@ -1,7 +1,6 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface IDependentService
{ {
public interface IDependentService IIndependentService IndependentService { get; }
{
IIndependentService IndependentService { get; }
}
} }
+4 -5
View File
@@ -1,7 +1,6 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface IDependentService2
{ {
public interface IDependentService2 public IndependentService IndependentService { get; }
{
public IndependentService IndependentService { get; }
}
} }
+8 -9
View File
@@ -1,12 +1,11 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
{
public class IDisposableService : IIDisposableService
{
public bool DisposeCalled { get; set; }
public void Dispose() public class IDisposableService : IIDisposableService
{ {
this.DisposeCalled = true; public bool DisposeCalled { get; set; }
}
public void Dispose()
{
this.DisposeCalled = true;
} }
} }
@@ -1,12 +1,11 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
{
public sealed class IDisposableSingletonService : IIDisposableService
{
public bool DisposeCalled { get; set; }
public void Dispose() public sealed class IDisposableSingletonService : IIDisposableService
{ {
this.DisposeCalled = true; public bool DisposeCalled { get; set; }
}
public void Dispose()
{
this.DisposeCalled = true;
} }
} }
+4 -5
View File
@@ -1,9 +1,8 @@
using System; using System;
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface IIDisposableService : IDisposable
{ {
public interface IIDisposableService : IDisposable bool DisposeCalled { get; set; }
{
bool DisposeCalled { get; set; }
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface IIndependentService
{ {
public interface IIndependentService
{
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface IMultiInterfaceService1
{ {
public interface IMultiInterfaceService1
{
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface IMultiInterfaceService2
{ {
public interface IMultiInterfaceService2
{
}
} }
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface IPrivateConstructorService
{ {
public interface IPrivateConstructorService
{
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface ISharedInterface
{ {
public interface ISharedInterface
{
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface ISharedService1 : ISharedInterface
{ {
public interface ISharedService1 : ISharedInterface
{
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface ISharedService2 : ISharedInterface
{ {
public interface ISharedService2 : ISharedInterface
{
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface ISharedService3 : ISharedInterface
{ {
public interface ISharedService3 : ISharedInterface
{
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public interface IThrowingService
{ {
public interface IThrowingService
{
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public class IndependentService : IIndependentService
{ {
public class IndependentService : IIndependentService
{
}
} }
+16 -10
View File
@@ -1,13 +1,19 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
{
public class MultiConstructorService : IIndependentService
{
public MultiConstructorService(int x, int y, object z)
{
}
public MultiConstructorService() public class MultiConstructorService : IIndependentService
{ {
} public int X { get; }
public int Y { get; }
public object Z { get; }
public MultiConstructorService(int x, int y, object z)
{
this.X = x;
this.Y = y;
this.Z = z;
}
public MultiConstructorService()
{
} }
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public class MultiInterfaceService : IMultiInterfaceService1, IMultiInterfaceService2
{ {
public class MultiInterfaceService : IMultiInterfaceService1, IMultiInterfaceService2
{
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public class NoInterfaceService
{ {
public class NoInterfaceService
{
}
} }
@@ -1,9 +1,8 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public sealed class PrivateConstructorService : IPrivateConstructorService
{ {
public sealed class PrivateConstructorService : IPrivateConstructorService private PrivateConstructorService()
{ {
private PrivateConstructorService()
{
}
} }
} }
@@ -1,33 +1,38 @@
using Slim.Attributes; using Slim.Attributes;
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public sealed class ServiceWithPrefferedConstructor
{ {
public sealed class ServiceWithPrefferedConstructor public bool CalledPrefferedConstructor { get; init; }
public bool CalledPrefferedConstructor0 { get; init; }
public bool CalledPrefferedConstructor1 { get; init; }
public IIndependentService IndependentService { get; }
public IDependentService DependentService { get; }
public IDependentService2 DependentService2 { get; }
public ServiceWithPrefferedConstructor()
{ {
public bool CalledPrefferedConstructor { get; init; } }
public bool CalledPrefferedConstructor0 { get; init; }
public bool CalledPrefferedConstructor1 { get; init; }
public ServiceWithPrefferedConstructor() [PreferredConstructor]
{ public ServiceWithPrefferedConstructor(IIndependentService independentService)
} {
this.CalledPrefferedConstructor = true;
this.IndependentService = independentService;
}
[PreferredConstructor] [PreferredConstructor(Priority = 0)]
public ServiceWithPrefferedConstructor(IIndependentService independentService) public ServiceWithPrefferedConstructor(IDependentService dependentService)
{ {
this.CalledPrefferedConstructor = true; this.CalledPrefferedConstructor0 = true;
} this.DependentService = dependentService;
}
[PreferredConstructor(Priority = 0)] [PreferredConstructor(Priority = 1)]
public ServiceWithPrefferedConstructor(IDependentService dependentService) public ServiceWithPrefferedConstructor(IDependentService2 dependentService2)
{ {
this.CalledPrefferedConstructor0 = true; this.CalledPrefferedConstructor1 = true;
} this.DependentService2 = dependentService2;
[PreferredConstructor(Priority = 1)]
public ServiceWithPrefferedConstructor(IDependentService2 dependentService2)
{
this.CalledPrefferedConstructor1 = true;
}
} }
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public sealed class SharedService1 : ISharedService1
{ {
public sealed class SharedService1 : ISharedService1
{
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public sealed class SharedService2 : ISharedService2
{ {
public sealed class SharedService2 : ISharedService2
{
}
} }
+3 -4
View File
@@ -1,6 +1,5 @@
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public sealed class SharedService3 : ISharedService3
{ {
public sealed class SharedService3 : ISharedService3
{
}
} }
+5 -6
View File
@@ -1,12 +1,11 @@
using System; using System;
namespace Slim.Tests.Models namespace Slim.Tests.Models;
public sealed class ThrowingService : IThrowingService
{ {
public sealed class ThrowingService : IThrowingService public ThrowingService()
{ {
public ThrowingService() throw new InvalidOperationException();
{
throw new InvalidOperationException();
}
} }
} }
@@ -2,24 +2,23 @@
using Slim.Tests.Models; using Slim.Tests.Models;
using System; using System;
namespace Slim.Tests.Resolvers namespace Slim.Tests.Resolvers;
public sealed class DependentServiceResolver : IDependencyResolver
{ {
public sealed class DependentServiceResolver : IDependencyResolver public bool CanResolve(Type type)
{ {
public bool CanResolve(Type type) if (type == typeof(IDependentService))
{ {
if (type == typeof(IDependentService)) return true;
{
return true;
}
return false;
} }
public object Resolve(IServiceProvider serviceProvider, Type type) return false;
{ }
var independentService = serviceProvider.GetService<IIndependentService>();
return new DependentService(independentService); public object Resolve(IServiceProvider serviceProvider, Type type)
} {
var independentService = serviceProvider.GetService<IIndependentService>();
return new DependentService(independentService);
} }
} }
@@ -2,26 +2,25 @@
using Slim.Tests.Models; using Slim.Tests.Models;
using System; using System;
namespace Slim.Tests.Resolvers namespace Slim.Tests.Resolvers;
public class IndependentServiceResolver : IDependencyResolver
{ {
public class IndependentServiceResolver : IDependencyResolver public int Called { get; private set; }
public bool CanResolve(Type type)
{ {
public int Called { get; private set; } if (type == typeof(IIndependentService))
public bool CanResolve(Type type)
{ {
if (type == typeof(IIndependentService)) return true;
{
return true;
}
return false;
} }
public object Resolve(IServiceProvider serviceProvider, Type type) return false;
{ }
this.Called++;
return new IndependentService(); public object Resolve(IServiceProvider serviceProvider, Type type)
} {
this.Called++;
return new IndependentService();
} }
} }
File diff suppressed because it is too large Load Diff
+11
View File
@@ -16,6 +16,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Pipelines", "Pipelines", "{
.github\workflows\ci.yaml = .github\workflows\ci.yaml .github\workflows\ci.yaml = .github\workflows\ci.yaml
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Slim.Integration", "Slim.Integration\Slim.Integration.csproj", "{13975492-5299-4589-91C1-C33E4FCEDD72}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D20E2AFD-6BE0-4CCC-AD87-D2961CD1763B}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -30,6 +37,10 @@ Global
{F03F7353-0BD5-4691-A318-BC6FC93AB00E}.Debug|Any CPU.Build.0 = Debug|Any CPU {F03F7353-0BD5-4691-A318-BC6FC93AB00E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F03F7353-0BD5-4691-A318-BC6FC93AB00E}.Release|Any CPU.ActiveCfg = Release|Any CPU {F03F7353-0BD5-4691-A318-BC6FC93AB00E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F03F7353-0BD5-4691-A318-BC6FC93AB00E}.Release|Any CPU.Build.0 = Release|Any CPU {F03F7353-0BD5-4691-A318-BC6FC93AB00E}.Release|Any CPU.Build.0 = Release|Any CPU
{13975492-5299-4589-91C1-C33E4FCEDD72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13975492-5299-4589-91C1-C33E4FCEDD72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13975492-5299-4589-91C1-C33E4FCEDD72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13975492-5299-4589-91C1-C33E4FCEDD72}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
+7 -8
View File
@@ -1,12 +1,11 @@
using System; using System;
namespace Slim.Attributes namespace Slim.Attributes;
/// <summary>
/// Attribute used to mark constructors to not be used by the <see cref="ServiceManager"/>.
/// </summary>
[AttributeUsage(AttributeTargets.Constructor)]
public sealed class DoNotInjectAttribute : Attribute
{ {
/// <summary>
/// Attribute used to mark constructors to not be used by the <see cref="ServiceManager"/>.
/// </summary>
[AttributeUsage(AttributeTargets.Constructor)]
public sealed class DoNotInjectAttribute : Attribute
{
}
} }
@@ -1,23 +1,22 @@
using System; using System;
namespace Slim.Attributes namespace Slim.Attributes;
/// <summary>
/// Attribute used to mark constructors to be used with priority by the <see cref="ServiceManager"/>.
/// </summary>
[AttributeUsage(AttributeTargets.Constructor)]
public sealed class PreferredConstructorAttribute : Attribute
{ {
/// <summary> /// <summary>
/// Attribute used to mark constructors to be used with priority by the <see cref="ServiceManager"/>. /// Priority of the constructor. Constructors are ordered using this value when present.
/// </summary> /// </summary>
[AttributeUsage(AttributeTargets.Constructor)] public int Priority { get; set; } = int.MaxValue - 1;
public sealed class PreferredConstructorAttribute : Attribute
{
/// <summary>
/// Priority of the constructor. Constructors are ordered using this value when present.
/// </summary>
public int Priority { get; set; } = int.MaxValue - 1;
/// <summary> /// <summary>
/// Creates a new instance of <see cref="PreferredConstructorAttribute"/>. /// Creates a new instance of <see cref="PreferredConstructorAttribute"/>.
/// </summary> /// </summary>
public PreferredConstructorAttribute() public PreferredConstructorAttribute()
{ {
}
} }
} }
+31 -32
View File
@@ -1,44 +1,43 @@
using System; using System;
using System.Runtime.Serialization; using System.Runtime.Serialization;
namespace Slim.Exceptions namespace Slim.Exceptions;
/// <summary>
/// Exception thrown when <see cref="IServiceManager"/> fails to create a service.
/// </summary>
public class DependencyInjectionException : Exception
{ {
/// <summary> /// <summary>
/// Exception thrown when <see cref="IServiceManager"/> fails to create a service. /// Creates a new instance of <see cref="DependencyInjectionException"/>.
/// </summary> /// </summary>
public class DependencyInjectionException : Exception public DependencyInjectionException()
{ {
/// <summary> }
/// Creates a new instance of <see cref="DependencyInjectionException"/>.
/// </summary>
public DependencyInjectionException()
{
}
/// <summary> /// <summary>
/// Creates a new instance of <see cref="DependencyInjectionException"/>. /// Creates a new instance of <see cref="DependencyInjectionException"/>.
/// </summary> /// </summary>
/// <param name="message">Message of the exception.</param> /// <param name="message">Message of the exception.</param>
public DependencyInjectionException(string message) : base(message) public DependencyInjectionException(string message) : base(message)
{ {
} }
/// <summary> /// <summary>
/// Creates a new instance of <see cref="DependencyInjectionException"/>. /// Creates a new instance of <see cref="DependencyInjectionException"/>.
/// </summary> /// </summary>
/// <param name="message">Message of the exception.</param> /// <param name="message">Message of the exception.</param>
/// <param name="innerException">Inner exception.</param> /// <param name="innerException">Inner exception.</param>
public DependencyInjectionException(string message, Exception innerException) : base(message, innerException) public DependencyInjectionException(string message, Exception innerException) : base(message, innerException)
{ {
} }
/// <summary> /// <summary>
/// Creates a new instance of <see cref="DependencyInjectionException"/>. /// Creates a new instance of <see cref="DependencyInjectionException"/>.
/// </summary> /// </summary>
/// <param name="info">Serialization info.</param> /// <param name="info">Serialization info.</param>
/// <param name="context">Streaming context.</param> /// <param name="context">Streaming context.</param>
protected DependencyInjectionException(SerializationInfo info, StreamingContext context) : base(info, context) protected DependencyInjectionException(SerializationInfo info, StreamingContext context) : base(info, context)
{ {
}
} }
} }
+36 -33
View File
@@ -1,40 +1,43 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Slim namespace Slim;
/// <summary>
/// Interface for <see cref="ServiceManager"/>.
/// </summary>
public interface IServiceManager : IServiceProvider, IServiceProducer
{ {
/// <summary> /// <summary>
/// Interface for <see cref="ServiceManager"/>. /// Gets the <see cref="IServiceManager"/> that created the current <see cref="IServiceManager"/>. Returns null in case there is no parent.
/// </summary> /// </summary>
public interface IServiceManager : IServiceProvider, IServiceProducer IServiceManager ParentServiceManager { get; }
{ /// <summary>
/// <summary> /// Allow modifications to scoped <see cref="IServiceManager"/> created from this <see cref="IServiceManager"/>.
/// Allow modifications to scoped <see cref="IServiceManager"/> created from this <see cref="IServiceManager"/>. /// </summary>
/// </summary> bool AllowScopedManagerModifications { get; set; }
bool AllowScopedManagerModifications { get; set; } /// <summary>
/// <summary> /// Returns true if <see cref="IServiceManager"/> is readonly.
/// Returns true if <see cref="IServiceManager"/> is readonly. /// </summary>
/// </summary> bool IsReadOnly { get; }
bool IsReadOnly { get; } /// <summary>
/// <summary> /// Builds all registered singletons.
/// Builds all registered singletons. /// </summary>
/// </summary> void BuildSingletons();
void BuildSingletons(); /// <summary>
/// <summary> /// Marks a type of exception to be caught and handled.
/// Marks a type of exception to be caught and handled. /// </summary>
/// </summary> /// <typeparam name="T">Type of exception to catch.</typeparam>
/// <typeparam name="T">Type of exception to catch.</typeparam> /// <param name="handle">Handler of the exception. Handler returns true if the exception should be thrown again.</param>
/// <param name="handle">Handler of the exception. Handler returns true if the exception should be thrown again.</param> /// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentNullException"></exception> void HandleException<T>(Func<IServiceProvider, T, bool> handle)
void HandleException<T>(Func<IServiceProvider, T, bool> handle) where T : Exception;
where T : Exception; /// <summary>
/// <summary> /// Clears all registered types, singletons, factories and exception handlers.
/// Clears all registered types, singletons, factories and exception handlers. /// </summary>
/// </summary> /// <remarks>
/// <remarks> /// Calls <see cref="IDisposable.Dispose"/> on all <see cref="IDisposable"/> singletons.
/// Calls <see cref="IDisposable.Dispose"/> on all <see cref="IDisposable"/> singletons. /// </remarks>
/// </remarks> void Clear();
void Clear();
}
} }
+248 -249
View File
@@ -1,256 +1,255 @@
using Slim.Resolvers; using Slim.Resolvers;
using System; using System;
namespace Slim namespace Slim;
/// <summary>
/// Interface allowing to produce services for the <see cref="ServiceManager"/>.
/// </summary>
public interface IServiceProducer
{ {
/// <summary> /// <summary>
/// Interface allowing to produce services for the <see cref="ServiceManager"/>. /// Register the current service manager as a valid dependency.
/// </summary> /// </summary>
public interface IServiceProducer /// <remarks>Registers current service manager as <see cref="ServiceManager"/>, <see cref="IServiceManager"/>, <see cref="IServiceProducer"/>, <see cref="IServiceProvider"/>.</remarks>
{ void RegisterServiceManager();
/// <summary> /// <summary>
/// Register the current service manager as a valid dependency. /// Returns true if there exists a registration for <paramref name="tInterface"/>.
/// </summary> /// </summary>
/// <remarks>Registers current service manager as <see cref="ServiceManager"/>, <see cref="IServiceManager"/>, <see cref="IServiceProducer"/>, <see cref="IServiceProvider"/>.</remarks> /// <param name="tInterface">Type of registered service.</param>
void RegisterServiceManager(); /// <returns>True if service <paramref name="tInterface"/> is registered. Otherwise returns false.</returns>
/// <summary> bool IsRegistered(Type tInterface);
/// Returns true if there exists a registration for <paramref name="tInterface"/>. /// <summary>
/// </summary> /// Returns true if there exists a registration for <typeparamref name="T"/>.
/// <param name="tInterface">Type of registered service.</param> /// </summary>
/// <returns>True if service <paramref name="tInterface"/> is registered. Otherwise returns false.</returns> /// <typeparam name="T">Type of registered service.</typeparam>
bool IsRegistered(Type tInterface); /// <returns>True if service <typeparamref name="T"/> is registered. Otherwise returns false.</returns>
/// <summary> bool IsRegistered<T>();
/// Returns true if there exists a registration for <typeparamref name="T"/>. /// <summary>
/// </summary> /// Register a resolver that manually resolves dependencies.
/// <typeparam name="T">Type of registered service.</typeparam> /// </summary>
/// <returns>True if service <typeparamref name="T"/> is registered. Otherwise returns false.</returns> /// <param name="dependencyResolver">Resolver that manually creates a dependency.</param>
bool IsRegistered<T>(); void RegisterResolver(IDependencyResolver dependencyResolver);
/// <summary> /// <summary>
/// Register a resolver that manually resolves dependencies. /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>.
/// </summary> /// Registers the service for all interfaces it implements.
/// <param name="dependencyResolver">Resolver that manually creates a dependency.</param> /// </summary>
void RegisterResolver(IDependencyResolver dependencyResolver); /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// <summary> /// <typeparam name="TClass">Type of implementation.</typeparam>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>. /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Registers the service for all interfaces it implements. void RegisterSingleton<TClass>(bool registerAllInterfaces = false)
/// </summary> where TClass : class;
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> /// <summary>
/// <typeparam name="TClass">Type of implementation.</typeparam> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// Registers the service for all interfaces it implements.
void RegisterSingleton<TClass>(bool registerAllInterfaces = false) /// </summary>
where TClass : class; /// <typeparam name="TClass">Type of implementation.</typeparam>
/// <summary> /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>. /// <param name="serviceFactory">Factory for the implementation.</param>
/// Registers the service for all interfaces it implements. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <typeparam name="TClass">Type of implementation.</typeparam> void RegisterSingleton<TClass>(Func<IServiceProvider, TClass> serviceFactory, bool registerAllInterfaces = false)
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> where TClass : class;
/// <param name="serviceFactory">Factory for the implementation.</param> /// <summary>
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// Registers the service for all interfaces it implements.
void RegisterSingleton<TClass>(Func<IServiceProvider, TClass> serviceFactory, bool registerAllInterfaces = false) /// </summary>
where TClass : class; /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// <summary> /// <typeparam name="TClass">Type of implementation.</typeparam>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>. /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Registers the service for all interfaces it implements. void RegisterTransient<TClass>(bool registerAllInterfaces = false)
/// </summary> where TClass : class;
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> /// <summary>
/// <typeparam name="TClass">Type of implementation.</typeparam> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// Registers the service for all interfaces it implements.
void RegisterTransient<TClass>(bool registerAllInterfaces = false) /// </summary>
where TClass : class; /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// <summary> /// <typeparam name="TClass">Type of implementation.</typeparam>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>. /// <param name="serviceFactory">Factory for the implementation.</param>
/// Registers the service for all interfaces it implements. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> void RegisterTransient<TClass>(Func<IServiceProvider, TClass> serviceFactory, bool registerAllInterfaces = false)
/// <typeparam name="TClass">Type of implementation.</typeparam> where TClass : class;
/// <param name="serviceFactory">Factory for the implementation.</param> /// <summary>
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// Registers the service for all interfaces it implements.
void RegisterTransient<TClass>(Func<IServiceProvider, TClass> serviceFactory, bool registerAllInterfaces = false) /// </summary>
where TClass : class; /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// <summary> /// <typeparam name="TClass">Type of implementation.</typeparam>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>. /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Registers the service for all interfaces it implements. void RegisterScoped<TClass>(bool registerAllInterfaces = false)
/// </summary> where TClass : class;
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> /// <summary>
/// <typeparam name="TClass">Type of implementation.</typeparam> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// Registers the service for all interfaces it implements.
void RegisterScoped<TClass>(bool registerAllInterfaces = false) /// </summary>
where TClass : class; /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// <summary> /// <typeparam name="TClass">Type of implementation.</typeparam>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>. /// <param name="serviceFactory">Factory for the implementation.</param>
/// Registers the service for all interfaces it implements. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> void RegisterScoped<TClass>(Func<IServiceProvider, TClass> serviceFactory, bool registerAllInterfaces = false)
/// <typeparam name="TClass">Type of implementation.</typeparam> where TClass : class;
/// <param name="serviceFactory">Factory for the implementation.</param> /// <summary>
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// </summary>
void RegisterScoped<TClass>(Func<IServiceProvider, TClass> serviceFactory, bool registerAllInterfaces = false) /// <typeparam name="TInterface">Type of interface.</typeparam>
where TClass : class; /// <typeparam name="TClass">Type of implementation.</typeparam>
/// <summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>. void RegisterTransient<TInterface, TClass>()
/// </summary> where TInterface : class
/// <typeparam name="TInterface">Type of interface.</typeparam> where TClass : TInterface;
/// <typeparam name="TClass">Type of implementation.</typeparam> /// <summary>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>.
void RegisterTransient<TInterface, TClass>() /// </summary>
where TInterface : class /// <typeparam name="TInterface">Type of interface.</typeparam>
where TClass : TInterface; /// <typeparam name="TClass">Type of implementation.</typeparam>
/// <summary> /// <param name="serviceFactory">Factory for the implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <typeparam name="TInterface">Type of interface.</typeparam> void RegisterTransient<TInterface, TClass>(Func<IServiceProvider, TClass> serviceFactory)
/// <typeparam name="TClass">Type of implementation.</typeparam> where TInterface : class
/// <param name="serviceFactory">Factory for the implementation.</param> where TClass : TInterface;
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception> /// <summary>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>.
void RegisterTransient<TInterface, TClass>(Func<IServiceProvider, TClass> serviceFactory) /// </summary>
where TInterface : class /// <typeparam name="TInterface">Type of interface.</typeparam>
where TClass : TInterface; /// <typeparam name="TClass">Type of implementation.</typeparam>
/// <summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>. void RegisterSingleton<TInterface, TClass>()
/// </summary> where TInterface : class
/// <typeparam name="TInterface">Type of interface.</typeparam> where TClass : TInterface;
/// <typeparam name="TClass">Type of implementation.</typeparam> /// <summary>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>.
void RegisterSingleton<TInterface, TClass>() /// </summary>
where TInterface : class /// <typeparam name="TInterface">Type of interface.</typeparam>
where TClass : TInterface; /// <typeparam name="TClass">Type of implementation.</typeparam>
/// <summary> /// <param name="serviceFactory">Factory for implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <typeparam name="TInterface">Type of interface.</typeparam> void RegisterSingleton<TInterface, TClass>(Func<IServiceProvider, TClass> serviceFactory)
/// <typeparam name="TClass">Type of implementation.</typeparam> where TInterface : class
/// <param name="serviceFactory">Factory for implementation.</param> where TClass : TInterface;
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception> /// <summary>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>.
void RegisterSingleton<TInterface, TClass>(Func<IServiceProvider, TClass> serviceFactory) /// </summary>
where TInterface : class /// <typeparam name="TInterface">Type of interface.</typeparam>
where TClass : TInterface; /// <typeparam name="TClass">Type of implementation.</typeparam>
/// <summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>. void RegisterScoped<TInterface, TClass>()
/// </summary> where TInterface : class
/// <typeparam name="TInterface">Type of interface.</typeparam> where TClass : TInterface;
/// <typeparam name="TClass">Type of implementation.</typeparam> /// <summary>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>.
void RegisterScoped<TInterface, TClass>() /// </summary>
where TInterface : class /// <typeparam name="TInterface">Type of interface.</typeparam>
where TClass : TInterface; /// <typeparam name="TClass">Type of implementation.</typeparam>
/// <summary> /// <param name="serviceFactory">Factory for the implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <typeparam name="TInterface">Type of interface.</typeparam> void RegisterScoped<TInterface, TClass>(Func<IServiceProvider, TClass> serviceFactory)
/// <typeparam name="TClass">Type of implementation.</typeparam> where TInterface : class
/// <param name="serviceFactory">Factory for the implementation.</param> where TClass : TInterface;
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception> /// <summary>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>.
void RegisterScoped<TInterface, TClass>(Func<IServiceProvider, TClass> serviceFactory) /// </summary>
where TInterface : class /// <param name="tInterface">Type of interface.</param>
where TClass : TInterface; /// <param name="tClass">Type of implementation.</param>
/// <summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>. void RegisterTransient(Type tInterface, Type tClass);
/// </summary> /// <summary>
/// <param name="tInterface">Type of interface.</param> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>.
/// <param name="tClass">Type of implementation.</param> /// </summary>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// <param name="tInterface">Type of interface.</param>
void RegisterTransient(Type tInterface, Type tClass); /// <param name="tClass">Type of implementation.</param>
/// <summary> /// <param name="serviceFactory">Factory for implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <param name="tInterface">Type of interface.</param> void RegisterTransient(Type tInterface, Type tClass, Func<IServiceProvider, object> serviceFactory);
/// <param name="tClass">Type of implementation.</param> /// <summary>
/// <param name="serviceFactory">Factory for implementation.</param> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>.
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception> /// </summary>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// <param name="tInterface">Type of interface.</param>
void RegisterTransient(Type tInterface, Type tClass, Func<IServiceProvider, object> serviceFactory); /// <param name="tClass">Type of implementation.</param>
/// <summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>. void RegisterSingleton(Type tInterface, Type tClass);
/// </summary> /// <summary>
/// <param name="tInterface">Type of interface.</param> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>.
/// <param name="tClass">Type of implementation.</param> /// </summary>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// <param name="tInterface">Type of interface.</param>
void RegisterSingleton(Type tInterface, Type tClass); /// <param name="tClass">Type of implementation.</param>
/// <summary> /// <param name="serviceFactory">Factory for implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <param name="tInterface">Type of interface.</param> void RegisterSingleton(Type tInterface, Type tClass, Func<IServiceProvider, object> serviceFactory);
/// <param name="tClass">Type of implementation.</param> /// <summary>
/// <param name="serviceFactory">Factory for implementation.</param> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>.
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception> /// </summary>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// <param name="tInterface">Type of interface.</param>
void RegisterSingleton(Type tInterface, Type tClass, Func<IServiceProvider, object> serviceFactory); /// <param name="tClass">Type of implementation.</param>
/// <summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>. void RegisterScoped(Type tInterface, Type tClass);
/// </summary> /// <summary>
/// <param name="tInterface">Type of interface.</param> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>.
/// <param name="tClass">Type of implementation.</param> /// </summary>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// <param name="tInterface">Type of interface.</param>
void RegisterScoped(Type tInterface, Type tClass); /// <param name="tClass">Type of implementation.</param>
/// <summary> /// <param name="serviceFactory">Factory for implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <param name="tInterface">Type of interface.</param> void RegisterScoped(Type tInterface, Type tClass, Func<IServiceProvider, object> serviceFactory);
/// <param name="tClass">Type of implementation.</param> /// <summary>
/// <param name="serviceFactory">Factory for implementation.</param> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>.
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception> /// Registers the service for all interfaces it implements.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// </summary>
void RegisterScoped(Type tInterface, Type tClass, Func<IServiceProvider, object> serviceFactory); /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// <summary> /// <param name="tClass">Type of implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>. /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Registers the service for all interfaces it implements. void RegisterTransient(Type tClass, bool registerAllInterfaces = false);
/// </summary> /// <summary>
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>.
/// <param name="tClass">Type of implementation.</param> /// Registers the service for all interfaces it implements.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// </summary>
void RegisterTransient(Type tClass, bool registerAllInterfaces = false); /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// <summary> /// <param name="tClass">Type of implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Transient"/>. /// <param name="serviceFactory">Factory for implementation.</param>
/// Registers the service for all interfaces it implements. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> void RegisterTransient(Type tClass, Func<IServiceProvider, object> serviceFactory, bool registerAllInterfaces = false);
/// <param name="tClass">Type of implementation.</param> /// <summary>
/// <param name="serviceFactory">Factory for implementation.</param> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>.
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception> /// Registers the service for all interfaces it implements.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// </summary>
void RegisterTransient(Type tClass, Func<IServiceProvider, object> serviceFactory, bool registerAllInterfaces = false); /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// <summary> /// <param name="tClass">Type of implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>. /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Registers the service for all interfaces it implements. void RegisterSingleton(Type tClass, bool registerAllInterfaces = false);
/// </summary> /// <summary>
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>.
/// <param name="tClass">Type of implementation.</param> /// Registers the service for all interfaces it implements.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// </summary>
void RegisterSingleton(Type tClass, bool registerAllInterfaces = false); /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// <summary> /// <param name="tClass">Type of implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Singleton"/>. /// <param name="serviceFactory">Factory for implementation.</param>
/// Registers the service for all interfaces it implements. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> void RegisterSingleton(Type tClass, Func<IServiceProvider, object> serviceFactory, bool registerAllInterfaces = false);
/// <param name="tClass">Type of implementation.</param> /// <summary>
/// <param name="serviceFactory">Factory for implementation.</param> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>.
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception> /// Registers the service for all interfaces it implements.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// </summary>
void RegisterSingleton(Type tClass, Func<IServiceProvider, object> serviceFactory, bool registerAllInterfaces = false); /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// <summary> /// <param name="tClass">Type of implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>. /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// Registers the service for all interfaces it implements. void RegisterScoped(Type tClass, bool registerAllInterfaces = false);
/// </summary> /// <summary>
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> /// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>.
/// <param name="tClass">Type of implementation.</param> /// Registers the service for all interfaces it implements.
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception> /// </summary>
void RegisterScoped(Type tClass, bool registerAllInterfaces = false); /// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param>
/// <summary> /// <param name="tClass">Type of implementation.</param>
/// Register a service into <see cref="ServiceManager"/> with <see cref="Lifetime.Scoped"/>. /// <param name="serviceFactory">Factory for implementation.</param>
/// Registers the service for all interfaces it implements. /// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// </summary> /// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
/// <param name="registerAllInterfaces">If true, <see cref="ServiceManager"/> will register all interfaces implemented by the provided class./></param> void RegisterScoped(Type tClass, Func<IServiceProvider, object> serviceFactory, bool registerAllInterfaces = false);
/// <param name="tClass">Type of implementation.</param>
/// <param name="serviceFactory">Factory for implementation.</param>
/// <exception cref="ArgumentNullException">Thrown when the provided serviceFactory is null.</exception>
/// <exception cref="InvalidOperationException">Thrown when <see cref="ServiceManager"/> contains an entry for the provided interface type.</exception>
void RegisterScoped(Type tClass, Func<IServiceProvider, object> serviceFactory, bool registerAllInterfaces = false);
}
} }
+26 -27
View File
@@ -2,34 +2,33 @@
using System.Collections.Generic; using System.Collections.Generic;
using Slim.Exceptions; using Slim.Exceptions;
namespace Slim namespace Slim;
/// <summary>
/// Interface allowing to request services from the <see cref="ServiceManager"/>.
/// </summary>
public interface IServiceProvider : System.IServiceProvider, IDisposable
{ {
/// <summary> /// <summary>
/// Interface allowing to request services from the <see cref="ServiceManager"/>. /// Returns all services that can be cast to provided type.
/// </summary> /// </summary>
public interface IServiceProvider : System.IServiceProvider, IDisposable /// <typeparam name="T">Type of the returned services.</typeparam>
{ IEnumerable<T> GetServicesOfType<T>();
/// <summary> /// <summary>
/// Returns all services that can be cast to provided type. /// Returns all services that can be cast to provided type.
/// </summary> /// </summary>
/// <typeparam name="T">Type of the returned services.</typeparam> /// <param name="type">Type of the returned services.</param>
IEnumerable<T> GetServicesOfType<T>(); IEnumerable<object> GetServicesOfType(Type type);
/// <summary> /// <summary>
/// Returns all services that can be cast to provided type. /// Creates a scoped <see cref="IServiceProvider"/>.
/// </summary> /// </summary>
/// <param name="type">Type of the returned services.</param> /// <returns>Scoped <see cref="IServiceProvider"/>.</returns>
IEnumerable<object> GetServicesOfType(Type type); IServiceProvider CreateScope();
/// <summary> /// <summary>
/// Creates a scoped <see cref="IServiceProvider"/>. /// Resolves and returns the required service.
/// </summary> /// </summary>
/// <returns>Scoped <see cref="IServiceProvider"/>.</returns> /// <typeparam name="TInterface">Type of required service.</typeparam>
IServiceProvider CreateScope(); /// <returns>Required service.</returns>
/// <summary> /// <exception cref="DependencyInjectionException">Thrown when unable to resolve required service.</exception>
/// Resolves and returns the required service. TInterface GetService<TInterface>() where TInterface : class;
/// </summary>
/// <typeparam name="TInterface">Type of required service.</typeparam>
/// <returns>Required service.</returns>
/// <exception cref="DependencyInjectionException">Thrown when unable to resolve required service.</exception>
TInterface GetService<TInterface>() where TInterface : class;
}
} }
+6 -7
View File
@@ -1,9 +1,8 @@
namespace Slim namespace Slim;
internal enum Lifetime
{ {
internal enum Lifetime Transient,
{ Singleton,
Transient, Scoped
Singleton,
Scoped
}
} }
+17 -18
View File
@@ -1,24 +1,23 @@
using System; using System;
namespace Slim.Resolvers namespace Slim.Resolvers;
/// <summary>
/// Resolver that can be added to a <see cref="IServiceManager"/> to manually resolve a dependency.
/// </summary>
public interface IDependencyResolver
{ {
/// <summary> /// <summary>
/// Resolver that can be added to a <see cref="IServiceManager"/> to manually resolve a dependency. /// Returns true if the <see cref="IDependencyResolver"/> can resolve the dependency of provided <see cref="Type"/>.
/// </summary> /// </summary>
public interface IDependencyResolver /// <param name="type"><see cref="Type"/> of dependency to be resolved.</param>
{ /// <returns>True if <see cref="IDependencyResolver"/> can resolve the dependency. Otherwise false.</returns>
/// <summary> bool CanResolve(Type type);
/// Returns true if the <see cref="IDependencyResolver"/> can resolve the dependency of provided <see cref="Type"/>. /// <summary>
/// </summary> /// Returns a resolved dependency of the provided type.
/// <param name="type"><see cref="Type"/> of dependency to be resolved.</param> /// </summary>
/// <returns>True if <see cref="IDependencyResolver"/> can resolve the dependency. Otherwise false.</returns> /// <param name="serviceProvider">Reference to the calling <see cref="IServiceProvider"/>.</param>
bool CanResolve(Type type); /// <param name="type"><see cref="Type"/> of the dependency to be resolved.</param>
/// <summary> /// <returns>Resolved dependency of provided <see cref="Type"/>.</returns>
/// Returns a resolved dependency of the provided type. object Resolve(IServiceProvider serviceProvider, Type type);
/// </summary>
/// <param name="serviceProvider">Reference to the calling <see cref="IServiceProvider"/>.</param>
/// <param name="type"><see cref="Type"/> of the dependency to be resolved.</param>
/// <returns>Resolved dependency of provided <see cref="Type"/>.</returns>
object Resolve(IServiceProvider serviceProvider, Type type);
}
} }
+840 -828
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -8,10 +8,10 @@
<Company /> <Company />
<Product></Product> <Product></Product>
<Description>Service lifetime management and dependency injection framework.</Description> <Description>Service lifetime management and dependency injection framework.</Description>
<AssemblyVersion>1.8.1</AssemblyVersion> <AssemblyVersion>1.9</AssemblyVersion>
<FileVersion>1.8.1</FileVersion> <FileVersion>1.9</FileVersion>
<PackageProjectUrl>https://github.com/AlexMacocian/Slim</PackageProjectUrl> <PackageProjectUrl>https://github.com/AlexMacocian/Slim</PackageProjectUrl>
<Version>1.8.1</Version> <Version>1.9</Version>
<EnableNETAnalyzers>true</EnableNETAnalyzers> <EnableNETAnalyzers>true</EnableNETAnalyzers>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <PackageLicenseFile>LICENSE</PackageLicenseFile>
+10
View File
@@ -59,6 +59,11 @@
Interface for <see cref="T:Slim.ServiceManager"/>. Interface for <see cref="T:Slim.ServiceManager"/>.
</summary> </summary>
</member> </member>
<member name="P:Slim.IServiceManager.ParentServiceManager">
<summary>
Gets the <see cref="T:Slim.IServiceManager"/> that created the current <see cref="T:Slim.IServiceManager"/>. Returns null in case there is no parent.
</summary>
</member>
<member name="P:Slim.IServiceManager.AllowScopedManagerModifications"> <member name="P:Slim.IServiceManager.AllowScopedManagerModifications">
<summary> <summary>
Allow modifications to scoped <see cref="T:Slim.IServiceManager"/> created from this <see cref="T:Slim.IServiceManager"/>. Allow modifications to scoped <see cref="T:Slim.IServiceManager"/> created from this <see cref="T:Slim.IServiceManager"/>.
@@ -416,6 +421,11 @@
Returns true if <see cref="T:Slim.IServiceManager"/> is readonly. Returns true if <see cref="T:Slim.IServiceManager"/> is readonly.
</summary> </summary>
</member> </member>
<member name="P:Slim.ServiceManager.ParentServiceManager">
<summary>
Gets the <see cref="T:Slim.IServiceManager"/> that created the current <see cref="T:Slim.IServiceManager"/>. Returns null in case there is no parent.
</summary>
</member>
<member name="M:Slim.ServiceManager.#ctor"> <member name="M:Slim.ServiceManager.#ctor">
<summary> <summary>
Creates an instance of <see cref="T:Slim.IServiceManager"/>. Creates an instance of <see cref="T:Slim.IServiceManager"/>.