Showing preview only (1,634K chars total). Download the full file or copy to clipboard to get everything.
Repository: z4kn4fein/stashbox
Branch: master
Commit: 433e18fc3afc
Files: 336
Total size: 1.5 MB
Directory structure:
gitextract_6bqpv2p6/
├── .gitattributes
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ ├── codeql-analysis.yml
│ ├── docs.yml
│ ├── linux-macOS-CI.yml
│ ├── sonar-analysis.yml
│ └── stale.yml
├── .gitignore
├── .version
├── CHANGELOG.md
├── LICENSE
├── README.md
├── appveyor-release.yml
├── appveyor.yml
├── docs/
│ ├── .gitignore
│ ├── babel.config.js
│ ├── docs/
│ │ ├── advanced/
│ │ │ ├── child-containers.md
│ │ │ ├── decorators.md
│ │ │ ├── generics.md
│ │ │ ├── special-resolution-cases.md
│ │ │ └── wrappers-resolvers.md
│ │ ├── configuration/
│ │ │ ├── container-configuration.md
│ │ │ └── registration-configuration.md
│ │ ├── diagnostics/
│ │ │ ├── utilities.md
│ │ │ └── validation.md
│ │ ├── getting-started/
│ │ │ ├── glossary.md
│ │ │ ├── introduction.md
│ │ │ └── overview.md
│ │ └── guides/
│ │ ├── advanced-registration.md
│ │ ├── basics.md
│ │ ├── lifetimes.md
│ │ ├── scopes.md
│ │ └── service-resolution.md
│ ├── docusaurus.config.js
│ ├── package.json
│ ├── sidebars.js
│ ├── src/
│ │ ├── components/
│ │ │ ├── CodeDescPanel/
│ │ │ │ ├── index.tsx
│ │ │ │ └── styles.module.scss
│ │ │ ├── NavbarItems/
│ │ │ │ ├── SeparatorNavbarItem/
│ │ │ │ │ ├── index.tsx
│ │ │ │ │ └── styles.module.scss
│ │ │ │ └── SvgNavbarItem/
│ │ │ │ ├── index.tsx
│ │ │ │ └── styles.module.scss
│ │ │ └── SvgIcon/
│ │ │ └── index.tsx
│ │ ├── css/
│ │ │ ├── custom.scss
│ │ │ ├── pagination.scss
│ │ │ ├── search.scss
│ │ │ ├── sidebar.scss
│ │ │ ├── tab.scss
│ │ │ └── toc.scss
│ │ ├── pages/
│ │ │ ├── index.js
│ │ │ └── index.module.scss
│ │ ├── theme/
│ │ │ ├── CodeBlock/
│ │ │ │ └── index.js
│ │ │ ├── Footer/
│ │ │ │ ├── index.js
│ │ │ │ └── styles.module.scss
│ │ │ └── NavbarItem/
│ │ │ └── ComponentTypes.js
│ │ └── utils/
│ │ └── prismDark.mjs
│ └── static/
│ └── .nojekyll
├── sandbox/
│ ├── stashbox.assemblyload/
│ │ ├── Program.cs
│ │ └── stashbox.assemblyload.csproj
│ ├── stashbox.benchmarks/
│ │ ├── BeginScopeBenchmarks.cs
│ │ ├── ChildContainerBenchmarks.cs
│ │ ├── DecoratorBenchmarks.cs
│ │ ├── DisposeBenchmarks.cs
│ │ ├── EnumerableBenchmarks.cs
│ │ ├── FinalizerBenchmarks.cs
│ │ ├── FuncBenchmarks.cs
│ │ ├── NullableBenchmarks.cs
│ │ ├── Program.cs
│ │ ├── PropertyBenchmarks.cs
│ │ ├── RegisterBenchmarks.cs
│ │ ├── ResolveBenchmarks.cs
│ │ ├── ScopedBenchmarks.cs
│ │ ├── SingletonBenchmarks.cs
│ │ ├── Stashbox.Benchmarks.csproj
│ │ └── TreeBenchmarks.cs
│ ├── stashbox.sandbox.sln
│ └── stashbox.trimmed/
│ ├── Program.cs
│ └── stashbox.trimmed.csproj
├── sn.snk
├── src/
│ ├── Attributes/
│ │ ├── DependencyAttribute.cs
│ │ ├── DependencyNameAttribute.cs
│ │ └── InjectionMethodAttribute.cs
│ ├── Configuration/
│ │ ├── ContainerConfiguration.cs
│ │ ├── ContainerConfigurator.cs
│ │ └── Rules.cs
│ ├── ContainerContext.cs
│ ├── Exceptions/
│ │ ├── CompositionRootNotFoundException.cs
│ │ ├── ConstructorNotFoundException.cs
│ │ ├── InvalidRegistrationException.cs
│ │ ├── LifetimeValidationFailedException.cs
│ │ ├── ResolutionFailedException.cs
│ │ └── ServiceAlreadyRegisteredException.cs
│ ├── Expressions/
│ │ ├── Compile/
│ │ │ ├── Closure.cs
│ │ │ ├── CompilerContext.cs
│ │ │ ├── Emitters/
│ │ │ │ ├── Emitter.Assign.cs
│ │ │ │ ├── Emitter.Call.cs
│ │ │ │ ├── Emitter.Constant.cs
│ │ │ │ ├── Emitter.Convert.cs
│ │ │ │ ├── Emitter.Default.cs
│ │ │ │ ├── Emitter.Invoke.cs
│ │ │ │ ├── Emitter.Lambda.cs
│ │ │ │ ├── Emitter.MemberAccess.cs
│ │ │ │ ├── Emitter.MemberInit.cs
│ │ │ │ ├── Emitter.New.cs
│ │ │ │ ├── Emitter.NewArrayInit.cs
│ │ │ │ ├── Emitter.Parameter.cs
│ │ │ │ └── Emitter.cs
│ │ │ ├── ExpressionEmitter.cs
│ │ │ ├── Extensions/
│ │ │ │ ├── CollectionExtensions.cs
│ │ │ │ └── ILGeneratorExtensions.cs
│ │ │ ├── NestedLambda.cs
│ │ │ ├── TreeAnalyzer.cs
│ │ │ └── Utils.cs
│ │ ├── ExpressionBuilder.Default.cs
│ │ ├── ExpressionBuilder.Factory.cs
│ │ ├── ExpressionBuilder.Func.cs
│ │ ├── ExpressionBuilder.cs
│ │ ├── ExpressionFactory.Member.cs
│ │ ├── ExpressionFactory.Method.cs
│ │ └── ExpressionFactory.cs
│ ├── Extensions/
│ │ ├── AssemblyExtensions.cs
│ │ ├── CollectionExtensions.cs
│ │ ├── EnumerableExtensions.cs
│ │ ├── ExpressionExtensions.cs
│ │ └── TypeExtensions.cs
│ ├── ICompositionRoot.cs
│ ├── IContainerContext.cs
│ ├── IDecoratorRegistrator.cs
│ ├── IDependencyCollectionRegistrator.cs
│ ├── IDependencyReMapper.cs
│ ├── IDependencyRegistrator.cs
│ ├── IDependencyResolver.cs
│ ├── IFuncRegistrator.cs
│ ├── IResolutionScope.cs
│ ├── IStashboxContainer.cs
│ ├── Lifetime/
│ │ ├── AutoLifetime.cs
│ │ ├── EmptyLifetime.cs
│ │ ├── ExpressionLifetimeDescriptor.cs
│ │ ├── FactoryLifetimeDescriptor.cs
│ │ ├── LifetimeDescriptor.cs
│ │ ├── Lifetimes.cs
│ │ ├── NamedScopeLifetime.cs
│ │ ├── PerRequestLifetime.cs
│ │ ├── ScopedLifetime.cs
│ │ ├── SingletonLifetime.cs
│ │ └── TransientLifetime.cs
│ ├── Metadata.cs
│ ├── Multitenant/
│ │ ├── ITenantDistributor.cs
│ │ └── TenantDistributor.cs
│ ├── Override.cs
│ ├── ReadOnlyKeyValue.cs
│ ├── Registration/
│ │ ├── DecoratorRepository.cs
│ │ ├── Extensions/
│ │ │ ├── CollectionRegistratorExtensions.cs
│ │ │ ├── DependencyRegistratorExtensions.cs
│ │ │ ├── DependencyRemapperExtensions.cs
│ │ │ └── ServiceRepositoryExtensions.cs
│ │ ├── Fluent/
│ │ │ ├── BaseDecoratorConfigurator.cs
│ │ │ ├── BaseFluentConfigurator.cs
│ │ │ ├── DecoratorConfigurator.cs
│ │ │ ├── FluentServiceConfigurator.cs
│ │ │ ├── RegistrationConfigurator.cs
│ │ │ └── UnknownRegistrationConfigurator.cs
│ │ ├── IDecoratorRepository.cs
│ │ ├── IRegistrationRepository.cs
│ │ ├── OpenGenericRegistration.cs
│ │ ├── RegistrationDiagnosticsInfo.cs
│ │ ├── RegistrationRepository.cs
│ │ ├── SelectionRules/
│ │ │ ├── ConditionRule.cs
│ │ │ ├── DecoratorRule.cs
│ │ │ ├── EnumerableNameRule.cs
│ │ │ ├── IRegistrationSelectionRule.cs
│ │ │ ├── MetadataRule.cs
│ │ │ ├── NameRule.cs
│ │ │ ├── OpenGenericRule.cs
│ │ │ ├── RegistrationSelectionRules.cs
│ │ │ └── ScopeNameRule.cs
│ │ ├── ServiceRegistration.cs
│ │ └── ServiceRegistrator.cs
│ ├── Resolution/
│ │ ├── DelegateCache.cs
│ │ ├── DelegateCacheEntry.cs
│ │ ├── Extensions/
│ │ │ ├── DependencyResolverExtensions.cs
│ │ │ ├── InjectionParameterExtensions.cs
│ │ │ └── ResolutionBehaviorExtensions.cs
│ │ ├── ILookupResolver.cs
│ │ ├── IRequestContext.cs
│ │ ├── IResolutionStrategy.cs
│ │ ├── IResolver.cs
│ │ ├── IWrapper.cs
│ │ ├── RequestContext.cs
│ │ ├── ResolutionBehavior.cs
│ │ ├── ResolutionContext.cs
│ │ ├── ResolutionStrategy.cs
│ │ ├── Resolvers/
│ │ │ ├── DefaultValueResolver.cs
│ │ │ ├── OptionalValueResolver.cs
│ │ │ ├── ParentContainerResolver.cs
│ │ │ ├── ServiceProviderResolver.cs
│ │ │ └── UnknownTypeResolver.cs
│ │ ├── ServiceContext.cs
│ │ ├── TypeInformation.cs
│ │ └── Wrappers/
│ │ ├── EnumerableWrapper.cs
│ │ ├── FuncWrapper.cs
│ │ ├── KeyValueWrapper.cs
│ │ ├── LazyWrapper.cs
│ │ └── MetadataWrapper.cs
│ ├── ResolutionScope.AsyncInitializer.cs
│ ├── ResolutionScope.Disposable.cs
│ ├── ResolutionScope.Resolver.cs
│ ├── ResolutionScope.cs
│ ├── StashboxContainer.CollectionRegistrator.cs
│ ├── StashboxContainer.FuncRegistrator.cs
│ ├── StashboxContainer.ReMapper.cs
│ ├── StashboxContainer.Registrator.cs
│ ├── StashboxContainer.Resolver.cs
│ ├── StashboxContainer.cs
│ ├── Utils/
│ │ ├── Constants.cs
│ │ ├── Data/
│ │ │ ├── ExpandableArray.cs
│ │ │ ├── HashTree.cs
│ │ │ ├── Immutable/
│ │ │ │ ├── ImmutableBucket.cs
│ │ │ │ ├── ImmutableLinkedList.cs
│ │ │ │ └── ImmutableTree.cs
│ │ │ ├── Pair.cs
│ │ │ ├── Stack.cs
│ │ │ └── Tree.cs
│ │ ├── Shield.cs
│ │ ├── Swap.cs
│ │ └── TypeCache.cs
│ └── stashbox.csproj
├── stashbox.sln
└── test/
├── ActivateTests.cs
├── AssemblyTests.cs
├── AsyncDisposeTests.cs
├── AttributeTests.cs
├── BuildUpTests.cs
├── CanResolveTests.cs
├── ChildContainerTests.cs
├── CircularDependencyTests.cs
├── CompilerTests/
│ ├── ConstantTests.cs
│ ├── DefaultTests.cs
│ └── NullableTests.cs
├── ComplexResolution.cs
├── CompositionTests.cs
├── ConditionalTests.cs
├── ConfigurationTests.cs
├── ConstructorSelectionTests.cs
├── ContainerTests.cs
├── DataTests/
│ └── TreeTests.cs
├── DecoratorTests.cs
├── DependencyBindingTests.cs
├── DisposeOrderTests.cs
├── DisposeTests.cs
├── EnumerableTests.cs
├── FactoryTests.cs
├── FuncTests.cs
├── GenericTests.cs
├── HierarchyTests.cs
├── InitializerFinalizerTests.cs
├── InjectionMemberTests.cs
├── InstanceBuilderTests.cs
├── IssueTests/
│ ├── 102_Resolving_Func_use_wrong_constructor.cs
│ ├── 103_Resolving_base_class_dependencies.cs
│ ├── 105_Question_How_to_work_with_dependency_overrides_from_factory_method.cs
│ ├── 114_Unable_to_resolve_IHubContext.cs
│ ├── 116_Different_types_registered_with_the_same_name.cs
│ ├── 118_Named_resolution_using_ResolveAll_returns_all_named_and_unnamed_instanсes.cs
│ ├── 119_generic_resolution_issue.cs
│ ├── 129_Sharing_singleton_instances_between_Resolve_and_ResolveAll_and_subtypes.cs
│ ├── 132_OpenGenericResolveIssue.cs
│ ├── 141_Decorator_and_ResolveAll.cs
│ ├── 144_Generic_decorators_broken.cs
│ ├── 163_Last_write_win_problem_when_hash_collision_happens.cs
│ ├── 16_Extensions_Identity_OptionsMonitor.cs
│ ├── 213_Bug_Resolving_Lazy_Func.cs
│ ├── 228_Stashbox_does_not_handle_Optional_correctly.cs
│ ├── 33_ScopedLifetime_thread_safety.cs
│ ├── 34_Resolution_from_parent_container.cs
│ ├── 35_Mixture_of_named_and_non_named_registrations_result_in_the_wrong_type_resolved.cs
│ ├── 37_Resolver_factory_invoke_doesnt_pass_different_parameters_given_when_theyre_the_same_type.cs
│ ├── 38_Injecting_container_itself.cs
│ ├── 42_Circular_dependency_tracking_doesnt_work_with_factory_resolution.cs
│ ├── 43_Issue_with_Member_Injection_with_Attribute_but_private_setter.cs
│ ├── 44_Lifetime_Issues.cs
│ ├── 46_AspNetCore_Failing_spec_tests_forconstrained_generics.cs
│ ├── 48_Chained_named_scopes_are_not_working_properly.cs
│ ├── 49_Unable_to_use_nullable_types_with_injection_parameters.cs
│ ├── 50_Generate_one_instance_for_multiple_interfaces.cs
│ ├── 51_WithUnknownTypeResolution_breaks_constructor_selection_rules.cs
│ ├── 52_Verify_child_container_working.cs
│ ├── 53_ComposeBy_with_instance_or_injection.cs
│ ├── 54_Make_InjectionParameter_configuration_more_fluent.cs
│ ├── 55_Conditions_on_member_name_are_not_easy_to_recognize.cs
│ ├── 58_InjectionParameter_NullReference.cs
│ ├── 59_Static_factory_fails.cs
│ ├── 63_named_unnamed_resolution_not_working_as_expected.cs
│ ├── 64_WithFactory_MemberInjection_Not_Working_With_ImplementationType.cs
│ ├── 66_Named_PutInstanceInScope.cs
│ ├── 67_Dictionaries_get_resolved_to_arrays_of_key_type_by_default.cs
│ ├── 68_Programmatic_multiple_instances_registration.cs
│ ├── 70_UnkownType_overrides_instance_in_scope.cs
│ ├── 71_FastExpressionCompiler_Issue.cs
│ ├── 72_Default_lifetime_set.cs
│ ├── 76_Exception_when_building_expressions.cs
│ ├── 77_UnknownType_Resolution_Does_Not_Work.cs
│ ├── 80_Expected_override_behaviour_not_working_with_scopes.cs
│ ├── 84_DefinesScope_does_not_work_correctly.cs
│ ├── 88_IdentityServer_not_compatible.cs
│ ├── 89_Call_interception.cs
│ ├── 91_Resolving_with_custom_parameter_values.cs
│ ├── 97_Does_Scope_AttachToParent_only_affect_Dispose_behaviour.cs
│ └── 98_Replace_doesnt_working_singleton.cs
├── KeyValueTests.cs
├── KeyedTests.cs
├── LazyTests.cs
├── LifetimeTests.cs
├── MetadataTests.cs
├── MultitenantTests.cs
├── NamedResolveTests.cs
├── NamedScopeTests.cs
├── OverrideTests.cs
├── PerRequestResolutionTests.cs
├── ReMapTests.cs
├── RegisterTypesTests.cs
├── ResolveFactoryTests.cs
├── ResolverTests.cs
├── ScopeTests.cs
├── ServiceProviderTests.cs
├── StandardResolveTests.cs
├── Utils/
│ ├── CompilerType.cs
│ ├── CompilerTypeTestData.cs
│ ├── ContainerConfiguratorExtensions.cs
│ └── TypeGen.cs
├── WireUpTests.cs
├── WithDynamicResolutionTests.cs
├── stashbox.tests.csproj
└── testassembly/
├── Composition.cs
├── TestClasses.cs
└── testassembly.csproj
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
================================================
FILE: .github/dependabot.yml
================================================
version: 2
enable-beta-ecosystems: true
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
================================================
FILE: .github/workflows/codeql-analysis.yml
================================================
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ master, dev ]
paths-ignore:
- '**.md'
- 'docs/**'
- 'appveyor*'
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '0 1 * * 2'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
steps:
- name: Checkout repository
uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v4
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
================================================
FILE: .github/workflows/docs.yml
================================================
name: Deploy to GitHub Pages
on:
push:
branches: [ master ]
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
defaults:
run:
working-directory: docs
jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 20
cache: yarn
cache-dependency-path: ./docs/yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build
================================================
FILE: .github/workflows/linux-macOS-CI.yml
================================================
name: Build on Linux and macOS
on:
push:
branches: [ master, dev ]
paths-ignore:
- '**.md'
- 'docs/**'
- 'appveyor*'
pull_request:
types: [opened, synchronize, reopened]
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build-test:
name: Build & test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, ubuntu-latest ]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- name: Restore
run: dotnet restore
- name: Test
run: |
dotnet test test/stashbox.tests.csproj -c Release -f net8.0 --no-restore
dotnet test test/stashbox.tests.csproj -c Release -f net9.0 --no-restore
dotnet test test/stashbox.tests.csproj -c Release -f net10.0 --no-restore
================================================
FILE: .github/workflows/sonar-analysis.yml
================================================
name: SonarCloud Analysis
on:
push:
branches: [ master, dev ]
paths-ignore:
- '**.md'
- 'docs/**'
- 'appveyor*'
pull_request:
types: [opened, synchronize, reopened]
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
analysis:
name: Run analysis & code coverage
runs-on: windows-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: 17
distribution: temurin
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
- name: Cache SonarCloud packages
uses: actions/cache@v5
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v5
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"z4kn4fein_stashbox" /v:"${{ github.run_number }}" /o:"z4kn4fein" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverage.exclusions="test/**,src/Utils/**,src/Expressions/Compile/**" /d:sonar.exclusions="test/**,src/Utils/**,src/Expressions/Compile/**" /d:sonar.cs.opencover.reportsPaths="**/TestResults/**/coverage.opencover.xml" -d:sonar.cs.vstest.reportsPaths="**/TestResults/*.trx"
dotnet test test\stashbox.tests.csproj -c Release -f net8.0 --logger trx --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
================================================
FILE: .github/workflows/stale.yml
================================================
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests
on:
schedule:
- cron: '0 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v10
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is marked stale because it has been open for 90 days with no activity.'
stale-pr-message: 'This PR is marked stale because it has been open for 90 days with no activity.'
close-issue-message: 'This issue was closed due to no activity.'
close-pr-message: 'This PR was closed due to no activity.'
days-before-issue-stale: 90
days-before-pr-stale: 90
days-before-issue-close: 10
days-before-pr-close: 10
================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studo 2015 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
*.[Cc]ache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
tools
coverageresults
coverage.xml
project.lock.json
.sonarqube
.idea
================================================
FILE: .version
================================================
5.20.0
================================================
FILE: CHANGELOG.md
================================================
Visit the [Github Releases](https://github.com/z4kn4fein/stashbox/releases) page of the repository for a complete changelog.
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) 2026 Peter Csajtai
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Stashbox
[](https://ci.appveyor.com/project/pcsajtai/stashbox/branch/master)
[](https://github.com/z4kn4fein/stashbox/actions/workflows/linux-macOS-CI.yml)
[](https://www.nuget.org/packages/Stashbox)
[](https://sonarcloud.io/project/overview?id=z4kn4fein_stashbox)
[](https://sonarcloud.io/project/overview?id=z4kn4fein_stashbox)
[](https://sonarcloud.io/project/overview?id=z4kn4fein_stashbox)
[](https://github.com/dotnet/sourcelink)
Stashbox is a lightweight, fast, and portable dependency injection framework for .NET-based solutions. It encourages the building of loosely coupled applications and simplifies the construction of hierarchical object structures. It can be integrated easily with .NET Core, Generic Host, ASP.NET, Xamarin, and many other applications.
- [Documentation](https://z4kn4fein.github.io/stashbox)
- [Release notes](https://github.com/z4kn4fein/stashbox/blob/master/CHANGELOG.md)
- [ASP.NET Core sample](https://github.com/z4kn4fein/stashbox-extensions-dependencyinjection/tree/master/sample)
Github (stable) | NuGet (stable) | NuGet (pre-release)
--- | --- | ---
[](https://github.com/z4kn4fein/stashbox/releases) | [](https://www.nuget.org/packages/Stashbox) | [](https://www.nuget.org/packages/Stashbox/)
## Core Attributes
- 🚀 Fast, thread-safe, and lock-free operations.
- ⚡️ Easy-to-use Fluent configuration API.
- ♻️ Small memory footprint.
- 🔄 Tracks the dependency tree for cycles.
- 🚨 Detects and warns about misconfigurations.
- 🔥 Gives fast feedback on registration/resolution issues.
## Supported Platforms
- .NET 5+
- .NET Standard 2.0+
- .NET Framework 4.5+
- Mono
- Universal Windows Platform
- Xamarin (Android/iOS/Mac)
- Unity
## Contact & Support
- Create an [issue](https://github.com/z4kn4fein/stashbox/issues) for bug reports and feature requests.
- Start a [discussion](https://github.com/z4kn4fein/stashbox/discussions) for your questions and ideas.
- Add a ⭐️ to support the project!
## Extensions
- ASP.NET Core
- [Stashbox.Extensions.DependencyInjection](https://github.com/z4kn4fein/stashbox-extensions-dependencyinjection)
- [Stashbox.Extensions.Hosting](https://github.com/z4kn4fein/stashbox-extensions-dependencyinjection#net-generic-host)
- [Stashbox.AspNetCore.Hosting](https://github.com/z4kn4fein/stashbox-extensions-dependencyinjection)
- [Stashbox.AspNetCore.Multitenant](https://github.com/z4kn4fein/stashbox-extensions-dependencyinjection#multitenant)
- [Stashbox.AspNetCore.Testing](https://github.com/z4kn4fein/stashbox-extensions-dependencyinjection#testing)
- ASP.NET
- [Stashbox.Web.WebApi](https://github.com/z4kn4fein/stashbox-extensions/tree/main/src/stashbox-web-webapi)
- [Stashbox.Web.Mvc](https://github.com/z4kn4fein/stashbox-extensions/tree/main/src/stashbox-web-mvc)
- [Stashbox.AspNet.SignalR](https://github.com/z4kn4fein/stashbox-extensions/tree/main/src/stashbox-signalr)
- OWIN
- [Stashbox.Owin](https://github.com/z4kn4fein/stashbox-extensions/tree/main/src/stashbox-owin)
- [Stashbox.AspNet.WebApi.Owin](https://github.com/z4kn4fein/stashbox-extensions/tree/main/src/stashbox-webapi-owin)
- [Stashbox.AspNet.SignalR.Owin](https://github.com/z4kn4fein/stashbox-extensions/tree/main/src/stashbox-signalr-owin)
- WCF
- [Stashbox.Extension.Wcf](https://github.com/devworker55/stashbox-extension-wcf)
- Hangfire
- [Stashbox.Hangfire](https://github.com/z4kn4fein/stashbox-extensions/tree/main/src/stashbox-hangfire)
- Mocking
- [Stashbox.Mocking](https://github.com/z4kn4fein/stashbox-mocking) (Moq, FakeItEasy, NSubstitute, RhinoMocks)
## Benchmarks
- [Performance](https://github.com/danielpalme/IocPerformance)
<br>
*Powered by [Jetbrains'](https://www.jetbrains.com/?from=Stashbox) [Open Source License](https://www.jetbrains.com/community/opensource/?from=Stashbox)*
[](https://www.jetbrains.com/?from=Stashbox)
================================================
FILE: appveyor-release.yml
================================================
deploy:
- provider: NuGet
api_key:
secure: RY9paWaFrCFasUjkcr9JU0d8U+9885/yViaEnXQ+gBeHUnh61S+VbuvUONcbqV5J
- provider: NuGet
server: https://nuget.pkg.github.com/z4kn4fein/index.json
artifact: /.nupkg/
skip_symbols: true
username: z4kn4fein
api_key:
secure: TaIug8cHioxT2qDznFpGtDinZiDi+20pEMQZUVAATWCvGLG9Y5LrjaxDUQtGyt38
- provider: GitHub
tag: $(build_version)
release: Stashbox v$(build_version)
auth_token:
secure: TaIug8cHioxT2qDznFpGtDinZiDi+20pEMQZUVAATWCvGLG9Y5LrjaxDUQtGyt38
artifact: /.*\.nupkg|.*\.snupkg/
environment:
build_version: ''
image: Visual Studio 2022
configuration: Release
install:
- ps: |
$env:build_version = Get-Content ".version"
Update-AppveyorBuild -Version "$env:build_version-$env:appveyor_build_number"
dotnet tool install -g InheritDocTool
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1
./dotnet-install.ps1 -Channel 10.0
dotnet_csproj:
patch: true
file: 'src\stashbox.csproj'
version: $(build_version)
package_version: $(build_version)
assembly_version: $(build_version)
file_version: $(build_version)
informational_version: $(build_version)
before_build:
- dotnet restore stashbox.sln
build_script:
- dotnet build -c %configuration% /p:ContinuousIntegrationBuild=true stashbox.sln
test_script:
- dotnet test test\stashbox.tests.csproj -f net10.0 -c %configuration% --no-build
after_build:
- dotnet pack -c %configuration% /p:IncludeSymbols=true /p:PackageOutputPath=..\artifacts src\stashbox.csproj
artifacts:
- path: artifacts\Stashbox.*.nupkg
name: NuGet Packages
- path: artifacts\Stashbox.*.snupkg
name: NuGet Symbol Packages
notifications:
- provider: Email
to:
- peter.csajtai@outlook.com
on_build_success: false
on_build_failure: true
on_build_status_changed: true
- provider: Slack
auth_token:
secure: /KAOQIEOWc7w1EUl6J01qNam+f+ujntrwh53yJ0zg4qRWsdfWbkjKP2UG7tQDW7/hSVJHqF7Hz/IPdS6Cp5ilsfgH6xYroLB/sawQ/pdC5k=
channel: '#ci'
================================================
FILE: appveyor.yml
================================================
environment:
github_auth_token:
secure: z/dKTRVRPmpItPTM/lYdX7dBJk3roDLV98Uj1XzpDqqV868xhHX8dnyKwPAJooUj
build_version: ''
skip_tags: true
skip_commits:
files:
- docs/
- .github/
- '**/*.md'
image: Visual Studio 2022
configuration: Release
install:
- ps: |
$env:build_version = Get-Content ".version"
Update-AppveyorBuild -Version "$env:build_version-preview-$env:appveyor_build_number"
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1
./dotnet-install.ps1 -Channel 8.0
./dotnet-install.ps1 -Channel 9.0
./dotnet-install.ps1 -Channel 10.0
dotnet_csproj:
patch: true
file: 'src\stashbox.csproj'
version: $(build_version)
package_version: $(appveyor_build_version)
assembly_version: $(build_version)
file_version: $(build_version)
informational_version: $(build_version)
before_build:
- dotnet restore stashbox.sln
build_script:
- dotnet build -c %configuration% /p:ContinuousIntegrationBuild=true stashbox.sln
after_build:
- dotnet pack -c %configuration% /p:IncludeSymbols=true /p:PackageOutputPath=..\artifacts src\stashbox.csproj
test_script:
- dotnet test test\stashbox.tests.csproj -f net8.0 -c %configuration% --no-build
- dotnet test test\stashbox.tests.csproj -f net9.0 -c %configuration% --no-build
- dotnet test test\stashbox.tests.csproj -f net10.0 -c %configuration% --no-build
artifacts:
- path: artifacts\Stashbox.*.nupkg
name: NuGet Packages
- path: artifacts\Stashbox.*.snupkg
name: NuGet Symbol Packages
notifications:
- provider: Email
to:
- peter.csajtai@outlook.com
on_build_success: false
on_build_failure: true
on_build_status_changed: true
- provider: Slack
auth_token:
secure: /KAOQIEOWc7w1EUl6J01qNam+f+ujntrwh53yJ0zg4qRWsdfWbkjKP2UG7tQDW7/hSVJHqF7Hz/IPdS6Cp5ilsfgH6xYroLB/sawQ/pdC5k=
channel: '#ci'
================================================
FILE: docs/.gitignore
================================================
# Dependencies
/node_modules
# Production
/build
# Generated files
.docusaurus
.cache-loader
# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
================================================
FILE: docs/babel.config.js
================================================
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
================================================
FILE: docs/docs/advanced/child-containers.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
# Child containers
With child containers, you can build up parent-child relationships between containers. This means you can have a different subset of services present in a child than in the parent container.
When a dependency is missing from the child container during a resolution request, the parent will be asked to resolve the missing service. If it's found there, the parent will return only the service's registration, and the resolution request will jump back to the child. Also, child registrations with the same [service type](/docs/getting-started/glossary#service-type--implementation-type) will override the parent's services.
Resolving `IEnumerable<T>` and [decorators](/docs/advanced/decorators) also considers parent containers by default. However, this behavior can be controlled with the [`ResolutionBehavior`](#resolution-behavior) parameter.
:::info
Child containers are the foundation of the [ASP.NET Core multi-tenant extension](https://github.com/z4kn4fein/stashbox-extensions-dependencyinjection#multitenant).
:::
## Example
Here is an example case:
```cs
interface IDependency {}
class B : IDependency {}
class C : IDependency {}
class A
{
public A(IDependency dependency)
{ }
}
using (var container = new StashboxContainer())
{
// register 'A' into the parent container.
container.Register<A>();
// register 'B' as a dependency into the parent container.
container.Register<IDependency, B>();
var child = container.CreateChildContainer()
// register 'C' as a dependency into the child container.
child.Register<IDependency, C>();
// 'A' is resolved from the parent and gets
// 'C' as IDependency because the resolution
// request was initiated on the child.
A fromChild = child.Resolve<A>();
// 'A' gets 'B' as IDependency because the
// resolution request was initiated on the parent.
A fromParent = container.Resolve<A>();
} // using will dispose the parent along with the child.
```
Let's see what's happening when we request `A` from the *child*:
1. `A` not found in the *child*, go up to the *parent* and check there.
2. `A` found in the *parent*, resolve.
3. `A` depends on `IDependency`, go back to the *child* and search `IDependency` implementations.
4. `C` found in the *child*, it does not have any dependencies, instantiate.
5. Inject the new `C` instance into `A`.
6. All dependencies are resolved; return `A`.
When we make the same request on the parent, everything will go as usual because we have all dependencies in place. `B` will be injected into `A`.
:::info
You can [re-configure](/docs/configuration/container-configuration) child containers with the `.Configure()` method. It doesn't affect the parent container's configuration.
:::
## Accessing child containers
You can identify child containers with the `identifier` parameter of `CreateChildContainer()`. Later, you can retrieve the given child container by passing its ID to `GetChildContainer()`.
```cs
using var container = new StashboxContainer();
container.CreateChildContainer("child");
// ...
var child = container.GetChildContainer("child");
```
Also, each child container created by a container is available through the `IStashboxContainer.ChildContainers` propert.
```cs
using var container = new StashboxContainer();
container.CreateChildContainer("child1");
container.CreateChildContainer("child2");
// ...
foreach (var child in container.ChildContainers)
{
var id = child.Key;
var childContainer = child.Value;
}
```
## Resolution behavior
You can control which level of the container hierarchy can participate in the service resolution with the `ResolutionBehavior` parameter.
Possible values:
- `Default`: The default behavior, it's used when the parameter is not specified. Its value is `Parent | Current`, so both the current container (which initiated the resolution request) and its parents can participate in the resolution request's service selection.
- `Parent`: Indicates that parent containers (including all indirect ancestors) can participate in the resolution request's service selection.
- `Current`: Indicates that the current container (which initiated the resolution request) can participate in the service selection.
- `ParentDependency`: Indicates that parent containers (including all indirect ancestors) can only provide dependencies for services that are already selected for resolution.
- `PreferEnumerableInCurrent`: Upon enumerable resolution, when both `Current` and `Parent` behaviors are enabled, and the current container has the appropriate services, the resolution will prefer those and ignore the parent containers. When the current container doesn't have the requested services, the parent containers will serve the request.
```csharp
interface IService {}
class A : IService {}
class B : IService {}
using (var container = new StashboxContainer())
{
// register 'A' into the parent container.
container.Register<IService, A>();
var child = container.CreateChildContainer()
// register 'B' into the child container.
child.Register<IService, B>();
// 'A' is resolved because only parent
// can participate in the resolution request.
IService withParent = child.Resolve<IService>(ResolutionBehavior.Parent);
// Only 'B' is in the collection because
// only the caller container can take part
// in the resolution request.
IEnumerable<IService> allWithCurrent = child.Resolve<IEnumerable<IService>>(ResolutionBehavior.Current);
// Both 'A' and 'B' is in the collection
// because both the parent and the caller container
// participates in the resolution request.
IEnumerable<IService> all = child.Resolve<IEnumerable<IService>>(ResolutionBehavior.Current | ResolutionBehavior.Parent);
} // using will dispose the parent along with the child.
```
## Re-building singletons
By default, singletons are instantiated and stored only in those containers that registered them. However, you can enable the re-instantiation of singletons in child containers with the `.WithReBuildSingletonsInChildContainer()` [container configuration option](/docs/configuration/container-configuration#re-build-singletons-in-child-containers).
If it's enabled, all singletons will be re-created in those containers that initiated the resolution request. By this, re-built singletons can use overridden dependencies from child containers.
Re-building in child containers does not affect the singletons instantiated in the parent container.
```cs
interface IDependency {}
class B : IDependency {}
class C : IDependency {}
class A
{
public A(IDependency dependency)
{ }
}
using (var container = new StashboxContainer(options => options.WithReBuildSingletonsInChildContainer()))
{
// register 'A' as a singleton into the parent container.
container.RegisterSingleton<A>();
// register 'B' as a dependency into the parent container.
container.Register<IDependency, B>();
// 'A' gets 'B' as IDependency and will be stored
// in the parent container as a singleton.
A fromParent = container.Resolve<A>();
var child = container.CreateChildContainer();
// register 'C' as a dependency into the child container.
child.Register<IDependency, C>();
// a new 'A' singleton will be created in
// the child container with 'C' as IDependency.
A fromChild = child.Resolve<A>();
} // using will dispose the parent along with the child.
```
## Nested child containers
<CodeDescPanel>
<div>
You can build up a hierarchical tree structure from containers by creating more child containers with the `.CreateChildContainer()` method.
</div>
<div>
```cs
using var container = new StashboxContainer();
var child1 = container.CreateChildContainer();
var child2 = child1.CreateChildContainer();
```
</div>
</CodeDescPanel>
## Dispose
By default, the parent container's disposal also disposes its child containers. You can control this behavior with the `CreateChildContainer()` method's `attachToParent` boolean parameter.
```cs
using (var container = new StashboxContainer())
{
using (var child1 = container.CreateChildContainer(attachToParent: false))
{
} // child1 will be disposed only once here.
var child2 = container.CreateChildContainer();
var child3 = container.CreateChildContainer();
} // using will dispose the parent along with child2 and child3.
```
You can safely dispose a child even if it's attached to its parent, in this case the parent's disposal will not dispose the already disposed child.
```cs
using (var container = new StashboxContainer())
{
using (var child1 = container.CreateChildContainer())
{
} // child1 will be disposed only once here.
var child2 = container.CreateChildContainer();
} // using will dispose only the parent and child2.
```
================================================
FILE: docs/docs/advanced/decorators.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Decorators
Stashbox supports decorator [service registration](/docs/getting-started/glossary#service-registration--registered-service) to take advantage of the [Decorator pattern](https://en.wikipedia.org/wiki/Decorator_pattern). This pattern is used to extend the functionality of a class without changing its implementation. This is also what the [Open–closed principle](https://en.wikipedia.org/wiki/Open%E2%80%93closed_principle) stands for; services should be open for extension but closed for modification.
## Simple use-case
We define an `IEventProcessor` service used to process `Event` entities. Then we'll decorate this service with additional validation capabilities:
```cs
class Event { }
class UpdateEvent : Event { }
interface IEventProcessor
{
void ProcessEvent(Event @event);
}
interface IEventValidator
{
bool IsValid(Event @event);
}
class EventValidator : IEventValidator
{
public bool IsValid(Event @event) { /* do the actual validation. */ }
}
class GeneralEventProcessor : IEventProcessor
{
public void ProcessEvent(Event @event)
{
// suppose this method is processing the given event.
this.DoTheActualProcessing(@event);
}
}
class ValidatorProcessor : IEventProcessor
{
private readonly IEventProcessor nextProcessor;
private readonly IEventValidator eventValidator;
public ValidatorProcessor(IEventProcessor eventProcessor, IEventValidator eventValidator)
{
this.nextProcessor = eventProcessor;
this.eventValidator = eventValidator;
}
public void ProcessEvent(Event @event)
{
// validate the event first.
if (!this.eventValidator.IsValid(@event))
throw new InvalidEventException();
// if everything is ok, call the next processor.
this.nextProcessor.ProcessEvent(@event);
}
}
using var container = new StashboxContainer();
container.Register<IEventValidator, EventValidator>();
container.Register<IEventProcessor, GeneralEventProcessor>();
container.RegisterDecorator<IEventProcessor, ValidatorProcessor>();
// new ValidatorProcessor(new GeneralEventProcessor(), new EventValidator())
var eventProcessor = container.Resolve<IEventProcessor>();
// process the event.
eventProcessor.ProcessEvent(new UpdateEvent());
```
The `GeneralEventProcessor` is an implementation of `IEventProcessor` and does the actual event processing logic. It does not have any other responsibilities. Rather than putting the event validation's burden onto its shoulder, we create a different service for validation purposes. Instead of injecting the validator into the `GeneralEventProcessor` directly, we let another `IEventProcessor` decorate it like an *event processing pipeline* that validates the event as a first step.
## Multiple decorators
<CodeDescPanel>
<div>
You have the option to register multiple decorators for a service to extend its functionality.
The decoration order will be the same as the registration order of the decorators. The first registered decorator will decorate the service itself. Then, all the subsequent decorators will wrap the already decorated service.
</div>
<div>
```cs
container.Register<IEventProcessor, GeneralProcessor>();
container.RegisterDecorator<IEventProcessor, LoggerProcessor>();
container.RegisterDecorator<IEventProcessor, ValidatorProcessor>();
// new ValidatorProcessor(new LoggerProcessor(new GeneralProcessor()));
var processor = container.Resolve<IEventProcessor>();
```
</div>
</CodeDescPanel>
## Conditional decoration
With [conditional resolution](/docs/guides/service-resolution#conditional-resolution) you can control which decorator should be selected to decorate a given service.
<Tabs>
<TabItem value="Decoretee" label="Decoretee">
You have the option to set which decorator should be selected for a given implementation. For a single type filter, you can use the `.WhenDecoratedServiceIs()` configuration option. To select more types, you can use the more generic `.When()` option.
```cs
container.Register<IEventProcessor, GeneralProcessor>();
container.Register<IEventProcessor, CustomProcessor>();
container.RegisterDecorator<IEventProcessor, LoggerProcessor>(options => options
// select when CustomProcessor or GeneralProcessor is resolved.
.WhenDecoratedServiceIs<CustomProcessor>()
.WhenDecoratedServiceIs<GeneralProcessor>());
container.RegisterDecorator<IEventProcessor, ValidatorProcessor>(options => options
// select only when GeneralProcessor is resolved.
.WhenDecoratedServiceIs<GeneralProcessor>());
// [
// new ValidatorProcessor(new LoggerProcessor(new GeneralProcessor())),
// new LoggerProcessor(new CustomProcessor())
// ]
var processors = container.ResolveAll<IEventProcessor>();
```
</TabItem>
<TabItem value="Named" label="Named">
You can filter for service names to control the decorator selection.
```cs
container.Register<IEventProcessor, GeneralProcessor>("General");
container.Register<IEventProcessor, CustomProcessor>("Custom");
container.RegisterDecorator<IEventProcessor, LoggerProcessor>(options => options
// select when CustomProcessor or GeneralProcessor is resolved.
.WhenDecoratedServiceIs("General")
.WhenDecoratedServiceIs("Custom"));
container.RegisterDecorator<IEventProcessor, ValidatorProcessor>(options => options
// select only when GeneralProcessor is resolved.
.WhenDecoratedServiceIs("General"));
// new ValidatorProcessor(new LoggerProcessor(new GeneralProcessor()))
var general = container.Resolve<IEventProcessor>("General");
// new LoggerProcessor(new CustomProcessor())
var custom = container.Resolve<IEventProcessor>("Custom");
```
</TabItem>
<TabItem value="Attribute" label="Attribute">
You can use your custom attributes to control the decorator selection. With **class attributes**, you can mark your classes for decoration.
```cs
class LogAttribute : Attribute { }
class ValidateAttribute : Attribute { }
[Log, Validate]
class GeneralProcessor : IEventProcessor { }
[Log]
class CustomProcessor : IEventProcessor { }
container.Register<IEventProcessor, GeneralProcessor>();
container.Register<IEventProcessor, CustomProcessor>();
container.RegisterDecorator<IEventProcessor, LoggerProcessor>(options => options
// select when the resolving class has 'LogAttribute'.
.WhenDecoratedServiceHas<LogAttribute>());
container.RegisterDecorator<IEventProcessor, ValidatorProcessor>(options => options
// select when the resolving class has 'ValidateAttribute'.
.WhenDecoratedServiceHas<ValidateAttribute>());
// [
// new ValidatorProcessor(new LoggerProcessor(new GeneralProcessor())),
// new LoggerProcessor(new CustomProcessor())
// ]
var processors = container.ResolveAll<IEventProcessor>();
```
You can also mark your dependencies for decoration with **property / field / parameter attributes**.
```cs
class LogAttribute : Attribute { }
class ValidateAttribute : Attribute { }
class ProcessorExecutor
{
public ProcessorExecutor([Log, Validate]IEventProcessor eventProcessor)
{ }
}
container.Register<ProcessorExecutor>();
container.Register<IEventProcessor, GeneralProcessor>();
container.RegisterDecorator<IEventProcessor, LoggerProcessor>(options => options
// select when the resolving dependency has 'LogAttribute'.
.WhenHas<LogAttribute>());
container.RegisterDecorator<IEventProcessor, ValidatorProcessor>(options => options
// select when the resolving dependency has 'ValidateAttribute'.
.WhenHas<ValidateAttribute>());
// new ProcessorExecutor(new ValidatorProcessor(new LoggerProcessor(new GeneralProcessor())))
var executor = container.ResolveAll<ProcessorExecutor>();
```
</TabItem>
</Tabs>
## Generic decorators
Stashbox supports the registration of open-generic decorators, which allows the extension of open-generic services.
Inspection of [generic parameter constraints](/docs/advanced/generics#generic-constraints) and [variance handling](/docs/advanced/generics#variance) is supported on generic decorators also.
```cs
interface IEventProcessor<TEvent>
{
void ProcessEvent(TEvent @event);
}
class GeneralEventProcessor<TEvent> : IEventProcessor<TEvent>
{
public void ProcessEvent(TEvent @event) { /* suppose this method is processing the given event.*/ }
}
class ValidatorProcessor<TEvent> : IEventProcessor<TEvent>
{
private readonly IEventProcessor<TEvent> nextProcessor;
public ValidatorProcessor(IEventProcessor<TEvent> eventProcessor)
{
this.nextProcessor = eventProcessor;
}
public void ProcessEvent(TEvent @event)
{
// validate the event first.
if (!this.IsValid(@event))
throw new InvalidEventException();
// if everything is ok, call the next processor.
this.nextProcessor.ProcessEvent(@event);
}
}
using var container = new StashboxContainer();
container.Register(typeof(IEventProcessor<>), typeof(GeneralEventProcessor<>));
container.RegisterDecorator(typeof(IEventProcessor<>), typeof(ValidatorProcessor<>));
// new ValidatorProcessor<UpdateEvent>(new GeneralEventProcessor<UpdateEvent>())
var eventProcessor = container.Resolve<IEventProcessor<UpdateEvent>>();
// process the event.
eventProcessor.ProcessEvent(new UpdateEvent());
```
## Composite pattern
The [Composite pattern](https://en.wikipedia.org/wiki/Composite_pattern) allows a group of objects to be treated the same way as a single instance of the same type. It's useful when you want to use the functionality of multiple instances behind the same interface. You can achieve this by registering a decorator that takes a collection of the same service as a dependency.
```cs
public class CompositeValidator<TEvent> : IEventValidator<TEvent>
{
private readonly IEnumerable<IEventValidator<TEvent>> validators;
public CompositeValidator(IEnumerable<IEventValidator<TEvent>> validators)
{
this.validators = validators;
}
public bool IsValid(TEvent @event)
{
return this.validators.All(validator => validator.IsValid(@event));
}
}
container.Register(typeof(IEventValidator<>), typeof(EventValidator<>));
container.Register(typeof(IEventValidator<>), typeof(AnotherEventValidator<>));
container.RegisterDecorator(typeof(IEventValidator<>), typeof(CompositeValidator<>));
```
## Decorating multiple services
You have the option to organize similar decorating functionalities for different interfaces into the same decorator class.
In this example, we would like to validate a given `Event` right before publishing and also before processing.
```cs
public class EventValidator<TEvent> : IEventProcessor<T>, IEventPublisher<TEvent>
{
private readonly IEventProcessor<TEvent> processor;
private readonly IEventPublisher<TEvent> publisher;
private readonly IEventValidator<TEvent> validator;
public CompositeValidator(IEventProcessor<TEvent> processor,
IEventPublisher<TEvent> publisher,
IEventValidator<TEvent> validator)
{
this.processor = processor;
this.publisher = publisher;
this.validator = validator;
}
public void ProcessEvent(TEvent @event)
{
// validate the event first.
if (!this.validator.IsValid(@event))
throw new InvalidEventException();
// if everything is ok, call the processor.
this.processor.ProcessEvent(@event);
}
public void PublishEvent(TEvent @event)
{
// validate the event first.
if (!this.validator.IsValid(@event))
throw new InvalidEventException();
// if everything is ok, call the publisher.
this.publisher.PublishEvent(@event);
}
}
container.Register(typeof(IEventProcessor<>), typeof(EventProcessor<>));
container.Register(typeof(IEventPublisher<>), typeof(EventPublisher<>));
container.Register(typeof(IEventValidator<>), typeof(EventValidator<>));
// without specifying the interface type, the container binds this registration to all of its implemented types
container.RegisterDecorator(typeof(EventValidator<>));
```
:::info
You can also use the [Binding to multiple services](/docs/guides/advanced-registration#binding-to-multiple-services) options.
:::
## Lifetime
<CodeDescPanel>
<div>
Just as other registrations, decorators also can have their lifetime. It means, in addition to the service's lifetime, all decorator's lifetime will be applied to the wrapped service.
:::note
When you don't set a decorator's lifetime, it'll implicitly inherit the decorated service's lifetime.
:::
</div>
<div>
```cs
container.Register<IEventProcessor, GeneralEventProcessor>();
// singleton decorator will change the transient
// decorated service's lifetime to singleton.
container.RegisterDecorator<IEventProcessor, ValidatorProcessor>(options =>
options.WithLifetime(Lifetimes.Singleton));
// Singleton[new ValidatorProcessor()](Transien[new GeneralEventProcessor()])
var processor = container.Resolve<IEventProcessor>();
```
</div>
</CodeDescPanel>
## Wrappers
<CodeDescPanel>
<div>
Decorators are also applied to wrapped services. It means, in addition to the decoration, you can wrap your services in supported [wrappers](/docs/advanced/wrappers-resolvers#wrappers).
</div>
<div>
```cs
container.Register<IEventProcessor, GeneralEventProcessor>();
container.RegisterDecorator<IEventProcessor, ValidatorProcessor>();
// () => new ValidatorProcessor(new GeneralEventProcessor())
var processor = container.Resolve<Func<IEventProcessor>>();
```
</div>
</CodeDescPanel>
## Interception
From the combination of Stashbox's decorator support and [Castle DynamicProxy's](http://www.castleproject.org/projects/dynamicproxy/) proxy generator, we can take advantage of the [Aspect-Oriented Programming's](https://en.wikipedia.org/wiki/Aspect-oriented_programming) benefits. The following example defines a `LoggingInterceptor` that will log additional messages related to the called service methods.
```cs
public class LoggingInterceptor : IInterceptor
{
private readonly ILogger logger;
public LoggingInterceptor(ILogger logger)
{
this.logger = logger;
}
public void Intercept(IInvocation invocation)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
// log before we invoke the intercepted method.
this.logger.Log($"Method begin: {invocation.GetConcreteMethod().Name}");
// call the intercepted method.
invocation.Proceed();
// log after we invoked the intercepted method and print how long it ran.
this.logger.Log($"Method end: {invocation.GetConcreteMethod().Name}, execution duration: {stopwatch.ElapsedMiliseconds} ms");
}
}
// create a DefaultProxyBuilder from the DynamicProxy library.
var proxyBuilder = new DefaultProxyBuilder();
// build a proxy for the IEventProcessor interface.
var eventProcessorProxy = proxyBuilder.CreateInterfaceProxyTypeWithTargetInterface(
typeof(IEventProcessor),
new Type[0],
ProxyGenerationOptions.Default);
// register the logger for LoggingInterceptor.
container.Register<ILogger, ConsoleLogger>();
// register the service that we will intercept.
container.Register<IEventProcessor, GeneralEventProcessor>();
// register the interceptor.
container.Register<IInterceptor, LoggingInterceptor>();
// register the built proxy as a decorator.
container.RegisterDecorator<IEventProcessor>(eventProcessorProxy);
```
================================================
FILE: docs/docs/advanced/generics.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Generics
This section is about how Stashbox handles various usage scenarios that involve .NET Generic types. Including the registration of open-generic and closed-generic types, [generic decorators](/docs/advanced/decorators#generic-decorators), conditions based on generic constraints, and variance.
## Closed-generics
<CodeDescPanel>
<div>
The registration of a closed-generic type does not differ from registering a simple non-generic service.
You have all options available that you saw at the [basic](/docs/guides/basics) and [advanced registration](/docs/guides/advanced-registration) flows.
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Generic API" label="Generic API">
```cs
container.Register<IValidator<User>, UserValidator>();
IValidator<User> validator = container.Resolve<IValidator<User>>();
```
</TabItem>
<TabItem value="Runtime type API" label="Runtime type API">
```cs
container.Register(typeof(IValidator<User>), typeof(UserValidator));
object validator = container.Resolve(typeof(IValidator<User>));
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Open-generics
The registration of an open-generic type differs from registering a closed-generic one as C# doesn't allow the usage of open-generic types in generic method parameters. We have to get a runtime type from the open-generic type first with `typeof()`.
<CodeDescPanel>
<div>
Open-generic types could help in such scenarios where you have generic interface-implementation pairs with numerous generic parameter variations. The registration of those different versions would look like this:
</div>
<div>
```cs
container.Register<IValidator<User>, Validator<User>>();
container.Register<IValidator<Role>, Validator<Role>>();
container.Register<IValidator<Company>, Validator<Company>>();
// and so on...
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
Rather than doing that, you can register your type's generic definition and let Stashbox bind the type parameters for you. When a matching closed [service type](/docs/getting-started/glossary#service-type--implementation-type) is requested, the container will construct an equivalent closed-generic implementation.
</div>
<div>
```cs
container.Register(typeof(IValidator<>), typeof(Validator<>));
// Validator<User> will be returned.
IValidator<User> userValidator = container.Resolve<IValidator<User>>();
// Validator<Role> will be returned.
IValidator<Role> roleValidator = container.Resolve<IValidator<Role>>();
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
A registered closed-generic type always has priority over an open-generic type at service selection.
</div>
<div>
```cs
container.Register<IValidator<User>, UserValidator>();
container.Register(typeof(IValidator<>), typeof(Validator<>));
// UserValidator will be returned.
IValidator<User> validator = container.Resolve<IValidator<User>>();
```
</div>
</CodeDescPanel>
## Generic constraints
In the following examples, you can see how the container handles generic constraints during service resolution. Constraints can be used for [conditional resolution](/docs/guides/service-resolution#conditional-resolution) including collection filters.
<Tabs>
<TabItem value="Conditional resolution" label="Conditional resolution">
The container chooses `UpdatedEventHandler` because it is the only one that has a constraint satisfied by the requested `UserUpdatedEvent` generic parameter as it's implementing `IUpdatedEvent`.
```cs
interface IEventHandler<TEvent> { }
// event interfaces
interface IUpdatedEvent { }
interface ICreatedEvent { }
// event handlers
class UpdatedEventHandler<TEvent> : IEventHandler<TEvent> where TEvent : IUpdatedEvent { }
class CreatedEventHandler<TEvent> : IEventHandler<TEvent> where TEvent : ICreatedEvent { }
// event implementation
class UserUpdatedEvent : IUpdatedEvent { }
using var container = new StashboxContainer();
container.RegisterTypesAs(typeof(IEventHandler<>), new[]
{
typeof(UpdateEventHandler<>),
typeof(CreateEventHandler<>)
});
// eventHandler will be UpdatedEventHandler<ConstraintArgument>
IEventHandler<UserUpdatedEvent> eventHandler = container.Resolve<IEventHandler<UserUpdatedEvent>>();
```
</TabItem>
<TabItem value="Collection filter" label="Collection filter">
This example shows how the container is filtering out those services from the returned collection that does not satisfy the given generic constraint needed to create the closed generic type.
```cs
interface IEventHandler<TEvent> { }
// event interfaces
interface IUpdatedEvent { }
interface ICreatedEvent { }
// event handlers
class UpdatedEventHandler<TEvent> : IEventHandler<TEvent> where TEvent : IUpdatedEvent { }
class CreatedEventHandler<TEvent> : IEventHandler<TEvent> where TEvent : ICreatedEvent { }
// event implementation
class UserUpdatedEvent : IUpdatedEvent { }
using var container = new StashboxContainer();
container.RegisterTypesAs(typeof(IEventHandler<>), new[]
{
typeof(UpdateEventHandler<>),
typeof(CreateEventHandler<>)
});
// eventHandlers will contain only UpdatedEventHandler<ConstraintArgument>
IEnumerable<IEventHandler<UserUpdatedEvent>> eventHandlers = container.ResolveAll<IEventHandler<UserUpdatedEvent>>();
```
</TabItem>
</Tabs>
## Variance
Since .NET Framework 4.0, C# supports [covariance and contravariance](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/covariance-contravariance/) in generic interfaces and delegates and allows implicit conversion of generic type parameters. In this section, we'll focus on variance in generic interfaces.
[Here](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/covariance-contravariance/creating-variant-generic-interfaces) you can read more about how to create variant generic interfaces, and the following example will show how you can use them with Stashbox.
<Tabs>
<TabItem value="Contravariance" label="Contravariance">
**Contravariance** only allows argument types that are less derived than that defined by the generic parameters. You can declare a generic type parameter contravariant by using the `in` keyword.
```cs
// contravariant generic event handler interface
interface IEventHandler<in TEvent> { }
// event interfaces
interface IGeneralEvent { }
interface IUpdatedEvent : IGeneralEvent { }
// event handlers
class GeneralEventHandler : IEventHandler<IGeneralEvent> { }
class UpdatedEventHandler : IEventHandler<IUpdatedEvent> { }
container.Register<IEventHandler<IGeneralEvent>, GeneralEventHandler>();
container.Register<IEventHandler<IUpdatedEvent>, UpdatedEventHandler>();
// eventHandlers contain both GeneralEventHandler and UpdatedEventHandler
IEnumerable<IEventHandler<IUpdatedEvent>> eventHandlers = container.ResolveAll<IEventHandler<IUpdatedEvent>>();
```
Despite the fact that only `IEventHandler<IUpdatedEvent>` implementations were requested, the result contains both `GeneralEventHandler` and `UpdatedEventHandler`. As `TEvent` is declared **contravariant** with the `in` keyword, and `IGeneralEvent` is less derived than `IUpdatedEvent`, `IEventHandler<IGeneralEvent>` implementations can be part of `IEventHandler<IUpdatedEvent>` collections.
If we request `IEventHandler<IGeneralEvent>`, only `GeneralEventHandler` would be returned, because `IUpdatedEvent` is more derived, so `IEventHandler<IUpdatedEvent>` implementations are not fit into `IEventHandler<IGeneralEvent>` collections.
</TabItem>
<TabItem value="Covariance" label="Covariance">
**Covariance** only allows argument types that are more derived than that defined by the generic parameters. You can declare a generic type parameter covariant by using the `out` keyword.
```cs
// covariant generic event handler interface
interface IEventHandler<out TEvent> { }
// event interfaces
interface IGeneralEvent { }
interface IUpdatedEvent : IGeneralEvent { }
// event handlers
class GeneralEventHandler : IEventHandler<IGeneralEvent> { }
class UpdatedEventHandler : IEventHandler<IUpdatedEvent> { }
container.Register<IEventHandler<IGeneralEvent>, GeneralEventHandler>();
container.Register<IEventHandler<IUpdatedEvent>, UpdatedEventHandler>();
// eventHandlers contain both GeneralEventHandler and UpdatedEventHandler
IEnumerable<IEventHandler<IGeneralEvent>> eventHandlers = container.ResolveAll<IEventHandler<IGeneralEvent>>();
```
Despite the fact that only `IEventHandler<IGeneralEvent>` implementations were requested, the result contains both `GeneralEventHandler` and `UpdatedEventHandler`. As `TEvent` is declared **covariant** with the `out` keyword, and `IUpdatedEvent` is more derived than `IGeneralEvent`, `IEventHandler<IUpdatedEvent>` implementations can be part of `IEventHandler<IGeneralEvent>` collections.
If we request `IEventHandler<IUpdatedEvent>`, only `UpdatedEventHandler` would be returned, because `IGeneralEvent` is less derived, so `IEventHandler<IGeneralEvent>` implementations are not fit into `IEventHandler<IUpdatedEvent>` collections.
</TabItem>
</Tabs>
:::info
The check for variant generic types is enabled by default, but it can be turned off via a [container configuration option](/docs/configuration/container-configuration#generic-variance).
:::
================================================
FILE: docs/docs/advanced/special-resolution-cases.md
================================================
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Special resolution cases
## Unknown type resolution
When this [feature](/docs/configuration/container-configuration#unknown-type-resolution) is enabled, the container will try to resolve unregistered types by registering them using a pre-defined configuration delegate.
<Tabs>
<TabItem value="Default" label="Default">
Without a registration configuration, the container can resolve only non-interface and non-abstract unknown types. In the following example,
the container creates an implicit registration for `Dependency` and injects its instance into `Service`.
```cs
class Dependency { }
class Service
{
public Service(Dependency dependency)
{ }
}
var container = new StashboxContainer(config => config
.WithUnknownTypeResolution());
container.Register<Service>();
var service = container.Resolve<Service>();
```
</TabItem>
<TabItem value="With registration configuration" label="With registration configuration">
With a registration configuration, you can control how an unknown type's individual registration should behave. You can also react to a service resolution request. In the following example, we tell the container that if it finds an unregistered `IDependency` for the first time, that should be mapped to `Dependency` and have a singleton lifetime. Next time, when the container comes across this service, it will use the registration created at the first request.
```cs
interface IDependency { }
class Dependency : IDependency { }
class Service
{
public Service(IDependency dependency)
{ }
}
var container = new StashboxContainer(config => config
.WithUnknownTypeResolution(options =>
{
if(options.ServiceType == typeof(IDependency))
{
options.SetImplementationType(typeof(Dependency))
.WithLifetime(Lifetimes.Singleton);
}
}));
container.Register<Service>();
var service = container.Resolve<Service>();
```
</TabItem>
</Tabs>
## Default value injection
When this [feature](/docs/configuration/container-configuration#default-value-injection) is enabled, the container will resolve unknown primitive dependencies with their default value.
```cs
class Person
{
public Person(string name, int age) { }
}
var container = new StashboxContainer(config => config
.WithDefaultValueInjection());
// the name parameter will be null and the age will be 0.
var person = container.Resolve<Person>();
```
:::note
Unknown reference types are resolved to `null` only in properties and fields.
:::
## Optional value injection
Stashbox respects the optional value of each constructor and method argument.
```cs
class Person
{
public Person(string name = null, int age = 54, IContact contact = null) { }
}
// the name will be null
// the age will be 54.
// the contact will be null.
var person = container.Resolve<Person>();
```
================================================
FILE: docs/docs/advanced/wrappers-resolvers.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Wrappers & resolvers
Stashbox uses so-called *Wrapper* and *Resolver* implementations to handle special resolution requests that none of the [service registrations](/docs/getting-started/glossary#service-registration--registered-service) can fulfill. Functionalities like [wrapper](/docs/advanced/wrappers-resolvers#wrappers) and [unknown type](/docs/advanced/special-resolution-cases#unknown-type-resolution) resolution, [cross-container requests](/docs/advanced/child-containers), [optional](/docs/advanced/special-resolution-cases#optional-value-injection) and [default value](/docs/advanced/special-resolution-cases#default-value-injection) injection are all built with resolvers.
## Pre-defined wrappers & resolvers
* `EnumerableWrapper`: Used to resolve a collection of services wrapped in one of the collection interfaces that a .NET `Array` implements. (`IEnumerable<>`, `IList<>`, `ICollection<>`, `IReadOnlyList<>`, `IReadOnlyCollection<>`)
* `LazyWrapper`: Used to resolve services [wrapped](/docs/advanced/wrappers-resolvers#lazy) in `Lazy<>`.
* `FuncWrapper`: Used to resolve services [wrapped](/docs/advanced/wrappers-resolvers#delegate) in a `Delegate` that has a non-void return type like `Func<>`.
* `MetadataWrapper`: Used to resolve services [wrapped](/docs/advanced/wrappers-resolvers#metadata--tuple) in `ValueTuple<,>`, `Tuple<,>`, or `Metadata<,>`.
* `KeyValueWrapper`: Used to resolve services [wrapped](/docs/advanced/wrappers-resolvers#keyvaluepair--readonlykeyvalue) in `KeyValuePair<,>` or `ReadOnlyKeyValue<,>`.
* `ServiceProviderResolver`: Used to resolve the actual scope as `IServiceProvider` when no other implementation is registered.
* `OptionalValueResolver`: Used to resolve optional parameters.
* `DefaultValueResolver`: Used to resolve default values.
* `ParentContainerResolver`: Used to resolve services that are only registered in one of the parent containers.
* `UnknownTypeResolver`: Used to resolve services that are not registered into the container.
## Wrappers
Stashbox can implicitly wrap your services into different data structures. All functionalities covered in the [service resolution](/docs/guides/service-resolution) are applied to the wrappers. Every wrapper request starts as a standard resolution; only the result is wrapped in the requested structure.
<CodeDescPanel>
<div>
### Enumerable
Stashbox can compose a collection from each implementation registered to a [service type](/docs/getting-started/glossary#service-type--implementation-type). The requested type can be wrapped by any of the collection interfaces that a .NET `Array` implements.
</div>
<div>
```cs
IJob[] jobs = container.Resolve<IJob[]>();
IEnumerable<IJob> jobs = container.Resolve<IEnumerable<IJob>>();
IList<IJob> jobs = container.Resolve<IList<IJob>>();
ICollection<IJob> jobs = container.Resolve<ICollection<IJob>>();
IReadOnlyList<IJob> jobs = container.Resolve<IReadOnlyList<IJob>>();
IReadOnlyCollection<IJob> jobs = container.Resolve<IReadOnlyCollection<IJob>>();
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### Lazy
When requesting `Lazy<>`, the container implicitly constructs a new `Lazy<>` instance with a factory delegate as its constructor argument used to instantiate the underlying service.
</div>
<div>
```cs
container.Register<IJob, DbBackup>();
// new Lazy(() => new DbBackup())
Lazy<IJob> lazyJob = container.Resolve<Lazy<IJob>>();
IJob job = lazyJob.Value;
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### Delegate
When requesting a `Delegate`, the container implicitly creates a factory used to instantiate the underlying service.
It's possible to request a delegate that expects some or all of the dependencies as delegate parameters.
Parameters are used for sub-dependencies as well, like: `(arg) => new A(new B(arg))`
When a dependency is not available as a parameter, it will be resolved from the container directly.
</div>
<div>
<Tabs>
<TabItem value="Func" label="Func">
```cs
container.Register<IJob, DbBackup>();
// (conn, logger) => new DbBackup(conn, logger)
Func<string, ILogger, IJob> funcOfJob = container
.Resolve<Func<string, ILogger, IJob>>();
IJob job = funcOfJob(config["connectionString"], new ConsoleLogger());
```
</TabItem>
<TabItem value="Custom delegate" label="Custom delegate">
```cs
private delegate IJob JobFactory(string connectionString, ILogger logger);
container.Register<IJob, DbBackup>();
var jobDelegate = container.Resolve<JobFactory>();
IJob job = jobDelegate(config["connectionString"], new ConsoleLogger());
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### Metadata & Tuple
With the `.WithMetadata()` registration option, you can attach additional information to a service.
To gather this information, you can request the service wrapped in either `Metadata<,>`, `ValueTuple<,>`, or `Tuple<,>`.
`Metadata<,>` is a type from the `Stashbox` package, so you might prefer using `ValueTuple<,>` or `Tuple<,>` if you want to avoid referencing Stashbox in certain parts of your project.
You can also filter a collection of services by their metadata. Requesting `IEnumerable<ValueTuple<,>>` will yield only those services that have the given type of metadata.
</div>
<div>
<Tabs>
<TabItem value="Single service" label="Single service">
```cs
container.Register<IJob, DbBackup>(options => options
.WithMetadata("connection-string-to-db"));
var jobWithConnectionString = container.Resolve<Metadata<IJob, string>>();
// prints: "connection-string-to-db"
Console.WriteLine(jobWithConnectionString.Data);
var alsoJobWithConnectionString = container.Resolve<ValueTuple<IJob, string>>();
// prints: "connection-string-to-db"
Console.WriteLine(alsoJobWithConnectionString.Item2);
var stillJobWithConnectionString = container.Resolve<Tuple<IJob, string>>();
// prints: "connection-string-to-db"
Console.WriteLine(stillJobWithConnectionString.Item2);
```
</TabItem>
<TabItem value="Collection filtering" label="Collection filtering">
```cs
container.Register<IService, Service1>(options => options
.WithMetadata("meta-1"));
container.Register<IService, Service2>(options => options
.WithMetadata("meta-2"));
container.Register<IService, Service3>(options => options
.WithMetadata(5));
// the result is: [Service1, Service2]
var servicesWithStringMetadata = container.Resolve<ValueTuple<IService, string>[]>();
// the result is: [Service3]
var servicesWithIntMetadata = container.Resolve<ValueTuple<IService, int>[]>();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
:::note
Metadata can also be a complex type e.g., an `IDictionary<,>`.
:::
:::info
When no service found for a particular metadata type, the container throws a [ResolutionFailedException](/docs/diagnostics/validation#resolution-validation). In case of an `IEnumerable<>` request, an empty collection will be returned for a non-existing metadata.
:::
<CodeDescPanel>
<div>
### KeyValuePair & ReadOnlyKeyValue
With named registration, you can give your service unique identifiers. Requesting a service wrapped in a `KeyValuePair<object, TYourService>` or `ReadOnlyKeyValue<object, TYourService>` returns the requested service with its identifier as key.
`ReadOnlyKeyValue<,>` is a type from the `Stashbox` package, so you might prefer using `KeyValuePair<,>` if you want to avoid referencing Stashbox in certain parts of your project.
Requesting an `IEnumerable<KeyValuePair<,>>` will return all services of the requested type along their identifiers. When a service don't have an identifier the `Key` will be set to `null`.
</div>
<div>
```cs
container.Register<IService, Service1>("FirstServiceId");
container.Register<IService, Service2>("SecondServiceId");
container.Register<IService, Service3>();
var serviceKeyValue1 = container
.Resolve<KeyValuePair<object, IService>>("FirstServiceId");
// prints: "FirstServiceId"
Console.WriteLine(serviceKeyValue1.Key);
var serviceKeyValue2 = container
.Resolve<ReadOnlyKeyValue<object, IService>>("SecondServiceId");
// prints: "SecondServiceId"
Console.WriteLine(serviceKeyValue2.Key);
// ["FirstServiceId": Service1, "SecondServiceId": Service2, null: Service3 ]
var servicesWithKeys = container.Resolve<KeyValuePair<object, IService>[]>();
```
</div>
</CodeDescPanel>
:::note
Wrappers can be composed e.g., `IEnumerable<Func<ILogger, Tuple<Lazy<IJob>, string>>>`.
:::
## User-defined wrappers & resolvers
You can add support for more wrapper types by implementing the `IServiceWrapper` interface.
```cs
class CustomWrapper : IServiceWrapper
{
// this method is supposed to generate the expression for the given wrapper's
// instantiation when it's selected by the container to resolve the actual service.
public Expression WrapExpression(
TypeInformation originalTypeInformation,
TypeInformation wrappedTypeInformation,
ServiceContext serviceContext)
{
// produce the expression for the wrapper.
}
// this method is called by the container to determine whether a
// given requested type is wrapped by a supported wrapper type.
public bool TryUnWrap(Type type, out Type unWrappedType)
{
// this is just a reference implementation of
// un-wrapping a service from a given wrapper.
if (!CanUnWrapServiceType(type))
{
unWrappedType = typeof(object);
return false;
}
unWrappedType = UnWrapServiceType(type);
return true;
}
}
```
You can extend the functionality of the container by implementing the `IServiceResolver` interface.
```cs
class CustomResolver : IServiceResolver
{
// called to generate the expression for the given service
// when this resolver is selected (through CanUseForResolution())
// to fulfill the request.
public ServiceContext GetExpression(
IResolutionStrategy resolutionStrategy,
TypeInformation typeInfo,
ResolutionContext resolutionContext)
{
var expression = GenerateExpression(); // resolution expression generation.
return expression.AsServiceContext();
}
public bool CanUseForResolution(
TypeInformation typeInfo,
ResolutionContext resolutionContext)
{
// the predicate that determines whether the resolver
// is able to resolve the requested service or not.
return IsUsableFor(typeInfo);
}
}
```
Then you can register your custom wrapper or resolver like this:
```cs
container.RegisterResolver(new CustomWrapper());
container.RegisterResolver(new CustomResolver());
```
## Visiting order
Stashbox visits the wrappers and resolvers in the following order to satisfy the actual resolution request:
1. `EnumerableWrapper`
2. `LazyWrapper`
3. `FuncWrapper`
4. `MetadataWrapper`
5. `KeyValueWrapper`
6. **Custom, user-defined wrappers & resolvers**
7. `ServiceProviderResolver`
8. `OptionalValueResolver`
9. `DefaultValueResolver`
10. `ParentContainerResolver`
11. `UnknownTypeResolver`
================================================
FILE: docs/docs/configuration/container-configuration.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Container configuration
<CodeDescPanel>
<div>
The container's constructor has an `Action<T>` parameter used to configure its behavior.
The configuration API is fluent, which means you can chain the configuration methods after each other.
</div>
<div>
```cs
var container = new StashboxContainer(options => options
.WithDisposableTransientTracking()
.WithConstructorSelectionRule(Rules.ConstructorSelection.PreferLeastParameters)
.WithRegistrationBehavior(Rules.RegistrationBehavior.ThrowException));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
**Re-configuration** of the container is also supported by calling its `.Configure()` method.
</div>
<div>
```cs
var container = new StashboxContainer();
container.Configure(options => options.WithDisposableTransientTracking());
```
</div>
</CodeDescPanel>
## Default configuration
These features are set by default:
- [Constructor selection](/docs/configuration/container-configuration#constructor-selection): `Rules.ConstructorSelection.PreferMostParameters`
- [Registration behavior](/docs/configuration/container-configuration#registration-behavior): `Rules.RegistrationBehavior.SkipDuplications`
- [Default lifetime](/docs/configuration/container-configuration#default-lifetime): `Lifetimes.Transient`
## Tracking disposable transients
<CodeDescPanel>
<div>
With this option, you can enable or disable the tracking of disposable transient objects.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithDisposableTransientTracking());
```
</div>
</CodeDescPanel>
## Auto member-injection
With this option, you can enable or disable the auto member-injection without [attributes](/docs/guides/service-resolution#attributes).
<CodeDescPanel>
<div>
### `PropertiesWithPublicSetter`
With this flag, the container will perform auto-injection on properties with public setters.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithAutoMemberInjection(
Rules.AutoMemberInjectionRules.PropertiesWithPublicSetter));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `PropertiesWithLimitedAccess`
With this flag, the container will perform auto-injection on properties even when they don't have a public setter.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithAutoMemberInjection(
Rules.AutoMemberInjectionRules.PropertiesWithLimitedAccess));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `PrivateFields`
With this flag, the container will perform auto-injection on private fields too.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithAutoMemberInjection(
Rules.AutoMemberInjectionRules.PrivateFields));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### Combined rules
You can also combine these flags with bitwise logical operators to get a merged ruleset.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithAutoMemberInjection(Rules.AutoMemberInjectionRules.PrivateFields |
Rules.AutoMemberInjectionRules.PropertiesWithPublicSetter));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
#### Member selection filter
You can pass your own member selection logic to control which members should be auto injected.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithAutoMemberInjection(
filter: member => member.Type != typeof(ILogger)));
```
</div>
</CodeDescPanel>
## Required member injection
<CodeDescPanel>
<div>
With this option, you can enable or disable the auto injection of members defined with C# 11's [`required`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/required) keyword.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithRequiredMemberInjection(enabled: false));
```
</div>
</CodeDescPanel>
:::note
The required member injection option is **enabled** by default.
:::
## Constructor selection
With this option, you can set the constructor selection rule used to determine which constructor the container should use for instantiation.
<CodeDescPanel>
<div>
### `PreferMostParameters`
It prefers the constructor which has the most extended parameter list.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithConstructorSelectionRule(
Rules.ConstructorSelection.PreferMostParameters));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `PreferLeastParameters`
It prefers the constructor which has the shortest parameter list.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithConstructorSelectionRule(
Rules.ConstructorSelection.PreferLeastParameters));
```
</div>
</CodeDescPanel>
## Registration behavior
With this option, you can set the actual behavior used when a new service is registered into the container. These options do not affect named registrations.
<CodeDescPanel>
<div>
### `SkipDuplications`
The container will skip new registrations when the given [implementation type](/docs/getting-started/glossary#service-type--implementation-type) is already registered.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithRegistrationBehavior(
Rules.RegistrationBehavior.SkipDuplications));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `ThrowException`
The container throws an [exception](/docs/diagnostics/validation#servicealreadyregisteredexception) when the given [implementation type](/docs/getting-started/glossary#service-type--implementation-type) is already registered.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithRegistrationBehavior(
Rules.RegistrationBehavior.ThrowException));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `ReplaceExisting`
The container will replace the already [registered service](/docs/getting-started/glossary#service-registration--registered-service) with the given one when they have the same [implementation type](/docs/getting-started/glossary#service-type--implementation-type).
</div>
<div>
```cs
new StashboxContainer(options => options
.WithRegistrationBehavior(
Rules.RegistrationBehavior.ReplaceExisting));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `PreserveDuplications`
The container will keep registering the new services with the same [implementation type](/docs/getting-started/glossary#service-type--implementation-type).
</div>
<div>
```cs
new StashboxContainer(options => options
.WithRegistrationBehavior(
Rules.RegistrationBehavior.PreserveDuplications));
```
</div>
</CodeDescPanel>
## Default lifetime
<CodeDescPanel>
<div>
With this option, you can set the default lifetime used when a service doesn't have a configured one.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithDefaultLifetime(Lifetimes.Scoped));
```
</div>
</CodeDescPanel>
## Lifetime validation
<CodeDescPanel>
<div>
With this option, you can enable or disable the life-span and [root scope](/docs/getting-started/glossary#root-scope) resolution [validation](/docs/diagnostics/validation#lifetime-validation) on the dependency tree.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithLifetimeValidation());
```
</div>
</CodeDescPanel>
## Generic variance
<CodeDescPanel>
<div>
With this option, you can enable or disable the check for [generic covariance and contravariance](/docs/advanced/generics#variance) during the resolution of generic type collections.
_This option is enabled by default_.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithVariantGenericTypes());
```
</div>
</CodeDescPanel>
## Empty collection handling
<CodeDescPanel>
<div>
With this option, you can enable or disable the throwing of a `ResolutionFailedException` when no services are found for a collection resolution request. When this feature is disabled _(default)_, the container returns an empty array for those request.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithExceptionOverEmptyCollection());
```
</div>
</CodeDescPanel>
## Conventional resolution
<CodeDescPanel>
<div>
With this option, you can enable or disable conventional resolution, which means the container treats the constructor/method parameter or member names as dependency names used by [named resolution](/docs/getting-started/glossary#named-resolution).
</div>
<div>
```cs
new StashboxContainer(options => options
.TreatParameterAndMemberNameAsDependencyName());
```
</div>
</CodeDescPanel>
## Using named service for un-named requests
<CodeDescPanel>
<div>
With this option, you can enable or disable the selection of named registrations when the resolution request is un-named but with the same type.
The `enabledForCollectionRequests` argument controls whether named registrations should be returned for an unnamed collection resolution request. It's **enabled** by default.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithNamedDependencyResolutionForUnNamedRequests(
enabled: true,
enabledForCollectionRequests: true
));
```
</div>
</CodeDescPanel>
## Named service resolution
<CodeDescPanel>
<div>
### `WithUniversalName`
Sets the universal name that represents a special name which allows named resolution work for any given name.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithUniversalName("Any"));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithAdditionalDependencyNameAttribute`
Adds an attribute type that is considered a dependency name indicator just like the [`DependencyName` attribute](/docs/guides/service-resolution#attributes).
</div>
<div>
```cs
new StashboxContainer(options => options
.WithAdditionalDependencyNameAttribute<CustomNameAttribute>());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithAdditionalDependencyAttribute`
Adds an attribute type that is considered a dependency indicator just like the [`Dependency` attribute](/docs/guides/service-resolution#attributes).
</div>
<div>
```cs
new StashboxContainer(options => options
.WithAdditionalDependencyAttribute<CustomDependencyAttribute>());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithIgnoreServicesWithUniversalNameForUniversalNamedRequests`
Enables or disables the selection of services with `UniversalName` for a universal named resolution request.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithIgnoreServicesWithUniversalNameForUniversalNamedRequests());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithForceThrowWhenNamedDependencyIsNotResolvable`
Enables or disables throwing a `ResolutionFailedException` when a named dependency is not resolvable. Requests initiated by `.ResolveOrDefault()` may also throw when a named subdependency is not resolvable for example through the `Dependency` attribute.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithForceThrowWhenNamedDependencyIsNotResolvable());
```
</div>
</CodeDescPanel>
## Overriding the exception thrown upon resolution failure
<CodeDescPanel>
<div>
With this option, you can override the default `ResolutionFailedException` type thrown when the service resolution fails.
The details of the exception remain the same, only the type gets overridden.
</div>
<div>
```cs
new StashboxContainer(options => options
.OverrideResolutionFailedExceptionWith<InvalidOperationException>());
```
</div>
</CodeDescPanel>
## Default value injection
<CodeDescPanel>
<div>
With this option, you can enable or disable the default value injection.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithDefaultValueInjection());
```
</div>
</CodeDescPanel>
## Unknown type resolution
<CodeDescPanel>
<div>
With this option, you can enable or disable the resolution of unregistered types. You can also use a configurator delegate to configure the registrations the container will create from the unknown types.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithUnknownTypeResolution(config => config.AsImplementedTypes()));
```
</div>
</CodeDescPanel>
## Custom compiler
<CodeDescPanel>
<div>
With this option, you can set an external expression tree compiler. It can be useful on platforms where the IL generator modules are not available; therefore, the expression compiler in Stashbox couldn't work.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithExpressionCompiler(
Rules.ExpressionCompilers.MicrosoftExpressionCompiler));
```
</div>
</CodeDescPanel>
## Re-build singletons in child containers
<CodeDescPanel>
<div>
With this option, you can enable or disable the re-building of singletons in child containers. It allows the child containers to override singleton dependencies in the parent.
</div>
<div>
```cs
new StashboxContainer(options => options
.WithReBuildSingletonsInChildContainer());
```
</div>
</CodeDescPanel>
:::note
This feature is not affecting the already built singleton instances in the parent.
:::
================================================
FILE: docs/docs/configuration/registration-configuration.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Registration configuration
<CodeDescPanel>
<div>
Most of the registration methods have an `Action<TOptions>` parameter, enabling several customization options on the given registration.
Here are three examples that show how the API's usage looks like.
They cover the exact functionalities you've read about in the [basics](/docs/guides/basics) section but are achieved with the options API.
</div>
<div>
<Tabs>
<TabItem value="Named" label="Named">
This is how you can use the options API to set a registration's name:
```cs
container.Register<IJob, DbBackup>(options => options
.WithName("DbBackup"));
```
</TabItem>
<TabItem value="Lifetime" label="Lifetime">
It was mentioned in the [Lifetime shortcuts](/docs/guides/basics#lifetime-shortcuts) section, that those methods are only sugars; under the curtain, they are also using this API:
```cs
container.Register<IJob, DbBackup>(options => options
.WithLifetime(Lifetimes.Singleton));
```
</TabItem>
<TabItem value="Instance" label="Instance">
An example of how you can register an instance with the options API:
```cs
container.Register<IJob, DbBackup>(options => options
.WithInstance(new DbBackup()));
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
The registration configuration API is fluent, which means all option methods can be chained after each other.
This provides an easier way to configure complicated registrations.
</div>
<div>
```cs
container.Register<IJob, DbBackup>(options => options
.WithName("DbBackup")
.WithLifetime(Lifetimes.Singleton)
.WithoutDisposalTracking());
```
</div>
</CodeDescPanel>
## General options
<CodeDescPanel>
<div>
### `WithName`
Sets the name identifier of the registration.
</div>
<div>
```cs
container.Register<ILogger, ConsoleLogger>(config => config
.WithName("Console"));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithInstance`
Sets an existing instance for the registration.
Passing true for the `wireUp` parameter means that the container performs member / method injection on the registered instance.
</div>
<div>
<Tabs>
<TabItem value="Instance" label="Instance">
```cs
container.Register<ILogger>(options => options
.WithInstance(new ConsoleLogger()));
```
</TabItem>
<TabItem value="WireUp" label="WireUp">
```cs
container.Register<ILogger>(options => options
.WithInstance(new ConsoleLogger(), wireUp: true));
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithoutDisposalTracking`
Force disables the disposal tracking on the registration.
</div>
<div>
```cs
container.Register<ILogger, ConsoleLogger>(options => options
.WithoutDisposalTracking());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithMetadata`
Sets additional metadata for the registration. It's attached to the service upon its resolution through `ValueTuple<,>`, `Tuple<,>`, or `Metadata<,>` wrappers.
</div>
<div>
```cs
container.Register<IJob, DbBackup>(options => options
.WithMetadata(connectionString));
var jobWithConnectionString = container.Resolve<ValueTuple<IJob, string>>();
Console.WriteLine(jobWithConnectionString.Item2); // prints the connection string.
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithDynamicResolution`
Indicates that the service's resolution should be handled by a dynamic `Resolve()` call on the current `IDependencyResolver` instead of a pre-built instantiation expression.
</div>
<div>
```cs
container.Register<IJob, DbBackup>();
container.Register<ILogger, ConsoleLogger>(options => options
.WithDynamicResolution());
// new DbBackup(currentScope.Resolve<ILogger>());
var job = container.Resolve<IJob>();
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `HasServiceType`
Used to build conditions based on service type in batch/assembly registrations.
It determines whether the registration is mapped to the given service type.
</div>
<div>
```cs
container.RegisterAssemblyContaining<IService1>(configurator: options =>
{
if (options.HasServiceType<IService2>())
options.WithScopedLifetime();
});
```
</div>
</CodeDescPanel>
## Initializer / finalizer
<CodeDescPanel>
<div>
### `WithFinalizer`
Sets a custom cleanup delegate that will be invoked when the scope / container holding the instance is being disposed.
</div>
<div>
```cs
container.Register<ILogger, FileLogger>(options => options
.WithFinalizer(logger => logger
.CloseFile()));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithInitializer`
Sets a custom initializer delegate that will be invoked when the given service is being instantiated.
</div>
<div>
```cs
container.Register<ILogger, FileLogger>(options => options
.WithInitializer((logger, resolver) => logger
.OpenFile()));
```
</div>
</CodeDescPanel>
## Replace
<Tabs>
<TabItem value="ReplaceExisting" label="ReplaceExisting">
Indicates whether the container should replace an existing registration with the current one (based on [implementation type](/docs/getting-started/glossary#service-type--implementation-type) and name). If there's no existing registration in place, the actual one will be added to the registration list.
```cs
container.Register<ILogger, ConsoleLogger>(options => options
.ReplaceExisting());
```
</TabItem>
<TabItem value="ReplaceOnlyIfExists" label="ReplaceOnlyIfExists">
The same as `ReplaceExisting()` except that the container will do the replace only when there's an already [registered service](/docs/getting-started/glossary#service-registration--registered-service) with the same type or name.
```cs
container.Register<ILogger, ConsoleLogger>(options => options
.ReplaceOnlyIfExists());
```
</TabItem>
</Tabs>
## Multiple services
You can read more about binding a registration to multiple services [here](/docs/guides/advanced-registration#binding-to-multiple-services).
<CodeDescPanel>
<div>
### `AsImplementedTypes`
The service will be mapped to all of its implemented interfaces and base types.
</div>
<div>
```cs
container.Register<IUserRepository, UserRepository>(options => options
.AsImplementedTypes());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `AsServiceAlso`
Binds the currently configured registration to an additional [service type](/docs/getting-started/glossary#service-type--implementation-type). The registered type must implement or extend the additional [service type](/docs/getting-started/glossary#service-type--implementation-type).
</div>
<div>
```cs
container.Register<IUserRepository, UserRepository>(options => options
.AsServiceAlso<IRepository>()
// or
.AsServiceAlso(typeof(IRepository)));
```
</div>
</CodeDescPanel>
## Dependency configuration
These options allows the same configuration functionality as the [dependency attribute](/docs/guides/service-resolution#attributes).
<Tabs>
<TabItem value="By parameter type" label="By parameter type">
Binds a constructor / method parameter or a property / field to a named registration by the parameter's type. The container will perform a [named resolution](/docs/getting-started/glossary#named-resolution) on the bound dependency. The second parameter used to set the name of the dependency.
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithDependencyBinding(typeof(ILogger), "FileLogger"));
```
</TabItem>
<TabItem value="By parameter name" label="By parameter name">
Binds a constructor / method parameter or a property / field to a named registration by the parameter's name. The container will perform a [named resolution](/docs/getting-started/glossary#named-resolution) on the bound dependency. The second parameter used to set the name of the dependency.
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithDependencyBinding("logger", "FileLogger"));
```
</TabItem>
<TabItem value="By expression" label="By expression">
Marks a member (property / field) as a dependency that should be filled by the container. The second parameter used to set the name of the dependency.
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithDependencyBinding(logger => logger.Logger, "ConsoleLogger"));
```
</TabItem>
</Tabs>
## Lifetime
You can read more about lifetimes [here](/docs/guides/lifetimes).
<CodeDescPanel>
<div>
### `WithSingletonLifetime`
Sets a singleton lifetime for the registration.
</div>
<div>
```cs
container.Register<ILogger, ConsoleLogger>(config => config
.WithSingletonLifetime());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithScopedLifetime`
Sets a scoped lifetime for the registration.
</div>
<div>
```cs
container.Register<ILogger, ConsoleLogger>(config => config
.WithScopedLifetime());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithPerRequestLifetime`
Sets the lifetime to `PerRequestLifetime`. This lifetime will create a new instance between resolution requests. Within the request the same instance will be re-used.
</div>
<div>
```cs
container.Register<ILogger, ConsoleLogger>(options => options
.WithPerRequestLifetime());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithAutoLifetime`
Sets the lifetime to auto lifetime. This lifetime aligns to the lifetime of the resolved service's dependencies. When the underlying service has a dependency with a higher lifespan, this lifetime will inherit that lifespan up to a given boundary.
</div>
<div>
```cs
container.Register<ILogger, ConsoleLogger>(options => options
.WithAutoLifetime(Lifetimes.Scoped /* boundary lifetime */));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithLifetime`
Sets a custom lifetime for the registration.
</div>
<div>
```cs
container.Register<ILogger, ConsoleLogger>(config => config
.WithLifetime(new CustomLifetime()));
```
</div>
</CodeDescPanel>
## Conditions
You can read more about the concept of conditional resolution [here](/docs/guides/service-resolution#conditional-resolution).
<CodeDescPanel>
<div>
### `WhenHas`
Sets an attribute condition for the registration.
</div>
<div>
```cs
container.Register<ILogger, ConsoleLogger>(config => config
.WhenHas<ConsoleAttribute>());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WhenResolutionPathHas`
Sets a resolution path condition for the registration. The service will be selected only in the resolution path of the target that has the given attribute.
This means that only the direct and sub-dependencies of the target type that has the given attribute will get the configured service.
</div>
<div>
```cs
container.Register<ILogger, ConsoleLogger>(config => config
// Each direct and sub-dependency of any service that has
// a ConsoleAttribute will get FileLogger wherever they
// depend on ILogger.
.WhenResolutionPathHas<ConsoleAttribute>());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WhenDependantIs`
Sets a parent target condition for the registration.
</div>
<div>
```cs
container.Register<ILogger, FileLogger>(config => config
.WhenDependantIs<UserRepository>());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WhenInResolutionPathOf`
Sets a resolution path condition for the registration. The service will be selected only in the resolution path of the given target.
This means that only the direct and sub-dependencies of the target type will get the configured service.
</div>
<div>
```cs
container.Register<ILogger, FileLogger>(config => config
// Each direct and sub-dependency of UserRepository
// will get FileLogger wherever they depend on ILogger.
.WhenInResolutionPathOf<UserRepository>());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `When`
Sets a custom user-defined condition for the registration.
</div>
<div>
```cs
container.Register<ILogger, FileLogger>(config => config
.When(typeInfo => typeInfo.ParentType == typeof(UserRepository)));
```
</div>
</CodeDescPanel>
## Constructor selection
<CodeDescPanel>
<div>
### `WithConstructorSelectionRule`
Sets the constructor selection rule for the registration.
</div>
<div>
```cs
container.Register<ILogger>(options => options
.WithConstructorSelectionRule(...));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
#### PreferMostParameters
Selects the constructor which has the longest parameter list.
</div>
<div>
```cs
options.WithConstructorSelectionRule(
Rules.ConstructorSelection.PreferMostParameters)
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
#### PreferLeastParameters
Selects the constructor which has the shortest parameter list.
</div>
<div>
```cs
options.WithConstructorSelectionRule(
Rules.ConstructorSelection.PreferLeastParameters)
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
#### Custom
You can set your own custom constructor ordering logic.
</div>
<div>
```cs
options.WithConstructorSelectionRule(
constructors => { /* custom constructor sorting logic */ })
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithConstructorByArgumentTypes`
Selects a constructor by its argument types.
</div>
<div>
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithConstructorByArgumentTypes(typeof(ILogger)));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithConstructorByArguments`
Selects a constructor by its arguments to use during resolution. These arguments are used to invoke the selected constructor.
</div>
<div>
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithConstructorByArguments(new ConsoleLogger()));
```
</div>
</CodeDescPanel>
## Property / field Injection
<CodeDescPanel>
<div>
### `WithAutoMemberInjection`
Enables the auto member injection and sets the rule for it.
</div>
<div>
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithAutoMemberInjection(...));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
#### PropertiesWithPublicSetter
With this flag, the container will perform auto-injection on properties with a public setter.
</div>
<div>
```cs
options.WithAutoMemberInjection(
Rules.AutoMemberInjectionRules.PropertiesWithPublicSetter)
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
#### PropertiesWithLimitedAccess
With this flag, the container will perform auto-injection on properties which has a non-public setter as well.
</div>
<div>
```cs
options.WithAutoMemberInjection(
Rules.AutoMemberInjectionRules.PropertiesWithLimitedAccess)
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
#### PrivateFields
With this flag, the container will perform auto-injection on private fields too.
</div>
<div>
```cs
options.WithAutoMemberInjection(
Rules.AutoMemberInjectionRules.PrivateFields)
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
#### Combined rules
As these rules are [bit flags](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/enum#enumeration-types-as-bit-flags), you can use them combined together with bitwise logical operators.
</div>
<div>
```cs
options.WithAutoMemberInjection(Rules.AutoMemberInjectionRules.PrivateFields |
Rules.AutoMemberInjectionRules.PropertiesWithPublicSetter)
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
#### Member selection filter
You can pass your own member selection logic to control which members should be auto injected.
</div>
<div>
```cs
container.Register<ILogger, ConsoleLogger>(options => options
.WithAutoMemberInjection(filter: member => member.Type != typeof(ILogger)));
```
</div>
</CodeDescPanel>
## Required member injection
<CodeDescPanel>
<div>
With this option, you can enable or disable the auto injection of members defined with C# 11's [`required`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/required) keyword.
</div>
<div>
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithRequiredMemberInjection(enabled: false));
```
</div>
</CodeDescPanel>
:::note
The required member injection option is **enabled** by default.
:::
## Injection parameters
<CodeDescPanel>
<div>
### `WithInjectionParameters`
Sets multiple injection parameters for the registration.
</div>
<div>
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithInjectionParameters(new KeyValuePair<string, object>("logger", new ConsoleLogger()));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WithInjectionParameter`
Sets a single injection parameter for the registration.
</div>
<div>
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithInjectionParameter("logger", new ConsoleLogger());
```
</div>
</CodeDescPanel>
## Factory
You can read more about the concept of factory registration [here](/docs/guides/advanced-registration?id=factory-registration).
<Tabs>
<TabItem value="Parameterized" label="Parameterized">
**WithFactory** - Sets a factory delegate that could take various number of pre-resolved dependencies as parameters and returns the service instance.
```cs
// 1 parameter factory
container.Register<IUserRepository, UserRepository>(options => options
.WithFactory<ILogger>(logger => new UserRepository(logger));
// 2 parameters factory
container.Register<IUserRepository, UserRepository>(options => options
.WithFactory<ILogger, IDbContext>((logger, context) => new UserRepository(logger, context));
// 3 parameters factory
container.Register<IUserRepository, UserRepository>(options => options
.WithFactory<ILogger, IDbContext, IOptions>((logger, context, options) =>
new UserRepository(logger, context, options));
// 4 parameters factory
container.Register<IUserRepository, UserRepository>(options => options
.WithFactory<ILogger, IDbConnection, IOptions, IUserValidator>((logger, connection, options, validator) =>
new UserRepository(logger, connection, options, validator));
// 5 parameters factory
container.Register<IUserRepository, UserRepository>(options => options
.WithFactory<ILogger, IDbConnection, IOptions, IUserValidator, IPermissionManage>(
(logger, connection, options, validator, permissionManager) =>
new UserRepository(logger, connection, options, validator, permissionManager));
```
You can also get the current [dependency resolver](/docs/getting-started/glossary#dependency-resolver) as a pre-resolved parameter:
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithFactory<ILogger, IDependencyResolver>((logger, resolver) =>
new UserRepository(logger, resolver.Resolve<IDbConnection>())));
```
</TabItem>
<TabItem value="Parameter-less" label="Parameter-less">
**WithFactory** - Sets a parameter-less factory delegate that returns the service instance.
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithFactory(()) => new UserRepository(new ConsoleLogger()));
```
</TabItem>
<TabItem value="Resolver parameter" label="Resolver parameter">
**WithFactory** - Sets a factory delegate that takes an `IDependencyResolver` as parameter and returns the service instance.
```cs
container.Register<IUserRepository, UserRepository>(options => options
.WithFactory(resolver => new UserRepository(resolver.Resolve<ILogger>()));
```
</TabItem>
</Tabs>
:::info
All factory configuration method has an `isCompiledLambda` parameter which should be set to `true` if the passed delegate is compiled from an `Expression` tree.
:::
## Scope definition
You can read more about the concept of defined scopes [here](/docs/guides/scopes?id=service-as-scope).
<CodeDescPanel>
<div>
### `InNamedScope`
Sets a scope name condition for the registration; it will be used only when a scope with the same name requests it.
</div>
<div>
```cs
container.Register<IUserRepository, UserRepository>(options => options
.InNamedScope("UserRepo"));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `InScopeDefinedBy`
Sets a condition for the registration; it will be used only within the scope defined by the given type.
</div>
<div>
```cs
container.Register<ILogger, ConsoleLogger>(options => options
.InScopeDefinedBy<UserRepository>());
container.Register<IUserRepository, UserRepository>(options => options
.DefinesScope());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `DefinesScope`
This registration is used as a logical scope for it's dependencies. Dependencies registered with `InNamedScope()` with the same name are preferred during resolution.
When the `name` is not set, the [service type](/docs/getting-started/glossary#service-type--implementation-type) is used as the name. Dependencies registered with `InScopeDefinedBy()` are selected.
</div>
<div>
```cs
container.Register<IUserRepository, UserRepository>(options => options
.DefinesScope("UserRepo"));
// or
container.Register<IUserRepository, UserRepository>(options => options
.DefinesScope());
```
</div>
</CodeDescPanel>
## Decorator specific
You can read more about decorators [here](/docs/advanced/decorators).
<CodeDescPanel>
<div>
### `WhenDecoratedServiceIs`
Sets a decorated target condition for the registration.
</div>
<div>
```cs
container.RegisterDecorator<ILogger, LoggerDecorator>(options => options
.WhenDecoratedServiceIs<FileLogger>());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `WhenDecoratedServiceHas`
Sets an attribute condition that the decorated target has to satisfy.
</div>
<div>
```cs
container.RegisterDecorator<ILogger, LoggerDecorator>(options => options
.WhenDecoratedServiceHas<DetailedLoggingAttribute>());
```
</div>
</CodeDescPanel>
## Unknown registration specific
You can read more about unknown type resolution [here](/docs/advanced/special-resolution-cases#unknown-type-resolution).
<CodeDescPanel>
<div>
### `SetImplementationType`
Sets the current registration's [implementation type](/docs/getting-started/glossary#service-type--implementation-type).
</div>
<div>
```cs
var container = new StashboxContainer(c => c.WithUnknownTypeResolution(config =>
{
if (config.ServiceType == typeof(IService))
config.SetImplementationType(typeof(Service));
}));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### `Skip`
Marks the current unknown type registration as skipped.
</div>
<div>
```cs
var container = new StashboxContainer(c => c.WithUnknownTypeResolution(config =>
{
if (config.ServiceType == typeof(IService))
config.Skip();
}));
```
</div>
</CodeDescPanel>
================================================
FILE: docs/docs/diagnostics/utilities.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Utilities
## Is registered?
<CodeDescPanel>
<div>
With the `IsRegistered()` function, you can find out whether a service is registered into the container or not.
It returns `true` only when the container has a registration with the given type (and name). It only checks the actual container's registrations. For every cases, you should use the `CanResolve()` method.
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Generic API" label="Generic API">
```cs
bool isIJobRegistered = container.IsRegistered<IJob>();
```
</TabItem>
<TabItem value="Runtime type API" label="Runtime type API">
```cs
bool isIJobRegistered = container.IsRegistered(typeof(IJob));
```
</TabItem>
<TabItem value="Named" label="Named">
#### **Named**
```cs
bool isIJobRegistered = container.IsRegistered<IJob>("DbBackup");
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Can resolve?
<CodeDescPanel>
<div>
There might be cases when you are more interested in whether a service is resolvable from the container's actual state rather than finding out whether it's registered.
`CanResolve()` returns `true` only when at least one of the following is true:
- The requested type is registered in the current or one of the parent containers.
- The requested type is a closed generic type, and its open generic definition is registered.
- The requested type is a wrapper (`IEnumerable<>`, `Lazy<>`, `Func<>`, `KeyValuePair<,>`, `ReadOnlyKeyValue<,>`, `Metadata<,>`, `ValueTuple<,>`, or `Tuple<,>`), and the underlying type is registered.
- The requested type is not registered, but it's resolvable, and [unknown type resolution](/docs/configuration/container-configuration#unknown-type-resolution) is enabled.
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Generic API" label="Generic API">
```cs
bool isIJobResolvable = container.CanResolve<IJob>();
```
</TabItem>
<TabItem value="Runtime type API" label="Runtime type API">
```cs
bool isIJobResolvable = container.CanResolve(typeof(IJob));
```
</TabItem>
<TabItem value="Named" label="Named">
```cs
bool isIJobResolvable = container.CanResolve<IJob>("DbBackup");
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Get all mappings
<CodeDescPanel>
<div>
You can get all registrations in a key-value pair collection (where the key is the [service type](/docs/getting-started/glossary#service-type--implementation-type) and the value is the actual registration) by calling the `.GetRegistrationMappings()` method.
</div>
<div>
```cs
IEnumerable<KeyValuePair<Type, ServiceRegistration>> mappings =
container.GetRegistrationMappings();
```
</div>
</CodeDescPanel>
## Registration diagnostics
<CodeDescPanel>
<div>
You can get a much more readable version of the registration mappings by calling the `.GetRegistrationDiagnostics()` method.
`RegistrationDiagnosticsInfo` has an overridden `.ToString()` method that returns the mapping details formatted in a human-readable form.
</div>
<div>
```cs
container.Register<IJob, DbBackup>("DbBackupJob");
container.Register(typeof(IEventHandler<>), typeof(EventHandler<>));
IEnumerable<RegistrationDiagnosticsInfo> diagnostics =
container.GetRegistrationDiagnostics();
diagnostics.ForEach(Console.WriteLine);
// output:
// IJob => DbBackup, name: DbBackupJob
// IEventHandler<> => EventHandler<>, name: null
```
</div>
</CodeDescPanel>
================================================
FILE: docs/docs/diagnostics/validation.md
================================================
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Validation
Stashbox validation routines help you detect and solve common misconfiguration issues. You can verify the container's actual state with its `.Validate()` method. It walks through the whole [resolution tree](/docs/getting-started/glossary#resolution-tree) and collects all issues into an `AggregateException`.
## Registration validation
During registration, the container validates the passed types and throws the following exceptions when the validation fails.
### InvalidRegistrationException
1. **When the [implementation type](/docs/getting-started/glossary#service-type--implementation-type) is not resolvable.** (it's an interface or an abstract class registered like: `Register<IService>()`):
```
The type Namespace.IService could not be resolved. It's probably an interface, abstract class, or primitive type.
```
2. **When the [implementation type](/docs/getting-started/glossary#service-type--implementation-type) does not implement the [service type](/docs/getting-started/glossary#service-type--implementation-type)**.
```
The type Namespace.MotorCycle does not implement the '[service type](/docs/getting-started/glossary#service-type--implementation-type)' Namespace.ICar.
```
### ServiceAlreadyRegisteredException
**When the given [implementation type](/docs/getting-started/glossary#service-type--implementation-type) is already registered** and the `RegistrationBehavior` [container configuration option](/docs/configuration/container-configuration#registration-behavior) is set to `ThrowException`:
```
The type Namespace.Service is already registered.
```
## Resolution validation
During the [resolution tree's](/docs/getting-started/glossary#resolution-tree) construction, the container continuously checks its actual state to ensure stability. When any of the following issues occur, the container throws a `ResolutionFailedException`.
1. **When a dependency is missing from the [resolution tree](/docs/getting-started/glossary#resolution-tree)**.
<Tabs>
<TabItem value="Parameter" label="Parameter">
```cs
class Service
{
public Service(Dependency dep) { }
public Service(Dependency2 dep2) { }
}
container.Register<Service>();
var service = container.Resolve<Service>();
```
This will result in the following exception message:
```
Could not resolve type Namespace.Service.
Constructor Void .ctor(Dependency) found with unresolvable parameter: (Namespace.Dependency)dep.
Constructor Void .ctor(Dependency2) found with unresolvable parameter: (Namespace.Dependency2)dep2.
```
</TabItem>
<TabItem value="Property / field" label="Property / field">
```cs
class Service
{
public Dependency Dep { get; set; }
}
container.Register<Service>(options => options.WithDependencyBinding(s => s.Dep));
var service = container.Resolve<Service>();
```
This will show the following message:
```
Could not resolve type Namespace.Service.
Unresolvable property: (Namespace.Dependency)Dep.
```
</TabItem>
</Tabs>
2. **When the requested type is unresolvable.** E.g., it doesn't have a public constructor.
```
Could not resolve type Namespace.Service.
Service is not registered or unresolvable type requested.
```
## Lifetime validation
This validation enforces the following rules. When they are violated, the container throws a `LifetimeValidationFailedException`.
1. **When a scoped service is requested from the [root scope](/docs/getting-started/glossary#root-scope)**.
As the [root scope's](/docs/getting-started/glossary#root-scope) lifetime is bound to the container's lifetime, this action unintentionally promotes the scoped service's lifetime to singleton:
```
Resolution of Namespace.Service (ScopedLifetime) from the '[root scope](/docs/getting-started/glossary#root-scope)' is not allowed,
that would promote the service's lifetime to a singleton.
```
2. **When the life-span of a dependency is shorter than its parent's**.
It's called [captive dependency](https://blog.ploeh.dk/2014/06/02/captive-dependency/). Every lifetime has a `LifeSpan` value, which determines how long the related service lives. The main rule is that services may not contain dependencies with shorter life spans. E.g., singletons should not depend on scoped services. The only exception is the life span value `0`, which indicates that the related service is state-less and could be injected into any service.
These are the `LifeSpan` values of the pre-defined lifetimes:
- **Singleton**: 20
- **Scoped**: 10
- **NamedScope**: 10
- **PerRequest**: 0
- **Transient**: 0
In case of a failed validation the exception message would be:
```
The life-span of Namespace.Service (ScopedLifetime|10) is shorter than
its direct or indirect parent's Namespace.Dependency (Singleton|20).
This could lead to incidental lifetime promotions with longer life-span,
it's recommended to double-check your lifetime configurations.
```
## Circular dependency
When the container encounters a circular dependency loop in the [resolution tree](/docs/getting-started/glossary#resolution-tree), it throws a `ResolutionFailedException`.
```cs
class Service1
{
public Service1(Service2 service2) { }
}
class Service2
{
public Service2(Service1 service1) { }
}
container.Register<Service1>();
container.Register<Service2>();
var service = container.Resolve<Service1>();
```
The exception message is:
```
Circular dependency was detected while resolving Namespace.Service1.
```
## Other exceptions
### CompositionRootNotFoundException
This exception pops up when we try to compose an assembly, but it doesn't contain an `ICompositionRoot` implementation.
```cs
container.ComposeAssembly(typeof(Service).Assembly);
```
The exception message is:
```
No ICompositionRoot found in the given assembly: {your-assembly-name}
```
### ConstructorNotFoundException
During the registration phase, when you are using the [`WithConstructorByArgumentTypes()`](/docs/configuration/registration-configuration#withconstructorbyargumenttypes) or [`WithConstructorByArguments()`](/docs/configuration/registration-configuration#withconstructorbyarguments) options, you can accidentally point to a non-existing constructor. In that case, the container throws a `ConstructorNotFoundException`.
```cs
class Service
{
public Service(Dependency dep) { }
}
container.Register<Service>(options => options.WithConstructorByArgumentTypes(typeof(string), typeof(int)));
```
The exception message is:
```
Constructor not found for Namespace.Service with the given argument types: System.String, System.Int32.
```
================================================
FILE: docs/docs/getting-started/glossary.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
# Glossary
The following terms and definitions are used in this documentation.
## Service type | Implementation type
The *Service type* is usually an interface or an abstract class type used for service resolution or dependency injection. The *Implementation type* is the actual type registered to the *Service type*. A registration maps the *Service type* to an *Implementation type*. The *Implementation type* must implement or extend the *Service type*.
<CodeDescPanel>
<div>
Example where a *Service type* is mapped to an *Implementation type*:
</div>
<div>
```cs
container.Register<IService, Implementation>();
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
The *Service type* used for requesting a service from the container:
</div>
<div>
```cs
container.Resolve<IService>(); // returns Implementation
```
</div>
</CodeDescPanel>
## Service registration | Registered service
It's an entity created by Stashbox when a service is registered. The service registration stores required information about how to instantiate the service, e.g., reflected type information, name, lifetime, conditions, and more.
<CodeDescPanel>
<div>
In this example, we are registering a named service. The container will create a service registration entity to store the type mapping and the name. During resolution, the container will find the registration by checking for the *Service type* and the *name*.
</div>
<div>
```cs
// the registration entity will look like:
// IService => Implementation, name: Example
container.Register<IService, Implementation>("Example");
var service = container.Resolve<IService>("Example");
```
</div>
</CodeDescPanel>
## Injectable dependency
<CodeDescPanel>
<div>
It's a constructor/method argument or a property/field of a registered *Implementation type* that gets evaluated (*injected*) by Stashbox during the service's construction.
In this example, `Implementation` has an `IDependency` *injectable dependency* in its constructor.
</div>
<div>
```cs
class Implementation : IService
{
public Implementation(IDependency dependency)
{ }
}
```
</div>
</CodeDescPanel>
## Resolution tree
It's the structural representation of a service's resolution process. It describes the instantiation order of the dependencies required to resolve the desired type.
Let's see through an example:
```cs
class A
{
public A(B b, C c) { }
}
class B
{
public B(C c, D d) { }
}
class C { }
class D { }
```
When we request the service `A`, the container constructs the following resolution tree based on the dependencies and sub-dependencies.
```
A
/ \
B C
/ \
C D
```
The container instantiates those services first that don't have any dependencies. `C` and `D` will be injected into `B`. Then, a new `C` is instantiated (if it's [transient](/docs/guides/lifetimes#transient-lifetime)) and injected into `A` along with the previously created `B`.
## Dependency resolver
It's the container itself or the [current scope](/docs/guides/scopes), depending on which was asked to resolve a particular service. They are both implementing Stashbox's `IDependencyResolver` and the .NET framework's `IServiceProvider` interface and can be used for service resolution.
:::info
Stashbox implicitly injects the [current scope](/docs/guides/scopes) wherever `IDependencyResolver` or `IServiceProvider` is requested.
:::
## Root scope
It's the [main scope](/docs/guides/scopes) created inside every container instance. It stores and handles the lifetime of all singletons. It's the base of each subsequent scope created by the container with the `.BeginScope()` method.
:::caution
[Scoped services](/docs/guides/lifetimes#scoped-lifetime) requested from the container (and not from a [scope](/docs/guides/scopes)) are managed by the root scope. This can lead to issues because their lifetime will effectively switch to singleton. Always be sure that you don't resolve scoped services directly from the container, only from a [scope](/docs/guides/scopes). This case is monitored by the [lifetime](/docs/diagnostics/validation#lifetime-validation) validation rule when it's [enabled](/docs/configuration/container-configuration#lifetime-validation).
:::
## Named resolution
<CodeDescPanel>
<div>
It's a resolution request for a named service. The same applies, when the container sees a dependency in the resolution tree with a name (set by [attributes](/docs/guides/service-resolution#attributes) or [bindings](/docs/guides/service-resolution#dependency-binding)); it will search for a matching [Named registration](/docs/guides/basics#named-registration) to inject.
</div>
<div>
```cs
container.Register<IService, Implementation>("Example");
// the named request.
var service = container.Resolve<IService>("Example");
```
</div>
</CodeDescPanel>
## Self registration
<CodeDescPanel>
<div>
It's a service registration that's mapped to itself. This means its service and implementation type is the same.
</div>
<div>
```cs
// equivalent to container.Register<Implementation, Implementation>();
container.Register<Implementation>();
```
</div>
</CodeDescPanel>
================================================
FILE: docs/docs/getting-started/introduction.md
================================================
---
title: Introduction
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Stashbox and its extensions are distributed via [NuGet](https://www.nuget.org/packages?q=stashbox) packages.
<Tabs>
<TabItem value="Package Manager" label="Package Manager">
You can install the package by typing the following into the Package Manager Console:
```powershell
Install-Package Stashbox -Version 5.20.0
```
</TabItem>
<TabItem value="dotnet CLI" label="dotnet CLI">
You can install the package by using the dotnet cli:
```bash
dotnet add package Stashbox --version 5.20.0
```
</TabItem>
<TabItem value="PackageReference" label="PackageReference">
You can add the package into the package references of your `.csproj`:
```xml
<PackageReference Include="Stashbox" Version="5.20.0" />
```
</TabItem>
</Tabs>
## Usage
The general idea behind using Stashbox is that you structure your code with loosely coupled components with the [Dependency Inversion Principle](https://en.wikipedia.org/wiki/Dependency_inversion_principle), [Inversion Of Control](https://en.wikipedia.org/wiki/Inversion_of_control) and [Dependency Injection](https://martinfowler.com/articles/injection.html) in mind.
Rather than letting the services instantiate their dependencies inside themselves, inject the dependencies on construction. Also, rather than creating the object hierarchy manually, you can use a Dependency Injection framework that does the work for you. That's why you are here, I suppose. 🙂
To achieve the most efficient usage of Stashbox, you should follow these steps:
- At the startup of your application, instantiate a `StashboxContainer`.
- Register your services into the container.
- [Validate](/docs/diagnostics/validation) the state of the container and the registrations with the `.Validate()` method. *(Optional)*
- During the lifetime of the application, use the container to resolve your services.
- Create [scopes](/docs/guides/scopes) and use them to resolve your services. *(Optional)*
- On application exit, call the container's `.Dispose()` or `.DisposeAsync()` method to clean up the resources. *(Optional)*
:::caution
You should create only a single instance from `StashboxContainer` (plus child containers if you use them) per application domain. `StashboxContainer` instances are thread-safe. Do not create new container instances continuously, such action will bypass the container's internal delegate cache and could lead to performance degradation.
:::
## How it works?
Stashbox builds and maintains a collection of [registered services](/docs/getting-started/glossary#service-registration--registered-service). When a service is requested for resolution, Stashbox starts looking for a matching registration that has the same [service type](/docs/getting-started/glossary#service-type--implementation-type) as the type that was requested. If it finds one, the container initiates a scan on the [implementation type's](/docs/getting-started/glossary#service-type--implementation-type) available constructors and selects the one with the most arguments it knows how to resolve by matching argument types to other registrations.
When every constructor argument has a companion registration, Stashbox jumps to the first one and continues the same scanning operation.
This process is repeated until every [injectable dependency](/docs/getting-started/glossary#injectable-dependency) has a matching registration in the [resolution tree](/docs/getting-started/glossary#resolution-tree). At the end of the process, Stashbox will have each dependency node built-up in a hierarchical object structure to instantiate the initially requested service object.
## Example
Let's see a quick example. We have three services `DbBackup`, `MessageBus` and `ConsoleLogger`. `DbBackup` has a dependency on `IEventBroadcaster` (implemented by `MessageBus`) and `ILogger` (implemented by `ConsoleLogger`), `MessageBus` also depending on an `ILogger`:
```cs
public interface IJob { void DoTheJob(); }
public interface ILogger { void Log(string message); }
public interface IEventBroadcaster { void Broadcast(IEvent @event); }
public class ConsoleLogger : ILogger
{
public void Log(string message) => Console.WriteLine(message);
}
public class MessageBus : IEventBroadcaster
{
private readonly ILogger logger;
public MessageBus(ILogger logger)
{
this.logger = logger;
}
void Broadcast(IEvent @event)
{
this.logger.Log($"Sending event to bus: {@event.Name}");
// Do the actual event broadcast.
}
}
public class DbBackup : IJob
{
private readonly ILogger logger;
private readonly IEventBroadcaster eventBroadcaster;
public DbBackup(ILogger logger, IEventBroadcaster eventBroadcaster)
{
this.logger = logger;
this.eventBroadcaster = eventBroadcaster;
}
public void DoTheJob()
{
this.logger.Log("Backing up!");
// Do the actual backup.
this.eventBroadcaster.Broadcast(new DbBackupCompleted());
}
}
```
:::info
By depending only on interfaces, you decouple your services from concrete implementations. This gives you the flexibility of a more comfortable implementation replacement and also isolates your components from each other. For example, unit testing benefits a lot from the possibility of replacing real implementations with mocks.
:::
The example above configured with Stashbox in a Console Application:
```cs
using Stashbox;
using System;
namespace Example
{
public class Program
{
private static readonly IStashboxContainer container;
static Program()
{
// 1. Create container
container = new StashboxContainer();
// 2. Register your services
container.RegisterSingleton<ILogger, ConsoleLogger>();
container.Register<IEventBroadcaster, MessageBus>();
container.Register<IJob, DbBackup>();
// 3. Validate the configuration.
container.Validate();
}
static void Main(string[] args)
{
// 4. Resolve and use your service
var job = container.Resolve<IJob>();
job.DoTheJob();
}
}
}
```
================================================
FILE: docs/docs/getting-started/overview.md
================================================
---
title: Overview
---
# Stashbox
[](https://ci.appveyor.com/project/pcsajtai/stashbox/branch/master)
[](https://github.com/z4kn4fein/stashbox/actions/workflows/linux-macOS-CI.yml)
[](https://www.nuget.org/packages/Stashbox)
[](https://sonarcloud.io/project/overview?id=z4kn4fein_stashbox)
[](https://sonarcloud.io/project/overview?id=z4kn4fein_stashbox)
[](https://sonarcloud.io/project/overview?id=z4kn4fein_stashbox)
[](https://github.com/dotnet/sourcelink)
Stashbox is a lightweight, fast, and portable dependency injection framework for .NET-based solutions. It encourages the building of loosely coupled applications and simplifies the construction of hierarchical object structures. It can be integrated easily with .NET Core, Generic Host, ASP.NET, Xamarin, and many other applications.
These are the latest available stable and pre-release versions:
Github (stable) | NuGet (stable) | NuGet (daily)
--- | --- | ---
[](https://github.com/z4kn4fein/stashbox/releases) | [](https://www.nuget.org/packages/Stashbox) | [](https://www.nuget.org/packages/Stashbox/)
## Core attributes
- 🚀 Fast, thread-safe, and lock-free operations.
- ⚡️ Easy-to-use Fluent configuration API.
- ♻️ Small memory footprint.
- 🔄 Tracks the dependency tree for cycles.
- 🚨 Detects and warns about misconfigurations.
- 🔥 Gives fast feedback on registration/resolution issues.
## Supported platforms
- .NET 5+
- .NET Standard 2.0+
- .NET Framework 4.5+
- Mono
- Universal Windows Platform
- Xamarin (Android/iOS/Mac)
- Unity
## Contact & support
- Create a [GitHub issue](https://github.com/z4kn4fein/stashbox/issues) for bug reports and feature requests.
- Start a [GitHub discussion](https://github.com/z4kn4fein/stashbox/discussions) for your questions and ideas.
- Add a ⭐️ [on GitHub](https://github.com/z4kn4fein/stashbox) to support the project!
## License
This project is licensed under the [MIT license](https://github.com/z4kn4fein/stashbox/blob/master/LICENSE).
================================================
FILE: docs/docs/guides/advanced-registration.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Advanced registration
This section is about Stashbox's further configuration options, including the registration configuration API, the registration of factory delegates, multiple implementations, batch registrations, the concept of the [Composition Root](https://blog.ploeh.dk/2011/07/28/CompositionRoot/), and many more.
:::info
This section won't cover all the available options of the registrations API, but you can find them [here](/docs/configuration/registration-configuration).
:::
## Factory registration
<CodeDescPanel>
<div>
You can bind a factory delegate to a registration that the container will invoke directly to instantiate your service.
You can use parameter-less and custom parameterized delegates as a factory. [Here](/docs/configuration/registration-configuration#factory) is the list of all available options.
You can also get the current [dependency resolver](/docs/getting-started/glossary#dependency-resolver) as a delegate parameter to resolve any additional dependencies required for the service construction.
</div>
<div>
<Tabs>
<TabItem value="Parameter-less" label="Parameter-less">
```cs
container.Register<ILogger, ConsoleLogger>(options => options
.WithFactory(() => new ConsoleLogger());
// the container uses the factory for instantiation.
IJob job = container.Resolve<ILogger>();
```
</TabItem>
<TabItem value="Parameterized" label="Parameterized">
```cs
container.Register<IJob, DbBackup>(options => options
.WithFactory<ILogger>(logger => new DbBackup(logger));
// the container uses the factory for instantiation.
IJob job = container.Resolve<IJob>();
```
</TabItem>
<TabItem value="Resolver parameter" label="Resolver parameter">
```cs
container.Register<IJob, DbBackup>(options => options
.WithFactory(resolver => new DbBackup(resolver.Resolve<ILogger>()));
// the container uses the factory for instantiation.
IJob job = container.Resolve<IJob>();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
Delegate factories are useful when your service's instantiation is not straight-forward for the container, like when it depends on something that is not available at resolution time. E.g., a connection string.
</div>
<div>
```cs
container.Register<IJob, DbBackup>(options => options
.WithFactory<ILogger>(logger =>
new DbBackup(Configuration["DbConnectionString"], logger));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### Factories with parameter overrides
Stashbox can implicitly [wrap](/docs/advanced/wrappers-resolvers#delegate) your service in a `Delegate` and lets you pass parameters that can override your service's dependencies. Moreover, you can register your own custom delegate that the container will resolve when you request your service wrapped in a `Delegate`.
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Generic API" label="Generic API">
```cs
container.RegisterFunc<string, IJob>((connectionString, resolver) =>
new DbBackup(connectionString, resolver.Resolve<ILogger>()));
Func<string, IJob> backupFactory = container.Resolve<Func<string, IJob>>();
IJob dbBackup = backupFactory(Configuration["ConnectionString"]);
```
</TabItem>
<TabItem value="Runtime type API" label="Runtime type API">
```cs
container.RegisterFunc<string, IJob>((connectionString, resolver) =>
new DbBackup(connectionString, resolver.Resolve<ILogger>()));
Delegate backupFactory = container.ResolveFactory(typeof(IJob),
parameterTypes: new[] { typeof(string) });
IJob dbBackup = backupFactory.DynamicInvoke(Configuration["ConnectionString"]);
```
<!-- tabs:end -->
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
If a service has multiple constructors, the container visits those first, that has matching parameters passed to the factory, with respecting the additional [constructor selection rules](/docs/configuration/registration-configuration#constructor-selection).
</div>
<div>
```cs
class Service
{
public Service(int number) { }
public Service(string text) { }
}
container.Register<Service>();
// create the factory with an int input parameter.
var func = constainer.Resolve<Func<int, Service>>();
// the constructor with the int param
// is used for instantiation.
var service = func(2);
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### Consider this before using the resolver parameter inside a factory
Delegate factories are a black-box for the container. It doesn't have control over what's happening inside a delegate, which means when you resolve additional dependencies with the [dependency resolver](/docs/getting-started/glossary#dependency-resolver) parameter, they could easily bypass the [lifetime](/docs/diagnostics/validation#lifetime-validation) and [circular dependency](/docs/diagnostics/validation#circular-dependency) validations. Fortunately, you have the option to keep them validated anyway with parameterized factory delegates.
#### Delegates with dependencies passed as parameters
Rather than using the [dependency resolver](/docs/getting-started/glossary#dependency-resolver) parameter inside the factory, let the container inject the dependencies into the delegate as parameters. This way, the [resolution tree's](/docs/getting-started/glossary#resolution-tree) integrity remains stable because no service resolution happens inside the black-box, and each parameter is validated.
</div>
<div>
```cs
interface IEventProcessor { }
class EventProcessor : IEventProcessor
{
public EventProcessor(ILogger logger, IEventValidator validator)
{ }
}
container.Register<ILogger, ConsoleLogger>();
container.Register<IEventValidator, EventValidator>();
container.Register<IEventProcessor, EventProcessor>(options => options
// Ilogger and IEventValidator instances are injected
// by the container at resolution time, so they will be
// validated against circular and captive dependencies.
.WithFactory<ILogger, IEventValidator>((logger, validator) =>
new EventProcessor(logger, validator));
// the container resolves ILogger and IEventValidator first, then
// it passes them to the factory as delegate parameters.
IEventProcessor processor = container.Resolve<IEventProcessor>();
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### Accessing the currently resolving type in factories
To access the currently resolving type in factory delegates, you can set the `TypeInformation` type as an input parameter of the factory.
The `TypeInformation` holds every reflected context information about the currently resolving type.
This can be useful when the resolution is, e.g., in an open generic context, and we want to know which closed generic variant is requested.
</div>
<div>
```cs
interface IService<T> { }
class Service<T> : IService<T> { }
container.Register(typeof(IService<>), typeof(Service<>), options =>
options.WithFactory<TypeInformation>(typeInfo =>
{
// typeInfo.Type here holds the actual type like
// IService<int> based on the resolution request below.
}));
container.Resolve<IService<int>>();
```
</div>
</CodeDescPanel>
## Multiple implementations
<CodeDescPanel>
<div>
As we previously saw in the [Named registration](/docs/guides/basics#named-registration) topic, Stashbox allows you to have multiple implementations bound to a particular [service type](/docs/getting-started/glossary#service-type--implementation-type). You can use names to distinguish them, but you can also access them by requesting a typed collection using the [service type](/docs/getting-started/glossary#service-type--implementation-type).
:::note
The returned collection is in the same order as the services were registered.
Also, to request a collection, you can use any interface implemented by an array.
:::
</div>
<div>
```cs
container.Register<IJob, DbBackup>();
container.Register<IJob, StorageCleanup>();
container.Register<IJob, ImageProcess>();
```
<Tabs>
<TabItem value="ResolveAll" label="ResolveAll">
```cs
// jobs contain all three services in registration order.
IEnumerable<IJob> jobs = container.ResolveAll<IJob>();
```
</TabItem>
<TabItem value="Array" label="Array">
```cs
// jobs contain all three services in registration order.
IJob[] jobs = container.Resolve<IJob[]>();
```
</TabItem>
<TabItem value="IEnumerable" label="IEnumerable">
```cs
// jobs contain all three services in registration order.
IEnumerable<IJob> jobs = container.Resolve<IEnumerable<IJob>>();
```
</TabItem>
<TabItem value="IList" label="IList">
```cs
// jobs contain all three services in registration order.
IList<IJob> jobs = container.Resolve<IList<IJob>>();
```
</TabItem>
<TabItem value="ICollection" label="ICollection">
```cs
// jobs contain all three services in registration order.
ICollection<IJob> jobs = container.Resolve<ICollection<IJob>>();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
When you have multiple implementations registered to a service, a request to the [service type](/docs/getting-started/glossary#service-type--implementation-type) without a name will return the **last registered implementation**.
:::info
Not only names can be used to distinguish registrations, [conditions](/docs/guides/service-resolution#conditional-resolution), [named scopes](/docs/guides/scopes#named-scopes), and [metadata](/docs/advanced/wrappers-resolvers#metadata--tuple) can also influence the results.
:::
</div>
<div>
```cs
container.Register<IJob, DbBackup>();
container.Register<IJob, StorageCleanup>();
container.Register<IJob, ImageProcess>();
// job will be the ImageProcess.
IJob job = container.Resolve<IJob>();
```
</div>
</CodeDescPanel>
## Binding to multiple services
<CodeDescPanel>
<div>
When you have a service that implements multiple interfaces, you have the option to bind its registration to all or some of those additional interfaces or base types.
Suppose we have the following class declaration:
```cs
class DbBackup : IJob, IScheduledJob
{
public DbBackup() { }
}
```
</div>
<div>
<Tabs>
<TabItem value="To another type" label="To another type">
```cs
container.Register<IJob, DbBackup>(options => options
.AsServiceAlso<IScheduledJob>());
IJob job = container.Resolve<IJob>(); // DbBackup
IScheduledJob job = container.Resolve<IScheduledJob>(); // DbBackup
DbBackup job = container.Resolve<DbBackup>(); // error, not found
```
</TabItem>
<TabItem value="To all implemented types" label="To all implemented types">
```cs
container.Register<DbBackup>(options => options
.AsImplementedTypes());
IJob job = container.Resolve<IJob>(); // DbBackup
IScheduledJob job = container.Resolve<IScheduledJob>(); // DbBackup
DbBackup job = container.Resolve<DbBackup>(); // DbBackup
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Batch registration
<CodeDescPanel>
<div>
You have the option to register multiple services in a single registration operation.
**Filters (optional):**
First, the container will use the *implementation filter* action to select only those types from the collection we want to register. When we have those, the container will execute the *service filter* on their implemented interfaces and base classes to select which [service type](/docs/getting-started/glossary#service-type--implementation-type) they should be mapped to.
:::note
Framework types like `IDisposable` are excluded from being considered as a [service type](/docs/getting-started/glossary#service-type--implementation-type) by default.
:::
:::tip
You can use the registration configuration API to configure individual registrations.
:::
</div>
<div>
<Tabs>
<TabItem value="Default" label="Default">
This example will register three types to all their implemented interfaces, extended base classes, and to themselves ([self registration](/docs/getting-started/glossary#self-registration)) without any filter:
```cs
container.RegisterTypes(new[]
{
typeof(DbBackup),
typeof(ConsoleLogger),
typeof(StorageCleanup)
});
IEnumerable<IJob> jobs = container.ResolveAll<IJob>(); // 2 items
ILogger logger = container.Resolve<ILogger>(); // ConsoleLogger
IJob job = container.Resolve<IJob>(); // StorageCleanup
DbBackup backup = container.Resolve<DbBackup>(); // DbBackup
```
</TabItem>
<TabItem value="Filters" label="Filters">
In this example, we assume that `DbBackup` and `StorageCleanup` are implementing `IDisposable` besides `IJob` and also extending a `JobBase` abstract class.
```cs
container.RegisterTypes(new[]
{ typeof(DbBackup), typeof(ConsoleLogger), typeof(StorageCleanup) },
// implementation filter, only those implementations that implements IDisposable
impl => typeof(IDisposable).IsAssignableFrom(impl),
// service filter, register them to base classes only
(impl, service) => service.IsAbstract && !service.IsInterface);
IEnumerable<IJob> jobs = container.ResolveAll<IJob>(); // 0 items
IEnumerable<JobBase> jobs = container.ResolveAll<JobBase>(); // 2 items
ILogger logger = container.Resolve<ILogger>(); // error, not found
DbBackup backup = container.Resolve<DbBackup>(); // DbBackup
```
</TabItem>
<TabItem value="Without self" label="Without self">
This example ignores the [self registrations](/docs/getting-started/glossary#self-registration) completely:
```cs
container.RegisterTypes(new[]
{
typeof(DbBackup),
typeof(ConsoleLogger),
typeof(StorageCleanup)
},
registerSelf: false);
IEnumerable<IJob> jobs = container.ResolveAll<IJob>(); // 2 items
ILogger logger = container.Resolve<ILogger>(); // ConsoleLogger
DbBackup backup = container.Resolve<DbBackup>(); // error, not found
ConsoleLogger logger = container.Resolve<ConsoleLogger>(); // error, not found
```
</TabItem>
<TabItem value="Registration options" label="Registration options">
This example will configure all registrations mapped to `ILogger` as `Singleton`:
```cs
container.RegisterTypes(new[]
{
typeof(DbBackup),
typeof(ConsoleLogger),
typeof(StorageCleanup)
},
configurator: options =>
{
if (options.HasServiceType<ILogger>())
options.WithSingletonLifetime();
});
ILogger logger = container.Resolve<ILogger>(); // ConsoleLogger
ILogger newLogger = container.Resolve<ILogger>(); // the same ConsoleLogger
IEnumerable<IJob> jobs = container.ResolveAll<IJob>(); // 2 items
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
Another type of service filter is the `.RegisterTypesAs<T>()` method, which registers only those types that implements the `T` [service type](/docs/getting-started/glossary#service-type--implementation-type).
:::note
This method also accepts an implementation filter and a registration configurator action like `.RegisterTypes()`.
:::
:::caution
`.RegisterTypesAs<T>()` doesn't create [self registrations](/docs/getting-started/glossary#self-registration) as it only maps the implementations to the given `T` [service type](/docs/getting-started/glossary#service-type--implementation-type).
:::
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Generic API" label="Generic API">
```cs
container.RegisterTypesAs<IJob>(new[]
{
typeof(DbBackup),
typeof(ConsoleLogger),
typeof(StorageCleanup)
});
IEnumerable<IJob> jobs = container.ResolveAll<IJob>(); // 2 items
ILogger logger = container.Resolve<ILogger>(); // error, not found
IJob job = container.Resolve<IJob>(); // StorageCleanup
DbBackup backup = container.Resolve<DbBackup>(); // error, not found
```
</TabItem>
<TabItem value="Runtime type API" label="Runtime type API">
```cs
container.RegisterTypesAs(typeof(IJob), new[]
{
typeof(DbBackup),
typeof(ConsoleLogger),
typeof(StorageCleanup)
});
IEnumerable<IJob> jobs = container.ResolveAll<IJob>(); // 2 items
ILogger logger = container.Resolve<ILogger>(); // error, not found
IJob job = container.Resolve<IJob>(); // StorageCleanup
DbBackup backup = container.Resolve<DbBackup>(); // error, not found
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Assembly registration
<CodeDescPanel>
<div>
The batch registration API *(filters, registration configuration action, self-registration)* is also usable for registering services from given assemblies.
In this example, we assume that the same three services we used in the [batch registration](#batch-registration) section are in the same assembly.
:::info
The container also detects and registers open-generic definitions (when applicable) from the supplied type collection. You can read about [open-generics here](/docs/advanced/generics#open-generics).
:::
</div>
<div>
<Tabs>
<TabItem value="Single assembly" label="Single assembly">
```cs
container.RegisterAssembly(typeof(DbBackup).Assembly,
// service filter, register to interfaces only
serviceTypeSelector: (impl, service) => service.IsInterface,
registerSelf: false,
configurator: options => options.WithoutDisposalTracking()
);
IEnumerable<IJob> jobs = container.ResolveAll<IJob>(); // 2 items
IEnumerable<JobBase> jobs = container.ResolveAll<JobBase>(); // 0 items
ILogger logger = container.Resolve<ILogger>(); // ConsoleLogger
DbBackup backup = container.Resolve<DbBackup>(); // error, not found
```
</TabItem>
<TabItem value="Multiple assemblies" label="Multiple assemblies">
```cs
container.RegisterAssemblies(new[]
{
typeof(DbBackup).Assembly,
typeof(JobFromAnotherAssembly).Assembly
},
// service filter, register to interfaces only
serviceTypeSelector: (impl, service) => service.IsInterface,
registerSelf: false,
configurator: options => options.WithoutDisposalTracking()
);
IEnumerable<IJob> jobs = container.ResolveAll<IJob>(); // 2 items
IEnumerable<JobBase> jobs = container.ResolveAll<JobBase>(); // 0 items
ILogger logger = container.Resolve<ILogger>(); // ConsoleLogger
DbBackup backup = container.Resolve<DbBackup>(); // error, not found
```
</TabItem>
<TabItem value="Containing type" label="Containing type">
```cs
container.RegisterAssemblyContaining<DbBackup>(
// service filter, register to interfaces only
serviceTypeSelector: (impl, service) => service.IsInterface,
registerSelf: false,
configurator: options => options.WithoutDisposalTracking()
);
IEnumerable<IJob> jobs = container.ResolveAll<IJob>(); // 2 items
IEnumerable<JobBase> jobs = container.ResolveAll<JobBase>(); // 0 items
ILogger logger = container.Resolve<ILogger>(); // ConsoleLogger
DbBackup backup = container.Resolve<DbBackup>(); // error, not found
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Composition root
<CodeDescPanel>
<div>
The [Composition Root](https://blog.ploeh.dk/2011/07/28/CompositionRoot/) is an entry point where all services required to make a component functional are wired together.
Stashbox provides an `ICompositionRoot` interface that can be used to define an entry point for a given component or even for an entire assembly.
You can wire up your *composition root* implementation with `ComposeBy<TRoot>()`, or you can let the container find and execute all available *composition root* implementations within an assembly.
:::note
Your `ICompositionRoot` implementation also can have dependencies that the container will resolve.
:::
</div>
<div>
```cs
class ExampleRoot : ICompositionRoot
{
public ExampleRoot(IDependency rootDependency)
{ }
public void Compose(IStashboxContainer container)
{
container.Register<IServiceA, ServiceA>();
container.Register<IServiceB, ServiceB>();
}
}
```
<Tabs>
<TabItem value="Single" label="Single">
```cs
// compose a single root.
container.ComposeBy<ExampleRoot>();
```
</TabItem>
<TabItem value="Assembly" label="Assembly">
```cs
// compose every root in the given assembly.
container.ComposeAssembly(typeof(IServiceA).Assembly);
```
</TabItem>
<TabItem value="Override" label="Override">
```cs
// compose a single root with dependency override.
container.ComposeBy<ExampleRoot>(new CustomRootDependency());
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Injection parameters
<CodeDescPanel>
<div>
If you have pre-evaluated dependencies you'd like to inject at resolution time, you can set them as injection parameters during registration.
:::note
Injection parameter names are matched to constructor arguments or field/property names.
:::
</div>
<div>
```cs
container.Register<IJob, DbBackup>(options => options
.WithInjectionParameter("logger", new ConsoleLogger())
.WithInjectionParameter("eventBroadcaster", new MessageBus());
// the injection parameters will be passed to DbBackup's constructor.
IJob backup = container.Resolve<IJob>();
```
</div>
</CodeDescPanel>
## Initializer / finalizer
<CodeDescPanel>
<div>
The container provides specific extension points to let you react to lifetime events of an instantiated service.
For this reason, you can specify *Initializer* and *Finalizer* delegates. The *finalizer* is called upon the service's [disposal](/docs/guides/scopes#disposal), and the *initializer* is called upon the service's construction.
</div>
<div>
```cs
container.Register<ILogger, FileLogger>(options => options
// delegate that called right after instantiation.
.WithInitializer((logger, resolver) => logger.OpenFile())
// delegate that called right before the instance's disposal.
.WithFinalizer(logger => logger.CloseFile()));
```
</div>
</CodeDescPanel>
================================================
FILE: docs/docs/guides/basics.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Basic usage
This section is about the basics of Stashbox's API. It will give you a good starting point for more advanced topics described in the following sections.
Stashbox provides several methods that enable registering services, and we'll go through the most common scenarios with code examples.
## Default registration
<CodeDescPanel>
<div>
Stashbox allows registration operations via the `Register()` methods.
During registration, the container checks whether the [service type](/docs/getting-started/glossary#service-type--implementation-type) is assignable from the [implementation type](/docs/getting-started/glossary#service-type--implementation-type) and if not, the container throws an [exception](/docs/diagnostics/validation#registration-validation).
Also, when the implementation is not resolvable, the container throws the same [exception](/docs/diagnostics/validation#registration-validation).
The example registers `DbBackup` to be returned when `IJob` is requested.
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Generic API" label="Generic API">
```cs
container.Register<IJob, DbBackup>();
IJob job = container.Resolve<IJob>();
// throws an exception because ConsoleLogger doesn't implement IJob.
container.Register<IJob, ConsoleLogger>();
// throws an exception because IJob is not a valid implementation.
container.Register<IJob, IJob>();
```
</TabItem>
<TabItem value="Runtime type API" label="Runtime type API">
```cs
container.Register(typeof(IJob), typeof(DbBackup));
object job = container.Resolve(typeof(IJob));
// throws an exception because ConsoleLogger doesn't implement IJob.
container.Register(typeof(IJob), typeof(ConsoleLogger));
// throws an exception because IJob is not a valid implementation.
container.Register(typeof(IJob), typeof(IJob));
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
You can register a service to itself without specifying a [service type](/docs/getting-started/glossary#service-type--implementation-type), only the implementation ([self registration](/docs/getting-started/glossary#self-registration)).
In this case, the given implementation is considered the [service type](/docs/getting-started/glossary#service-type--implementation-type) and must be used to request the service (`DbBackup` in the example).
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Generic API" label="Generic API">
```cs
container.Register<DbBackup>();
DbBackup backup = container.Resolve<DbBackup>();
```
</TabItem>
<TabItem value="Runtime type API" label="Runtime type API">
```cs
container.Register(typeof(DbBackup));
object backup = container.Resolve(typeof(DbBackup));
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
The container's API is fluent, which means you can chain the calls on its methods after each other.
</div>
<div>
```cs
var job = container.Register<IJob, DbBackup>()
.Register<ILogger, ConsoleLogger>()
.Resolve<IJob>();
```
</div>
</CodeDescPanel>
## Named registration
<CodeDescPanel>
<div>
The example shows how you can bind more implementations to a [service type](/docs/getting-started/glossary#service-type--implementation-type) using names for identification.
The same name must be used to resolve the named service.
:::note
The name is an `object` type.
:::
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Generic API" label="Generic API">
```cs
container.Register<IJob, DbBackup>("DbBackup");
container.Register<IJob, StorageCleanup>("StorageCleanup");
IJob cleanup = container.Resolve<IJob>("StorageCleanup");
```
</TabItem>
<TabItem value="Runtime type API" label="Runtime type API">
```cs
container.Register(typeof(IJob), typeof(DbBackup), "DbBackup");
container.Register(typeof(IJob), typeof(StorageCleanup), "StorageCleanup");
object cleanup = container.Resolve(typeof(IJob), "StorageCleanup");
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
You can also get each service that share the same name by requesting an `IEnumerable<>` or using the `ResolveAll()` method with the `name` parameter.
</div>
<div>
```cs
container.Register<IJob, DbBackup>("StorageJobs");
container.Register<IJob, StorageCleanup>("StorageJobs");
container.Register<IJob, AnotherJob>();
// jobs will be [DbBackup, StorageCleanup].
IEnumerable<IJob> jobs = container.Resolve<IEnumerable<IJob>>("StorageJobs");
```
</div>
</CodeDescPanel>
## Instance registration
<CodeDescPanel>
<div>
With instance registration, you can provide an already created external instance to use when the given [service type](/docs/getting-started/glossary#service-type--implementation-type) is requested.
Stashbox automatically handles the [disposal](/docs/guides/scopes#disposal) of the registered instances, but you can turn this feature off with the `withoutDisposalTracking` parameter.
When an `IJob` is requested, the container will always return the external instance.
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Generic API" label="Generic API">
```cs
var job = new DbBackup();
container.RegisterInstance<IJob>(job);
// resolvedJob and job are the same.
IJob resolvedJob = container.Resolve<IJob>();
```
</TabItem>
<TabItem value="Runtime type API" label="Runtime type API">
```cs
var job = new DbBackup();
container.RegisterInstance(job, typeof(IJob));
// resolvedJob and job are the same.
object resolvedJob = container.Resolve(typeof(IJob));
```
</TabItem>
<TabItem value="Named" label="Named">
```cs
var job = new DbBackup();
container.RegisterInstance<IJob>(job, "DbBackup");
// resolvedJob and job are the same.
IJob resolvedJob = container.Resolve<IJob>("DbBackup");
```
</TabItem>
<TabItem value="No dispose" label="No dispose">
```cs
var job = new DbBackup();
container.RegisterInstance<IJob>(job, withoutDisposalTracking: true);
// resolvedJob and job are the same.
IJob resolvedJob = container.Resolve<IJob>();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
The instance registration API allows the batched registration of different instances.
</div>
<div>
```cs
container.RegisterInstances<IJob>(new DbBackup(), new StorageCleanup());
IEnumerable<IJob> jobs = container.ResolveAll<IJob>();
```
</div>
</CodeDescPanel>
## Re-mapping
<CodeDescPanel>
<div>
With re-map, you can bind new implementations to a [service type](/docs/getting-started/glossary#service-type--implementation-type) and delete old registrations in one action.
:::caution
When there are multiple registrations mapped to a [service type](/docs/getting-started/glossary#service-type--implementation-type), `.ReMap()` will replace all of them with the given [implementation type](/docs/getting-started/glossary#service-type--implementation-type). If you want to replace only one specific service, use the `.ReplaceExisting()` [configuration option](/docs/configuration/registration-configuration#replace).
:::
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Generic API" label="Generic API">
```cs
container.Register<IJob, DbBackup>();
container.Register<IJob, StorageCleanup>();
// jobs contain all two jobs
IEnumerable<IJob> jobs = container.ResolveAll<IJob>();
container.ReMap<IJob, SlackMessageSender>();
// jobs contains only the SlackMessageSender
jobs = container.ResolveAll<IJob>();
```
</TabItem>
<TabItem value="Runtime type API" label="Runtime type API">
```cs
container.Register(typeof(IJob), typeof(DbBackup));
container.Register(typeof(IJob), typeof(StorageCleanup));
// jobs contain all two jobs
IEnumerable<object> jobs = container.ResolveAll(typeof(IJob));
container.ReMap(typeof(IJob), typeof(SlackMessageSender));
// jobs contains only the SlackMessageSender
jobs = container.ResolveAll(typeof(IJob));
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Wiring up
<CodeDescPanel>
<div>
Wiring up is similar to [Instance registration](#instance-registration) except that the container will perform property/field injection (if configured so and applicable) on the registered instance during resolution.
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Generic API" label="Generic API">
```cs
container.WireUp<IJob>(new DbBackup());
IJob job = container.Resolve<IJob>();
```
</TabItem>
<TabItem value="Runtime type API" label="Runtime type API">
```cs
container.WireUp(new DbBackup(), typeof(IJob));
object job = container.Resolve(typeof(IJob));
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Lifetime shortcuts
<CodeDescPanel>
<div>
A service's lifetime indicates how long its instance will live and which re-using policy should be applied when it gets injected.
This example shows how you can use the registration API's shortcuts for lifetimes. These are just sugars, and there are more ways explained in the [lifetimes](/docs/guides/lifetimes) section.
:::info
The `DefaultLifetime` is [configurable](/docs/guides/lifetimes#default-lifetime).
:::
</div>
<div>
<Tabs groupId="generic-runtime-apis">
<TabItem value="Default" label="Default">
When no lifetime is specified, the service will use the container's `DefaultLifetime`, which is `Transient` by default.
```cs
container.Register<IJob, DbBackup>();
IJob job = container.Resolve<IJob>();
```
</TabItem>
<TabItem value="Singleton" label="Singleton">
A service with `Singleton` lifetime will be instantiated once and reused during the container's lifetime.
```cs
container.RegisterSingleton<IJob, DbBackup>();
IJob job = container.Resolve<IJob>();
```
</TabItem>
<TabItem value="Scoped" label="Scoped">
The `Scoped` lifetime behaves like a `Singleton` within a [scope](/docs/guides/scopes).
A scoped service is instantiated once and reused during the scope's whole lifetime.
```cs
container.RegisterScoped<IJob, DbBackup>();
IJob job = container.Resolve<IJob>();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
================================================
FILE: docs/docs/guides/lifetimes.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Lifetimes
Lifetime management controls how long a service's instances will live (from instantiation to [disposal](/docs/guides/scopes#disposal)) and how they will be reused between resolution requests.
:::info
Choosing the right lifetime helps you avoid [captive dependencies](/docs/diagnostics/validation#lifetime-validation).
:::
## Default lifetime
<CodeDescPanel>
<div>
When you are not specifying a lifetime during registration, Stashbox will use the default lifetime. By default, it's set to [Transient](#transient-lifetime), but you can override it with the `.WithDefaultLifetime()` [container configuration option](/docs/configuration/container-configuration#default-lifetime).
You can choose either from the pre-defined lifetimes defined on the `Lifetimes` static class or use a [custom lifetime](#custom-lifetime).
</div>
<div>
<Tabs>
<TabItem value="Transient (default)" label="Transient (default)">
```cs
var container = new StashboxContainer(options => options
.WithDefaultLifetime(Lifetimes.Transient));
```
</TabItem>
<TabItem value="Singleton" label="Singleton">
```cs
var container = new StashboxContainer(options => options
.WithDefaultLifetime(Lifetimes.Singleton));
```
</TabItem>
<TabItem value="Scoped" label="Scoped">
```cs
var container = new StashboxContainer(options => options
.WithDefaultLifetime(Lifetimes.Scoped));
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Transient lifetime
<CodeDescPanel>
<div>
A new instance is created for each resolution request. If a transient is referred by multiple consumers in the same [resolution tree](/docs/getting-started/glossary#resolution-tree), each will get a new instance.
</div>
<div>
```cs
container.Register<IJob, DbBackup>(options => options
.WithLifetime(Lifetimes.Transient));
```
</div>
</CodeDescPanel>
:::info
Transient services are not tracked for disposal by default, but this feature can be turned on with the `.WithDisposableTransientTracking()` [container configuration option](/docs/configuration/container-configuration#tracking-disposable-transients). When it's enabled, the current [scope](/docs/guides/scopes) on which the resolution request was initiated takes the responsibility to track and dispose transient services.
:::
## Singleton lifetime
<CodeDescPanel>
<div>
A single instance is created and reused for each resolution request and injected into each consumer.
:::note
Singleton services are disposed when the container ([root scope](/docs/getting-started/glossary#root-scope)) is being disposed.
:::
</div>
<div>
<Tabs groupId="lifetime-forms">
<TabItem value="Longer form" label="Longer form">
```cs
container.Register<IJob, DbBackup>(options => options
.WithLifetime(Lifetimes.Singleton));
```
</TabItem>
<TabItem value="Shorter form" label="Shorter form">
```cs
container.RegisterSingleton<IJob, DbBackup>();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Scoped lifetime
<CodeDescPanel>
<div>
A new instance is created for each [scope](/docs/guides/scopes), which will be returned for every resolution request initiated on the given scope. It's like a singleton lifetime within a scope.
:::note
Scoped services are disposed when their scope is being disposed.
:::
</div>
<div>
<Tabs groupId="lifetime-forms">
<TabItem value="Longer form" label="Longer form">
```cs
container.Register<IJob, DbBackup>(options => options
.WithLifetime(Lifetimes.Scoped));
using var scope = container.BeginScope();
IJob job = scope.Resolve<IJob>();
```
</TabItem>
<TabItem value="Shorter form" label="Shorter form">
```cs
container.RegisterScoped<IJob, DbBackup>();
using var scope = container.BeginScope();
IJob job = scope.Resolve<IJob>();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Named scope lifetime
<CodeDescPanel>
<div>
It is the same as scoped lifetime, except the given service will be selected only when a scope with the same name initiates the resolution request.
You can also let a service [define](/docs/guides/scopes#service-as-scope) its own named scope. During registration, this scope can be referred to by its name upon using a named scope lifetime.
</div>
<div>
<Tabs>
<TabItem value="Named" label="Named">
```cs
container.Register<IJob, DbBackup>(options => options
.InNamedScope("DbScope"));
using var scope = container.BeginScope("DbScope");
IJob job = scope.Resolve<IJob>();
```
</TabItem>
<TabItem value="Defined" label="Defined">
```cs
container.Register<DbJobExecutor>(options => options
.DefinesScope());
ontainer.Register<IJob, DbBackup>(options => options
.InScopeDefinedBy<DbJobExecutor>());
// the executor will begin a new scope within itself
// when it gets resolved and DbBackup will be selected
// and attached to that scope instead.
using var scope = container.BeginScope();
DbJobExecutor executor = scope.Resolve<DbJobExecutor>();
```
</TabItem>
<TabItem value="Defined with name" label="Defined with name">
```cs
container.Register<DbJobExecutor>(options => options
.DefinesScope("DbScope"));
ontainer.Register<IJob, DbBackup>(options => options
.InNamedScope("DbScope"));
// the executor will begin a new scope within itself
// when it gets resolved and DbBackup will be selected
// and attached to that scope instead.
using var scope = container.BeginScope();
DbJobExecutor executor = scope.Resolve<DbJobExecutor>();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
:::note
Services with named scope lifetime are disposed when the related named scope is being disposed.
:::
## Per-request lifetime
<CodeDescPanel>
<div>
The requested service will be reused within the whole resolution request. A new instance is created for each individual request .
</div>
<div>
```cs
container.Register<IJob, DbBackup>(options => options
.WithPerRequestLifetime());
```
</div>
</CodeDescPanel>
## Auto lifetime
<CodeDescPanel>
<div>
The requested service's lifetime will align to the lifetime of its dependencies. When the requested service has a dependency with a higher lifespan, this lifetime will inherit that lifespan up to a given boundary.
</div>
<div>
```cs
container.Register<IJob, DbBackup>(options => options
.WithAutoLifetime(Lifetimes.Scoped /* boundary lifetime */));
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
If the requested service has auto lifetime with a scoped boundary and it has only transient dependencies, it'll inherit their transient lifetime.
</div>
<div>
```cs
container.Register<ILogger, Logger>();
container.Register<IJob, DbBackup>(options => options
.WithAutoLifetime(Lifetimes.Scoped /* boundary lifetime */));
// job has transient lifetime.
var job = container.Resolve<IJob>();
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
When there's a dependency with higher lifespan than the given boundary, the requested service will get the boundary lifetime.
</div>
<div>
```cs
container.RegisterSingleton<ILogger, Logger>();
container.Register<IJob, DbBackup>(options => options
.WithAutoLifetime(Lifetimes.Scoped /* boundary lifetime */));
// job has scoped lifetime.
var job = container.Resolve<IJob>();
```
</div>
</CodeDescPanel>
## Custom lifetime
If you'd like to use a custom lifetime, you can create your implementation by inheriting either from `FactoryLifetimeDescriptor` or from `ExpressionLifetimeDescriptor`, depending on how do you want to manage the service instances.
- **ExpressionLifetimeDescriptor**: With this, you can build your lifetime with the expression form of the service instantiation.
```cs
class CustomLifetime : ExpressionLifetimeDescriptor
{
protected override Expression ApplyLifetime(
Expression expression, // The expression which describes the service creation
ServiceRegistration serviceRegistration,
ResolutionContext resolutionContext,
Type requestedType)
{
// Lifetime managing functionality
}
}
```
- **FactoryLifetimeDescriptor**: With this, you can build your lifetime based on a pre-compiled factory delegate used for service instantiation.
```cs
class CustomLifetime : FactoryLifetimeDescriptor
{
protected override Expression ApplyLifetime(
Func<IResolutionScope, object> factory, // The factory used for service creation
ServiceRegistration serviceRegistration,
ResolutionContext resolutionContext,
Type requestedType)
{
// Lifetime managing functionality
}
}
```
Then you can use your lifetime like this:
```cs
container.Register<IJob, DbBackup>(options => options.WithLifetime(new CustomLifetime()));
```
================================================
FILE: docs/docs/guides/scopes.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Scopes
A scope is Stashbox's implementation of the unit-of-work pattern; it encapsulates a given unit used to resolve and store instances required for a given work. When a scoped service is resolved or injected, the scope ensures that it gets instantiated only once within the scope's lifetime. When the work is finished, the scope cleans up the resources by disposing each tracked disposable instance.
A web application is a fair usage example for scopes as it has a well-defined execution unit that can be bound to a scope - the HTTP request. Every request could have its unique scope attached to the request's lifetime. When a request ends, the scope gets closed, and all the scoped instances will be disposed.
## Creating a scope
<CodeDescPanel>
<div>
You can create a scope from the container by calling its `.BeginScope()` method.
Scopes can be **nested**, which means you can create sub-scopes from existing ones with their `.BeginScope()` method.
Scoped service instances are not shared across parent and sub-scope relations.
Nested scopes can be **attached to their parent's lifetime**, which means when a parent gets disposed all child scopes attached to it will be disposed.
Scopes are `IDisposable`; they track all `IDisposable` instances they resolved. Calling their `Dispose()` method or wrapping them in `using` statements is a crucial part of their service's lifetime management.
</div>
<div>
<Tabs>
<TabItem value="Create" label="Create">
```cs
container.RegisterScoped<IJob, DbBackup>();
// create the scope with using so it'll be auto disposed.
using (var scope = container.BeginScope())
{
IJob job = scope.Resolve<IJob>();
IJob jobAgain = scope.Resolve<IJob>();
// job and jobAgain are created in the
// same scope, so they are the same instance.
}
```
</TabItem>
<TabItem value="Nested" label="Nested">
```cs
container.RegisterScoped<IJob, DbBackup>();
using (var parent = container.BeginScope())
{
IJob job = parent.Resolve<IJob>();
IJob jobAgain = parent.Resolve<IJob>();
// job and jobAgain are created in the
// same scope, so they are the same instance.
// create a sub-scope.
using var sub = parent.BeginScope();
IJob subJob = sub.Resolve<IJob>();
// subJob is a new instance created in the sub-scope,
// differs from either job and jobAgain.
}
```
</TabItem>
<TabItem value="Nested attached" label="Nested attached">
```cs
container.RegisterScoped<IJob, DbBackup>();
var parent = container.BeginScope();
var sub = parent.BeginScope(attachToParent: true);
// sub will also be disposed with the scope.
scope.Dispose();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Named scopes
<CodeDescPanel>
<div>
There might be cases where you don't want to use a service globally across every scope, only in specific ones.
For this reason, you can differentiate specific scope groups from other scopes with a **name**.
You can set a service's lifetime to [named scope lifetime](/docs/guides/lifetimes#named-scope-lifetime) initialized with the **scope's name** to mark it usable only for that named scope.
```cs
container.Register<IJob, DbBackup>(options =>
options.InNamedScope("DbScope"));
container.Register<IJob, DbCleanup>(options =>
options.InNamedScope("DbScope"));
container.Register<IJob, DbIndexRebuild>(options =>
options.InNamedScope("DbSubScope"));
container.Register<IJob, StorageCleanup>(options =>
options.InNamedScope("StorageScope"));
```
:::note
Services with named scope lifetime are **shared across parent and sub-scope relations**.
:::
If you request a name-scoped service from an un-named scope, you'll get an error or no result (depending on the configuration) because those services are selectable only by named scopes with a matching name.
</div>
<div>
```cs
using (var dbScope = container.BeginScope("DbScope"))
{
// DbBackup and DbCleanup will be returned.
IEnumerable<IJob> jobs = dbScope.ResolveAll<IJob>();
// create a sub-scope of dbScope.
using var sub = dbScope.BeginScope();
// DbBackup and DbCleanup will be returned from the named parent scope.
IEnumerable<IJob> jobs = sub.ResolveAll<IJob>();
// create a named sub-scope.
using var namedSub = dbScope.BeginScope("DbSubScope");
// DbIndexRebuild will be returned from the named sub-scope.
IEnumerable<IJob> jobs = namedSub.ResolveAll<IJob>();
}
using (var storageScope = container.BeginScope("StorageScope"))
{
// StorageCleanup will be returned.
IJob job = storageScope.Resolve<IJob>();
}
// create a common scope without a name.
using (var unNamed = container.BeginScope())
{
// empty result as there's no service registered without named scope.
IEnumerable<IJob> jobs = unNamed.ResolveAll<IJob>();
// throws an exception because there's no unnamed service registered.
IJob job = unNamed.Resolve<IJob>();
}
```
</div>
</CodeDescPanel>
## Service as scope
<CodeDescPanel>
<div>
You can configure a service to behave like a nested named scope. At the resolution of this kind of service, a new dedicated named scope is created implicitly for managing the service's dependencies.
With this feature, you can organize your dependencies around logical groups (named scopes) instead of individual services.
Using `InScopeDefinedBy()`, you can bind services to a defined scope without giving it a name. In this case, the defining service's [implementation type](/docs/getting-started/glossary#service-type--implementation-type) is used for naming the scope.
:::note
The lifetime of the defined scope is attached to the current scope that was used to create the service.
:::
</div>
<div>
<Tabs>
<TabItem value="Define named" label="Define named">
```cs
container.Register<IJob, DbBackup>(options => options
.DefinesScope("DbBackupScope"));
container.Register<ILogger, ConsoleLogger>(options => options
.InNamedScope("DbBackupScope"));
container.Register<ILogger, FileLogger>();
var scope = container.BeginScope();
// DbBackup will create a named scope with the name "DbBackupScope".
// the named scope will select ConsoleLogger as it's
// bound to the named scope's identifier.
IJob job = scope.Resolve<IJob>();
// this will dispose the implicitly created named scope by DbBackup.
scope.Dispose();
```
</TabItem>
<TabItem value="Define typed" label="Define typed">
```cs
container.Register<IJob, DbBackup>(options => options
.DefinesScope());
container.Register<ILogger, ConsoleLogger>(options => options
.InScopeDefinedBy<DbBackup>());
container.Register<ILogger, FileLogger>();
var scope = container.BeginScope();
// DbBackup will create a named scope with the name typeof(DbBackup).
// the named scope will select ConsoleLogger as it's
// bound to the named scope's identifier.
IJob job = scope.Resolve<IJob>();
// this will dispose the implicitly created named scope by DbBackup.
scope.Dispose();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Put instance to a scope
<CodeDescPanel>
<div>
You can add an already instantiated service to a scope. The instance's lifetime will be tracked by the given scope.
</div>
<div>
```cs
using var scope = container.BeginScope();
scope.PutInstanceInScope<IJob>(new DbBackup());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
You can disable the tracking by passing `true` for the `withoutDisposalTracking` parameter. In this case, only the strong reference to the instance is dropped when the scope is disposed.
</div>
<div>
```cs
using var scope = container.BeginScope();
scope.PutInstanceInScope<IJob>(new DbBackup(), withoutDisposalTracking: true);
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
You can also give your instance a name to use it like a [named registration](/docs/guides/basics#named-registration):
</div>
<div>
```cs
using var scope = container.BeginScope();
scope.PutInstanceInScope<IDrow>(new DbBackup(), false, name: "DbBackup");
```
</div>
</CodeDescPanel>
:::note
Instances put to a scope will take precedence over existing registrations with the same [service type](/docs/getting-started/glossary#service-type--implementation-type).
:::
## Disposal
<CodeDescPanel>
<div>
The currently resolving scope tracks services that implement either `IDisposable` or `IAsyncDisposable`. This means that when the scope is disposed, all the tracked disposable instances will be disposed with it.
:::note
Disposing the container will dispose all the singleton instances and their dependencies.
:::
</div>
<div>
<Tabs groupId="lifetime-dispose">
<TabItem value="Using" label="Using">
```cs
using (var scope = container.BeginScope())
{
var disposable = scope.Resolve<DisposableService>();
} // 'disposable' will be disposed when
// the using statement ends.
```
</TabItem>
<TabItem value="Dispose" label="Dispose">
```cs
var scope = container.BeginScope();
var disposable = scope.Resolve<DisposableService>();
// 'disposable' will be disposed with the scope.
scope.Dispose();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
You can disable the disposal tracking on a [service registration](/docs/getting-started/glossary#service-registration--registered-service) with the `.WithoutDisposalTracking()` option.
</div>
<div>
```cs
container.Register<IJob, DbBackup>(options =>
options.WithoutDisposalTracking());
```
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### Async disposal
As the container and its scopes implement the `IAsyncDisposable` interface, you can dispose them asynchronously when they are used in an `async` context.
Calling `DisposeAsync` disposes both `IDisposable` and `IAsyncDisposable` instances; however, calling `Dispose` only disposes `IDisposable` instances.
</div>
<div>
<Tabs groupId="lifetime-dispose">
<TabItem value="Using" label="Using">
```cs
await using (var scope = container.BeginScope())
{
var disposable = scope.Resolve<DisposableService>();
} // 'disposable' will be disposed asynchronously
// when the using statement ends.
```
</TabItem>
<TabItem value="Dispose" label="Dispose">
```cs
var scope = container.BeginScope();
var disposable = scope.Resolve<DisposableService>();
// 'disposable' will be disposed asynchronously with the scope.
await scope.DisposeAsync();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
<CodeDescPanel>
<div>
### Finalizer delegate
During [service registration](/docs/getting-started/glossary#service-registration--registered-service), you can set a custom finalizer delegate that will be invoked at the service's disposal.
</div>
<div>
```cs
container.Register<IJob, DbBackup>(options =>
options.WithFinalizer(backup =>
backup.CloseDbConnection()));
```
</div>
</CodeDescPanel>
================================================
FILE: docs/docs/guides/service-resolution.md
================================================
import CodeDescPanel from '@site/src/components/CodeDescPanel';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Service resolution
When you have all your components registered and configured adequately, you can resolve them from the container or a [scope](/docs/guides/scopes) by requesting their [service type](/docs/getting-started/glossary#service-type--implementation-type).
During a service's resolution, the container walks through the entire [resolution tree](/docs/getting-started/glossary#resolution-tree) and instantiates all dependencies required for the service construction.
When the container encounters any violations of [these rules](/docs/diagnostics/validation#resolution-validation) *(circular dependencies, missing required services, lifetime misconfigurations)* during the walkthrough, it lets you know that something is wrong by throwing a specific exception.
## Injection patterns
<CodeDescPanel>
<div>
**Constructor injection** is the *primary dependency injection pattern*. It encourages the organization of dependencies to a single place - the constructor.
Stashbox, by default, uses the constructor that has the most parameters it knows how to resolve. This behavior is configurable through [constructor selection](/docs/configuration/registration-configuration#constructor-selection).
[Property/field injection](/docs/configuration/registration-configuration#property-field-injection) is also supported in cases where constructor injection is not applicable.
Members defined with C# 11's [`required`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/required) keyword are automatically injected by the container.
This behavior can be controlled with [registration](/docs/configuration/registration-configuration#required-member-injection) or [container](/docs/configuration/container-configuration#required-member-injection) configuration options
:::info
[Constructor selection](/docs/configuration/container-configuration#constructor-selection) and [property/field injection](/docs/configuration/container-configuration#auto-member-injection) is also configurable container-wide.
:::
</div>
<div>
<Tabs>
<TabItem value="Constructor injection" label="Constructor injection">
```cs
class DbBackup : IJob
{
private readonly ILogger logger;
private readonly IEventBroadcaster eventBroadcaster;
public DbBackup(ILogger logger, IEventBroadcaster eventBroadcaster)
{
this.logger = logger;
this.eventBroadcaster = eventBroadcaster;
}
}
container.Register<ILogger, ConsoleLogger>();
container.Register<IEventBroadcaster, MessageBus>();
container.Register<IJob, DbBackup>();
// resolution using the available constructor.
IJob job = container.Resolve<IJob>();
```
</TabItem>
<TabItem value="Property/field injection" label="Property/field injection">
```cs
class DbBackup : IJob
{
public ILogger Logger { get; set; }
public IEventBroadcaster EventBroadcaster { get; set; }
public DbBackup()
{ }
}
container.Register<ILogger, ConsoleLogger>();
container.Register<IEventBroadcaster, MessageBus>();
// registration of service with auto member injection.
container.Register<IJob, DbBackup>(options =>
options.WithAutoMemberInjection());
// resolution will inject the properties.
IJob job = container.Resolve<IJob>();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
:::caution
It's a common mistake to use the *property/field injection* only to disencumber the constructor from having too many parameters. That's a code smell and also violates the [Single-responsibility principle](https://en.wikipedia.org/wiki/Single-responsibility_principle). If you recognize these conditions, you should consider splitting your class into multiple smaller units rather than adding an extra property-injected dependency.
:::
## Attributes
<CodeDescPanel>
<div>
Attributes can give you control over how Stashbox selects dependencies for a service's resolution.
**Dependency attribute**:
- **On a constructor/method parameter**: used with the *name* property, it works as a marker for [named resolution](/docs/getting-started/glossary#named-resolution).
- **On a property/field**: first, it enables *auto-injection* on the marked property/field (even if it wasn't configured at registration explicitly), and just as with the method parameter, it allows [named resolution](/docs/getting-started/glossary#named-resolution).
**DependencyName attribute**: a parameter marked with this attribute will get the related service's dependency name.
**InjectionMethod attribute**: marks a method to be called when the requested service is instantiated.
</div>
<div>
<Tabs>
<TabItem value="Constructor" label="Constructor">
```cs
class DbBackup : IJob
{
private readonly ILogger logger;
public DbBackup([Dependency("Console")]ILogger logger)
{
this.logger = logger;
}
}
container.Register<ILogger, ConsoleLogger>("Console");
container.Register<ILogger, FileLogger>("File");
container.Register<IJob, DbBackup>();
// the container will resolve DbBackup with ConsoleLogger.
IJob job = container.Resolve<IJob>();
```
</TabItem>
<TabItem value="Property/field" label="Property/field">
```cs
class DbBackup : IJob
{
[Dependency("Console")]
public ILogger Logger { get; set; }
public DbBackup()
{ }
}
container.Register<ILogger, ConsoleLogger>("Console");
container.Register<ILogger, FileLogger>("File");
container.Register<IJob, DbBackup>();
// the container will resolve DbBackup with ConsoleLogger.
IJob job = container.Resolve<IJob>();
```
</TabItem>
<TabItem value="DependencyName" label="DependencyName">
```cs
class DbBackup : IJob
{
public string Name { get; set; }
public DbBackup([DependencyName] string name)
{ }
}
container.Register<IJob, DbBackup>("Backup");
IJob job = container.Resolve<IJob>();
// name is "Backup".
var name = job.Name;
```
</TabItem>
<TabItem value="Method" label="Method">
```cs
class DbBackup : IJob
{
[InjectionMethod]
public void Initialize([Dependency("Console")]ILogger logger)
{
this.logger.Log("Initializing.");
}
}
container.Register<ILogger, ConsoleLogger>("Console");
container.Register<ILogger, FileLogger>("File");
container.Register<IJob, DbBackup>();
// the container will call DbBackup's Initialize method.
IJob job = container.Resolve<IJob>();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
:::caution
Attributes provide a more straightforward configuration, but using them also tightens the bond between your application and Stashbox. If you consider this an issue, you can use the [dependency binding](/docs/guides/service-resolution#dependency-binding) API or [your own attributes](/docs/guides/service-resolution#using-your-own-attributes).
:::
### Using your own attributes
<CodeDescPanel>
<div>
There's an option to extend the container's dependency finding mechanism with your own attributes.
- **Additional Dependency attributes**: you can use the [`.WithAdditionalDependencyAttribute()`](/docs/configuration/container-configuration#withadditionaldependencyattribute) container configuration option to let the container know that it should watch for additional attributes besides the built-in [`Dependency`](/docs/guides/service-resolution#attributes) attribute upon building up the [resolution tree](/docs/getting-started/glossary#resolution-tree).
- **Additional DependencyName attributes**: you can use the [`.WithAdditionalDependencyNameAttribute()`](/docs/configuration/container-configuration#withadditionaldependencynameattribute) container configuration option to use additional dependency name indicator attributes besides the built-in [`DependencyName`](/docs/guides/service-resolution#attributes) attribute.
</div>
<div>
<Tabs>
<TabItem value="Dependency" label="Dependency">
```cs
class DbBackup : IJob
{
[CustomDependency("Console")]
public ILogger Logger { get; set; }
public DbBackup()
{ }
}
var container = new StashboxContainer(options => options
.WithAdditionalDependencyAttribute<CustomDependencyAttribute>());
container.Register<ILogger, ConsoleLogger>("Console");
container.Register<ILogger, FileLogger>("File");
container.Register<IJob, DbBackup>();
// the container will resolve DbBackup with ConsoleLogger.
IJob job = container.Resolve<IJob>();
```
</TabItem>
<TabItem value="DependencyName" label="DependencyName">
```cs
class DbBackup : IJob
{
public string Name { get; set; }
public DbBackup([CustomName] string name)
{ }
}
var container = new StashboxContainer(options => options
.WithAdditionalDependencyNameAttribute<CustomNameAttribute>());
container.Register<IJob, DbBackup>("Backup");
IJob job = container.Resolve<IJob>();
// name is "Backup".
var name = job.Name;
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Dependency binding
<CodeDescPanel>
<div>
The same dependency configuration functionality as attributes, but without attributes.
- **Binding to a parameter**: the same functionality as the [`Dependency`](/docs/guides/service-resolution#attributes) attribute on a constructor or method parameter, enabling [named resolution](/docs/getting-started/glossary#named-resolution).
- **Binding to a property/field**: the same functionality as the [`Dependency`](/docs/guides/service-resolution#attributes) attribute, enabling the injection of the given property/field.
:::info
There are further dependency binding options [available](/docs/configuration/registration-configuration#dependency-configuration) on the registration configuration API.
:::
</div>
<div>
<Tabs>
<TabItem value="Bind to parameter" label="Bind to parameter">
```cs
class DbBackup : IJob
{
public DbBackup(ILogger logger)
{ }
}
container.Register<ILogger, ConsoleLogger>("Console");
container.Register<ILogger, FileLogger>("File");
// registration of service with the dependency binding.
container.Register<IJob, DbBackup>(options => options
.WithDependencyBinding("logger", "Console"));
// the container will resolve DbBackup with ConsoleLogger.
IJob job = container.Resolve<IJob>();
```
</TabItem>
<TabItem value="Bind to property / field" label="Bind to property / field">
```cs
class DbBackup : IJob
{
public ILogger Logger { get; set; }
}
container.Register<ILogger, ConsoleLogger>("Console");
container.Register<ILogger, FileLogger>("File");
// registration of service with the member injection.
container.Register<IJob, DbBackup>(options => options
.WithDependencyBinding("Logger", "Console"));
// the container will resolve DbBackup with ConsoleLogger.
IJob job = container.Resolve<IJob>();
```
</TabItem>
</Tabs>
</div>
</CodeDescPanel>
## Conventional resolution
<CodeDescPanel>
<div>
When you enable conventional resolution, the container treats member and method parameter names as their dependency identifier.
It's like an implicit dependency binding on every class member.
First, you have to enable conventional resolution through the configuration of the container:
```cs
new StashboxContainer(options => options
.TreatParameterAndMemberNameAsDependencyName());
```
:::note
The container will attempt a [named resolution](/docs/getting-started/glossary#named-resolution) on each dependency based on their parameter or property/field name.
:::
</div>
<div>
<Tabs>
<TabItem value="Parameters" label="Parameters">
```cs
class DbBackup : IJob
{
public DbBackup(
// the parameter name identifies the dependency.
ILogger consoleLogger)
{ }
}
container.Register<ILogger, ConsoleLogger>("consoleLogger");
con
gitextract_6bqpv2p6/
├── .gitattributes
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ ├── codeql-analysis.yml
│ ├── docs.yml
│ ├── linux-macOS-CI.yml
│ ├── sonar-analysis.yml
│ └── stale.yml
├── .gitignore
├── .version
├── CHANGELOG.md
├── LICENSE
├── README.md
├── appveyor-release.yml
├── appveyor.yml
├── docs/
│ ├── .gitignore
│ ├── babel.config.js
│ ├── docs/
│ │ ├── advanced/
│ │ │ ├── child-containers.md
│ │ │ ├── decorators.md
│ │ │ ├── generics.md
│ │ │ ├── special-resolution-cases.md
│ │ │ └── wrappers-resolvers.md
│ │ ├── configuration/
│ │ │ ├── container-configuration.md
│ │ │ └── registration-configuration.md
│ │ ├── diagnostics/
│ │ │ ├── utilities.md
│ │ │ └── validation.md
│ │ ├── getting-started/
│ │ │ ├── glossary.md
│ │ │ ├── introduction.md
│ │ │ └── overview.md
│ │ └── guides/
│ │ ├── advanced-registration.md
│ │ ├── basics.md
│ │ ├── lifetimes.md
│ │ ├── scopes.md
│ │ └── service-resolution.md
│ ├── docusaurus.config.js
│ ├── package.json
│ ├── sidebars.js
│ ├── src/
│ │ ├── components/
│ │ │ ├── CodeDescPanel/
│ │ │ │ ├── index.tsx
│ │ │ │ └── styles.module.scss
│ │ │ ├── NavbarItems/
│ │ │ │ ├── SeparatorNavbarItem/
│ │ │ │ │ ├── index.tsx
│ │ │ │ │ └── styles.module.scss
│ │ │ │ └── SvgNavbarItem/
│ │ │ │ ├── index.tsx
│ │ │ │ └── styles.module.scss
│ │ │ └── SvgIcon/
│ │ │ └── index.tsx
│ │ ├── css/
│ │ │ ├── custom.scss
│ │ │ ├── pagination.scss
│ │ │ ├── search.scss
│ │ │ ├── sidebar.scss
│ │ │ ├── tab.scss
│ │ │ └── toc.scss
│ │ ├── pages/
│ │ │ ├── index.js
│ │ │ └── index.module.scss
│ │ ├── theme/
│ │ │ ├── CodeBlock/
│ │ │ │ └── index.js
│ │ │ ├── Footer/
│ │ │ │ ├── index.js
│ │ │ │ └── styles.module.scss
│ │ │ └── NavbarItem/
│ │ │ └── ComponentTypes.js
│ │ └── utils/
│ │ └── prismDark.mjs
│ └── static/
│ └── .nojekyll
├── sandbox/
│ ├── stashbox.assemblyload/
│ │ ├── Program.cs
│ │ └── stashbox.assemblyload.csproj
│ ├── stashbox.benchmarks/
│ │ ├── BeginScopeBenchmarks.cs
│ │ ├── ChildContainerBenchmarks.cs
│ │ ├── DecoratorBenchmarks.cs
│ │ ├── DisposeBenchmarks.cs
│ │ ├── EnumerableBenchmarks.cs
│ │ ├── FinalizerBenchmarks.cs
│ │ ├── FuncBenchmarks.cs
│ │ ├── NullableBenchmarks.cs
│ │ ├── Program.cs
│ │ ├── PropertyBenchmarks.cs
│ │ ├── RegisterBenchmarks.cs
│ │ ├── ResolveBenchmarks.cs
│ │ ├── ScopedBenchmarks.cs
│ │ ├── SingletonBenchmarks.cs
│ │ ├── Stashbox.Benchmarks.csproj
│ │ └── TreeBenchmarks.cs
│ ├── stashbox.sandbox.sln
│ └── stashbox.trimmed/
│ ├── Program.cs
│ └── stashbox.trimmed.csproj
├── sn.snk
├── src/
│ ├── Attributes/
│ │ ├── DependencyAttribute.cs
│ │ ├── DependencyNameAttribute.cs
│ │ └── InjectionMethodAttribute.cs
│ ├── Configuration/
│ │ ├── ContainerConfiguration.cs
│ │ ├── ContainerConfigurator.cs
│ │ └── Rules.cs
│ ├── ContainerContext.cs
│ ├── Exceptions/
│ │ ├── CompositionRootNotFoundException.cs
│ │ ├── ConstructorNotFoundException.cs
│ │ ├── InvalidRegistrationException.cs
│ │ ├── LifetimeValidationFailedException.cs
│ │ ├── ResolutionFailedException.cs
│ │ └── ServiceAlreadyRegisteredException.cs
│ ├── Expressions/
│ │ ├── Compile/
│ │ │ ├── Closure.cs
│ │ │ ├── CompilerContext.cs
│ │ │ ├── Emitters/
│ │ │ │ ├── Emitter.Assign.cs
│ │ │ │ ├── Emitter.Call.cs
│ │ │ │ ├── Emitter.Constant.cs
│ │ │ │ ├── Emitter.Convert.cs
│ │ │ │ ├── Emitter.Default.cs
│ │ │ │ ├── Emitter.Invoke.cs
│ │ │ │ ├── Emitter.Lambda.cs
│ │ │ │ ├── Emitter.MemberAccess.cs
│ │ │ │ ├── Emitter.MemberInit.cs
│ │ │ │ ├── Emitter.New.cs
│ │ │ │ ├── Emitter.NewArrayInit.cs
│ │ │ │ ├── Emitter.Parameter.cs
│ │ │ │ └── Emitter.cs
│ │ │ ├── ExpressionEmitter.cs
│ │ │ ├── Extensions/
│ │ │ │ ├── CollectionExtensions.cs
│ │ │ │ └── ILGeneratorExtensions.cs
│ │ │ ├── NestedLambda.cs
│ │ │ ├── TreeAnalyzer.cs
│ │ │ └── Utils.cs
│ │ ├── ExpressionBuilder.Default.cs
│ │ ├── ExpressionBuilder.Factory.cs
│ │ ├── ExpressionBuilder.Func.cs
│ │ ├── ExpressionBuilder.cs
│ │ ├── ExpressionFactory.Member.cs
│ │ ├── ExpressionFactory.Method.cs
│ │ └── ExpressionFactory.cs
│ ├── Extensions/
│ │ ├── AssemblyExtensions.cs
│ │ ├── CollectionExtensions.cs
│ │ ├── EnumerableExtensions.cs
│ │ ├── ExpressionExtensions.cs
│ │ └── TypeExtensions.cs
│ ├── ICompositionRoot.cs
│ ├── IContainerContext.cs
│ ├── IDecoratorRegistrator.cs
│ ├── IDependencyCollectionRegistrator.cs
│ ├── IDependencyReMapper.cs
│ ├── IDependencyRegistrator.cs
│ ├── IDependencyResolver.cs
│ ├── IFuncRegistrator.cs
│ ├── IResolutionScope.cs
│ ├── IStashboxContainer.cs
│ ├── Lifetime/
│ │ ├── AutoLifetime.cs
│ │ ├── EmptyLifetime.cs
│ │ ├── ExpressionLifetimeDescriptor.cs
│ │ ├── FactoryLifetimeDescriptor.cs
│ │ ├── LifetimeDescriptor.cs
│ │ ├── Lifetimes.cs
│ │ ├── NamedScopeLifetime.cs
│ │ ├── PerRequestLifetime.cs
│ │ ├── ScopedLifetime.cs
│ │ ├── SingletonLifetime.cs
│ │ └── TransientLifetime.cs
│ ├── Metadata.cs
│ ├── Multitenant/
│ │ ├── ITenantDistributor.cs
│ │ └── TenantDistributor.cs
│ ├── Override.cs
│ ├── ReadOnlyKeyValue.cs
│ ├── Registration/
│ │ ├── DecoratorRepository.cs
│ │ ├── Extensions/
│ │ │ ├── CollectionRegistratorExtensions.cs
│ │ │ ├── DependencyRegistratorExtensions.cs
│ │ │ ├── DependencyRemapperExtensions.cs
│ │ │ └── ServiceRepositoryExtensions.cs
│ │ ├── Fluent/
│ │ │ ├── BaseDecoratorConfigurator.cs
│ │ │ ├── BaseFluentConfigurator.cs
│ │ │ ├── DecoratorConfigurator.cs
│ │ │ ├── FluentServiceConfigurator.cs
│ │ │ ├── RegistrationConfigurator.cs
│ │ │ └── UnknownRegistrationConfigurator.cs
│ │ ├── IDecoratorRepository.cs
│ │ ├── IRegistrationRepository.cs
│ │ ├── OpenGenericRegistration.cs
│ │ ├── RegistrationDiagnosticsInfo.cs
│ │ ├── RegistrationRepository.cs
│ │ ├── SelectionRules/
│ │ │ ├── ConditionRule.cs
│ │ │ ├── DecoratorRule.cs
│ │ │ ├── EnumerableNameRule.cs
│ │ │ ├── IRegistrationSelectionRule.cs
│ │ │ ├── MetadataRule.cs
│ │ │ ├── NameRule.cs
│ │ │ ├── OpenGenericRule.cs
│ │ │ ├── RegistrationSelectionRules.cs
│ │ │ └── ScopeNameRule.cs
│ │ ├── ServiceRegistration.cs
│ │ └── ServiceRegistrator.cs
│ ├── Resolution/
│ │ ├── DelegateCache.cs
│ │ ├── DelegateCacheEntry.cs
│ │ ├── Extensions/
│ │ │ ├── DependencyResolverExtensions.cs
│ │ │ ├── InjectionParameterExtensions.cs
│ │ │ └── ResolutionBehaviorExtensions.cs
│ │ ├── ILookupResolver.cs
│ │ ├── IRequestContext.cs
│ │ ├── IResolutionStrategy.cs
│ │ ├── IResolver.cs
│ │ ├── IWrapper.cs
│ │ ├── RequestContext.cs
│ │ ├── ResolutionBehavior.cs
│ │ ├── ResolutionContext.cs
│ │ ├── ResolutionStrategy.cs
│ │ ├── Resolvers/
│ │ │ ├── DefaultValueResolver.cs
│ │ │ ├── OptionalValueResolver.cs
│ │ │ ├── ParentContainerResolver.cs
│ │ │ ├── ServiceProviderResolver.cs
│ │ │ └── UnknownTypeResolver.cs
│ │ ├── ServiceContext.cs
│ │ ├── TypeInformation.cs
│ │ └── Wrappers/
│ │ ├── EnumerableWrapper.cs
│ │ ├── FuncWrapper.cs
│ │ ├── KeyValueWrapper.cs
│ │ ├── LazyWrapper.cs
│ │ └── MetadataWrapper.cs
│ ├── ResolutionScope.AsyncInitializer.cs
│ ├── ResolutionScope.Disposable.cs
│ ├── ResolutionScope.Resolver.cs
│ ├── ResolutionScope.cs
│ ├── StashboxContainer.CollectionRegistrator.cs
│ ├── StashboxContainer.FuncRegistrator.cs
│ ├── StashboxContainer.ReMapper.cs
│ ├── StashboxContainer.Registrator.cs
│ ├── StashboxContainer.Resolver.cs
│ ├── StashboxContainer.cs
│ ├── Utils/
│ │ ├── Constants.cs
│ │ ├── Data/
│ │ │ ├── ExpandableArray.cs
│ │ │ ├── HashTree.cs
│ │ │ ├── Immutable/
│ │ │ │ ├── ImmutableBucket.cs
│ │ │ │ ├── ImmutableLinkedList.cs
│ │ │ │ └── ImmutableTree.cs
│ │ │ ├── Pair.cs
│ │ │ ├── Stack.cs
│ │ │ └── Tree.cs
│ │ ├── Shield.cs
│ │ ├── Swap.cs
│ │ └── TypeCache.cs
│ └── stashbox.csproj
├── stashbox.sln
└── test/
├── ActivateTests.cs
├── AssemblyTests.cs
├── AsyncDisposeTests.cs
├── AttributeTests.cs
├── BuildUpTests.cs
├── CanResolveTests.cs
├── ChildContainerTests.cs
├── CircularDependencyTests.cs
├── CompilerTests/
│ ├── ConstantTests.cs
│ ├── DefaultTests.cs
│ └── NullableTests.cs
├── ComplexResolution.cs
├── CompositionTests.cs
├── ConditionalTests.cs
├── ConfigurationTests.cs
├── ConstructorSelectionTests.cs
├── ContainerTests.cs
├── DataTests/
│ └── TreeTests.cs
├── DecoratorTests.cs
├── DependencyBindingTests.cs
├── DisposeOrderTests.cs
├── DisposeTests.cs
├── EnumerableTests.cs
├── FactoryTests.cs
├── FuncTests.cs
├── GenericTests.cs
├── HierarchyTests.cs
├── InitializerFinalizerTests.cs
├── InjectionMemberTests.cs
├── InstanceBuilderTests.cs
├── IssueTests/
│ ├── 102_Resolving_Func_use_wrong_constructor.cs
│ ├── 103_Resolving_base_class_dependencies.cs
│ ├── 105_Question_How_to_work_with_dependency_overrides_from_factory_method.cs
│ ├── 114_Unable_to_resolve_IHubContext.cs
│ ├── 116_Different_types_registered_with_the_same_name.cs
│ ├── 118_Named_resolution_using_ResolveAll_returns_all_named_and_unnamed_instanсes.cs
│ ├── 119_generic_resolution_issue.cs
│ ├── 129_Sharing_singleton_instances_between_Resolve_and_ResolveAll_and_subtypes.cs
│ ├── 132_OpenGenericResolveIssue.cs
│ ├── 141_Decorator_and_ResolveAll.cs
│ ├── 144_Generic_decorators_broken.cs
│ ├── 163_Last_write_win_problem_when_hash_collision_happens.cs
│ ├── 16_Extensions_Identity_OptionsMonitor.cs
│ ├── 213_Bug_Resolving_Lazy_Func.cs
│ ├── 228_Stashbox_does_not_handle_Optional_correctly.cs
│ ├── 33_ScopedLifetime_thread_safety.cs
│ ├── 34_Resolution_from_parent_container.cs
│ ├── 35_Mixture_of_named_and_non_named_registrations_result_in_the_wrong_type_resolved.cs
│ ├── 37_Resolver_factory_invoke_doesnt_pass_different_parameters_given_when_theyre_the_same_type.cs
│ ├── 38_Injecting_container_itself.cs
│ ├── 42_Circular_dependency_tracking_doesnt_work_with_factory_resolution.cs
│ ├── 43_Issue_with_Member_Injection_with_Attribute_but_private_setter.cs
│ ├── 44_Lifetime_Issues.cs
│ ├── 46_AspNetCore_Failing_spec_tests_forconstrained_generics.cs
│ ├── 48_Chained_named_scopes_are_not_working_properly.cs
│ ├── 49_Unable_to_use_nullable_types_with_injection_parameters.cs
│ ├── 50_Generate_one_instance_for_multiple_interfaces.cs
│ ├── 51_WithUnknownTypeResolution_breaks_constructor_selection_rules.cs
│ ├── 52_Verify_child_container_working.cs
│ ├── 53_ComposeBy_with_instance_or_injection.cs
│ ├── 54_Make_InjectionParameter_configuration_more_fluent.cs
│ ├── 55_Conditions_on_member_name_are_not_easy_to_recognize.cs
│ ├── 58_InjectionParameter_NullReference.cs
│ ├── 59_Static_factory_fails.cs
│ ├── 63_named_unnamed_resolution_not_working_as_expected.cs
│ ├── 64_WithFactory_MemberInjection_Not_Working_With_ImplementationType.cs
│ ├── 66_Named_PutInstanceInScope.cs
│ ├── 67_Dictionaries_get_resolved_to_arrays_of_key_type_by_default.cs
│ ├── 68_Programmatic_multiple_instances_registration.cs
│ ├── 70_UnkownType_overrides_instance_in_scope.cs
│ ├── 71_FastExpressionCompiler_Issue.cs
│ ├── 72_Default_lifetime_set.cs
│ ├── 76_Exception_when_building_expressions.cs
│ ├── 77_UnknownType_Resolution_Does_Not_Work.cs
│ ├── 80_Expected_override_behaviour_not_working_with_scopes.cs
│ ├── 84_DefinesScope_does_not_work_correctly.cs
│ ├── 88_IdentityServer_not_compatible.cs
│ ├── 89_Call_interception.cs
│ ├── 91_Resolving_with_custom_parameter_values.cs
│ ├── 97_Does_Scope_AttachToParent_only_affect_Dispose_behaviour.cs
│ └── 98_Replace_doesnt_working_singleton.cs
├── KeyValueTests.cs
├── KeyedTests.cs
├── LazyTests.cs
├── LifetimeTests.cs
├── MetadataTests.cs
├── MultitenantTests.cs
├── NamedResolveTests.cs
├── NamedScopeTests.cs
├── OverrideTests.cs
├── PerRequestResolutionTests.cs
├── ReMapTests.cs
├── RegisterTypesTests.cs
├── ResolveFactoryTests.cs
├── ResolverTests.cs
├── ScopeTests.cs
├── ServiceProviderTests.cs
├── StandardResolveTests.cs
├── Utils/
│ ├── CompilerType.cs
│ ├── CompilerTypeTestData.cs
│ ├── ContainerConfiguratorExtensions.cs
│ └── TypeGen.cs
├── WireUpTests.cs
├── WithDynamicResolutionTests.cs
├── stashbox.tests.csproj
└── testassembly/
├── Composition.cs
├── TestClasses.cs
└── testassembly.csproj
Showing preview only (300K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3449 symbols across 276 files)
FILE: docs/docusaurus.config.js
function createConfig (line 242) | async function createConfig() {
FILE: docs/src/components/CodeDescPanel/index.tsx
function CodeDescPanel (line 4) | function CodeDescPanel({children}) {
FILE: docs/src/components/NavbarItems/SeparatorNavbarItem/index.tsx
function SeparatorNavbarItem (line 5) | function SeparatorNavbarItem({mobile, ...props}): JSX.Element {
FILE: docs/src/components/NavbarItems/SvgNavbarItem/index.tsx
function SvgNavbarItem (line 7) | function SvgNavbarItem({icon, href, mobile, ...props}): JSX.Element {
FILE: docs/src/components/SvgIcon/index.tsx
function SvgIcon (line 8) | function SvgIcon({icon, ...props}): JSX.Element {
FILE: docs/src/pages/index.js
function HomepageHeader (line 9) | function HomepageHeader() {
function Home (line 53) | function Home() {
FILE: docs/src/theme/CodeBlock/index.js
function CodeBlockWrapper (line 4) | function CodeBlockWrapper(props) {
FILE: docs/src/theme/Footer/index.js
function Footer (line 23) | function Footer() {
FILE: sandbox/stashbox.benchmarks/BeginScopeBenchmarks.cs
class BeginScopeBenchmarks (line 7) | [MemoryDiagnoser]
method Old (line 16) | [Benchmark(Baseline = true)]
method New (line 22) | [Benchmark]
FILE: sandbox/stashbox.benchmarks/ChildContainerBenchmarks.cs
class ChildContainerBenchmarks (line 7) | [MemoryDiagnoser]
method Setup (line 16) | [GlobalSetup]
method Old (line 28) | [Benchmark(Baseline = true)]
method New (line 36) | [Benchmark]
class A (line 44) | class A
method A (line 46) | public A(B b, C c)
class B (line 50) | class B
method B (line 52) | public B(C c)
class C (line 56) | class C { }
FILE: sandbox/stashbox.benchmarks/DecoratorBenchmarks.cs
class DecoratorBenchmarks (line 7) | [MemoryDiagnoser]
method Setup (line 16) | [GlobalSetup]
method Old (line 26) | [Benchmark(Baseline = true)]
method New (line 32) | [Benchmark]
type IA (line 38) | interface IA { }
class A (line 40) | class A : IA { }
class ADec (line 42) | class ADec : IA
method ADec (line 44) | public ADec(IA a) { }
FILE: sandbox/stashbox.benchmarks/DisposeBenchmarks.cs
class DisposeBenchmarks (line 8) | [MemoryDiagnoser]
method Setup (line 19) | [GlobalSetup]
method Old (line 33) | [Benchmark(Baseline = true)]
method New (line 46) | [Benchmark]
class DisposableObj1 (line 59) | private class DisposableObj1 : IDisposable
method Dispose (line 61) | public void Dispose()
class DisposableObj3 (line 65) | private class DisposableObj3 : IDisposable
method DisposableObj3 (line 70) | public DisposableObj3(DisposableObj4 obj4, DisposableObj1 obj1)
method Dispose (line 76) | public void Dispose()
class DisposableObj4 (line 80) | private class DisposableObj4 : IDisposable
method DisposableObj4 (line 84) | public DisposableObj4(DisposableObj1 obj1)
method Dispose (line 89) | public void Dispose()
class DisposableObj2 (line 93) | private class DisposableObj2 : IDisposable
method DisposableObj2 (line 98) | public DisposableObj2(DisposableObj1 obj1, DisposableObj3 obj3)
method Dispose (line 104) | public void Dispose()
FILE: sandbox/stashbox.benchmarks/EnumerableBenchmarks.cs
class EnumerableBenchmarks (line 8) | [MemoryDiagnoser]
method Setup (line 17) | [GlobalSetup]
method Old (line 31) | [Benchmark(Baseline = true)]
method New (line 37) | [Benchmark]
type IA (line 43) | interface IA { }
class A (line 45) | class A : IA
method A (line 47) | public A(B b)
class AA (line 51) | class AA : IA
method AA (line 53) | public AA(B b)
class AAA (line 57) | class AAA : IA
method AAA (line 59) | public AAA(B b)
class B (line 63) | class B { }
FILE: sandbox/stashbox.benchmarks/FinalizerBenchmarks.cs
class FinalizerBenchmarks (line 7) | [MemoryDiagnoser]
method Setup (line 16) | [GlobalSetup]
method Old (line 24) | [Benchmark(Baseline = true)]
method New (line 40) | [Benchmark]
class A (line 56) | class A
method FinalizeA (line 60) | public void FinalizeA()
FILE: sandbox/stashbox.benchmarks/FuncBenchmarks.cs
class FuncBenchmarks (line 8) | [MemoryDiagnoser]
method Setup (line 17) | [GlobalSetup]
method Old (line 27) | [Benchmark(Baseline = true)]
method New (line 34) | [Benchmark]
class A (line 41) | class A
method A (line 43) | public A(B b)
class B (line 47) | class B { }
FILE: sandbox/stashbox.benchmarks/NullableBenchmarks.cs
class NullableBenchmarks (line 7) | [MemoryDiagnoser]
method Old (line 16) | [Benchmark(Baseline = true)]
method New (line 22) | [Benchmark]
FILE: sandbox/stashbox.benchmarks/Program.cs
class Program (line 7) | class Program
method Main (line 9) | static void Main()
FILE: sandbox/stashbox.benchmarks/PropertyBenchmarks.cs
class PropertyBenchmarks (line 7) | [MemoryDiagnoser]
method Setup (line 16) | [GlobalSetup]
method Old (line 26) | [Benchmark(Baseline = true)]
method New (line 32) | [Benchmark]
class A (line 38) | class A
class B (line 43) | class B { }
FILE: sandbox/stashbox.benchmarks/RegisterBenchmarks.cs
class RegisterBenchmarks (line 7) | [MemoryDiagnoser]
method Old (line 16) | [Benchmark(Baseline = true)]
method New (line 22) | [Benchmark]
class A (line 28) | class A { }
class B (line 30) | class B { }
FILE: sandbox/stashbox.benchmarks/ResolveBenchmarks.cs
class ResolveBenchmarks (line 7) | [MemoryDiagnoser]
method Setup (line 16) | [GlobalSetup]
method Old (line 28) | [Benchmark(Baseline = true)]
method New (line 34) | [Benchmark]
class A (line 40) | class A
method A (line 42) | public A(B b, C c)
class B (line 46) | class B
method B (line 48) | public B(C c)
class C (line 52) | class C { }
FILE: sandbox/stashbox.benchmarks/ScopedBenchmarks.cs
class ScopedBenchmarks (line 7) | [MemoryDiagnoser]
method Setup (line 18) | [GlobalSetup]
method Old (line 28) | [Benchmark(Baseline = true)]
method New (line 35) | [Benchmark]
class A (line 42) | class A
method A (line 44) | public A(B b)
class B (line 48) | class B { }
FILE: sandbox/stashbox.benchmarks/SingletonBenchmarks.cs
class SingletonBenchmarks (line 7) | [MemoryDiagnoser]
method Setup (line 16) | [GlobalSetup]
method Old (line 28) | [Benchmark(Baseline = true)]
method New (line 34) | [Benchmark]
class A (line 40) | class A
method A (line 42) | public A(B b, C c)
class B (line 46) | class B
method B (line 48) | public B(C c)
class C (line 52) | class C { }
FILE: sandbox/stashbox.benchmarks/TreeBenchmarks.cs
class TreeBenchmarks (line 11) | [MemoryDiagnoser]
method Setup (line 23) | [GlobalSetup]
method ImmutableDictionary_Add (line 37) | [Benchmark]
method ImmutableTree_AddOrUpdate (line 49) | [Benchmark]
method ImmutableDictionary_TryGetValue (line 62) | [Benchmark]
method ImmutableTree_GetOrDefault (line 71) | [Benchmark]
FILE: sandbox/stashbox.trimmed/Program.cs
class A (line 16) | class A
method A (line 18) | public A(B b)
class B (line 24) | class B
method B (line 26) | public B()
class Runner (line 32) | class Runner
method Run (line 34) | [MethodImpl((short)MethodImplAttributes.NoInlining)]
FILE: src/Attributes/DependencyAttribute.cs
class DependencyAttribute (line 8) | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property |...
method DependencyAttribute (line 20) | public DependencyAttribute(object? name = null)
FILE: src/Attributes/DependencyNameAttribute.cs
class DependencyNameAttribute (line 8) | [AttributeUsage(AttributeTargets.Parameter)]
FILE: src/Attributes/InjectionMethodAttribute.cs
class InjectionMethodAttribute (line 8) | [AttributeUsage(AttributeTargets.Method)]
FILE: src/Configuration/ContainerConfiguration.cs
class ContainerConfiguration (line 17) | public class ContainerConfiguration
method ContainerConfiguration (line 139) | internal ContainerConfiguration() { }
method ContainerConfiguration (line 141) | private ContainerConfiguration(bool trackTransientsForDisposalEnabled,
method Clone (line 190) | internal ContainerConfiguration Clone() =>
FILE: src/Configuration/ContainerConfigurator.cs
class ContainerConfigurator (line 16) | public class ContainerConfigurator
method ContainerConfigurator (line 23) | internal ContainerConfigurator(ContainerConfiguration? containerConfig...
method WithDisposableTransientTracking (line 34) | public ContainerConfigurator WithDisposableTransientTracking(bool enab...
method WithRegistrationBehavior (line 45) | public ContainerConfigurator WithRegistrationBehavior(Rules.Registrati...
method WithDefaultValueInjection (line 57) | public ContainerConfigurator WithDefaultValueInjection(bool enabled = ...
method WithUnknownTypeResolution (line 70) | public ContainerConfigurator WithUnknownTypeResolution(Action<UnknownR...
method WithAutoMemberInjection (line 84) | public ContainerConfigurator WithAutoMemberInjection(Rules.AutoMemberI...
method WithRequiredMemberInjection (line 98) | public ContainerConfigurator WithRequiredMemberInjection(bool enabled ...
method WithConstructorSelectionRule (line 108) | public ContainerConfigurator WithConstructorSelectionRule(Func<IEnumer...
method OnContainerConfigurationChanged (line 118) | public ContainerConfigurator OnContainerConfigurationChanged(Action<Co...
method TreatParameterAndMemberNameAsDependencyName (line 130) | public ContainerConfigurator TreatParameterAndMemberNameAsDependencyNa...
method WithNamedDependencyResolutionForUnNamedRequests (line 143) | public ContainerConfigurator WithNamedDependencyResolutionForUnNamedRe...
method WithIgnoreServicesWithUniversalNameForUniversalNamedRequests (line 156) | public ContainerConfigurator WithIgnoreServicesWithUniversalNameForUni...
method WithForceThrowWhenNamedDependencyIsNotResolvable (line 168) | public ContainerConfigurator WithForceThrowWhenNamedDependencyIsNotRes...
method WithDefaultLifetime (line 179) | public ContainerConfigurator WithDefaultLifetime(LifetimeDescriptor li...
method WithLifetimeValidation (line 191) | public ContainerConfigurator WithLifetimeValidation(bool enabled = true)
method WithReBuildSingletonsInChildContainer (line 205) | public ContainerConfigurator WithReBuildSingletonsInChildContainer(boo...
method WithVariantGenericTypes (line 217) | public ContainerConfigurator WithVariantGenericTypes(bool enabled = true)
method WithExceptionOverEmptyCollection (line 230) | public ContainerConfigurator WithExceptionOverEmptyCollection(bool ena...
method WithExpressionCompiler (line 241) | public ContainerConfigurator WithExpressionCompiler(Func<LambdaExpress...
method WithUniversalName (line 252) | public ContainerConfigurator WithUniversalName(object name)
method WithAdditionalDependencyNameAttribute (line 263) | public ContainerConfigurator WithAdditionalDependencyNameAttribute<TAt...
method WithAdditionalDependencyAttribute (line 276) | public ContainerConfigurator WithAdditionalDependencyAttribute<TAttrib...
method OverrideResolutionFailedExceptionWith (line 289) | public ContainerConfigurator OverrideResolutionFailedExceptionWith<TEx...
FILE: src/Configuration/Rules.cs
class Rules (line 13) | public static class Rules
class ServiceRegistrationFilters (line 18) | public static class ServiceRegistrationFilters
type RegistrationBehavior (line 34) | public enum RegistrationBehavior
type AutoMemberInjectionRules (line 60) | [Flags]
class ConstructorSelection (line 87) | public static class ConstructorSelection
class ExpressionCompilers (line 105) | public static class ExpressionCompilers
FILE: src/ContainerContext.cs
class ContainerContext (line 7) | internal class ContainerContext : IContainerContext
method ContainerContext (line 9) | public ContainerContext(IContainerContext? parentContext,
FILE: src/Exceptions/CompositionRootNotFoundException.cs
class CompositionRootNotFoundException (line 10) | [Serializable]
method CompositionRootNotFoundException (line 18) | public CompositionRootNotFoundException(Assembly assembly, Exception? ...
method CompositionRootNotFoundException (line 23) | #if NET8_0_OR_GREATER
FILE: src/Exceptions/ConstructorNotFoundException.cs
class ConstructorNotFoundException (line 10) | [Serializable]
method ConstructorNotFoundException (line 19) | public ConstructorNotFoundException(Type type, Type[] argumentTypes, E...
method ConstructorNotFoundException (line 28) | public ConstructorNotFoundException(Type type, Exception? innerExcepti...
method ConstructorNotFoundException (line 38) | public ConstructorNotFoundException(Type type, Type argument, Exceptio...
method ConstructorNotFoundException (line 43) | #if NET8_0_OR_GREATER
FILE: src/Exceptions/InvalidRegistrationException.cs
class InvalidRegistrationException (line 9) | [Serializable]
method InvalidRegistrationException (line 23) | public InvalidRegistrationException(Type? type, string message, Except...
method InvalidRegistrationException (line 30) | #if NET8_0_OR_GREATER
FILE: src/Exceptions/LifetimeValidationFailedException.cs
class LifetimeValidationFailedException (line 9) | [Serializable]
method LifetimeValidationFailedException (line 22) | public LifetimeValidationFailedException(Type? type, string message)
method LifetimeValidationFailedException (line 29) | #if NET8_0_OR_GREATER
FILE: src/Exceptions/ResolutionFailedException.cs
class ResolutionFailedException (line 9) | [Serializable]
method ResolutionFailedException (line 26) | public ResolutionFailedException(Type? type,
method ResolutionFailedException (line 36) | #if NET8_0_OR_GREATER
method ConstructMessage (line 43) | private static string ConstructMessage(Type? serviceType,
method CreateWithDesiredExceptionType (line 48) | internal static Exception CreateWithDesiredExceptionType(Type? service...
FILE: src/Exceptions/ServiceAlreadyRegisteredException.cs
class ServiceAlreadyRegisteredException (line 11) | [Serializable]
method ServiceAlreadyRegisteredException (line 24) | public ServiceAlreadyRegisteredException(Type? type, Exception? innerE...
method ServiceAlreadyRegisteredException (line 31) | #if NET8_0_OR_GREATER
FILE: src/Expressions/Compile/Closure.cs
class Closure (line 6) | internal class Closure
method Closure (line 12) | public Closure(object[] constants)
FILE: src/Expressions/Compile/CompilerContext.cs
class CompilerContext (line 7) | internal class CompilerContext
method CompilerContext (line 29) | public CompilerContext(Closure? target,
method CompilerContext (line 44) | private CompilerContext(ExpandableArray<Expression> definedVariables,
method Clone (line 67) | public CompilerContext Clone(ExpandableArray<Expression> definedVariab...
FILE: src/Expressions/Compile/Emitters/Emitter.Assign.cs
class Emitter (line 7) | internal static partial class Emitter
method TryEmit (line 9) | private static bool TryEmit(this BinaryExpression expression, ILGenera...
FILE: src/Expressions/Compile/Emitters/Emitter.Call.cs
class Emitter (line 7) | internal static partial class Emitter
method TryEmit (line 9) | private static bool TryEmit(this MethodCallExpression expression, ILGe...
FILE: src/Expressions/Compile/Emitters/Emitter.Constant.cs
class Emitter (line 9) | internal static partial class Emitter
method TryEmit (line 11) | private static bool TryEmit(this ConstantExpression expression, ILGene...
FILE: src/Expressions/Compile/Emitters/Emitter.Convert.cs
class Emitter (line 9) | internal static partial class Emitter
method TryEmit (line 11) | private static bool TryEmit(this UnaryExpression expression, ILGenerat...
FILE: src/Expressions/Compile/Emitters/Emitter.Default.cs
class Emitter (line 8) | internal static partial class Emitter
method TryEmit (line 10) | private static bool TryEmit(this DefaultExpression expression, ILGener...
FILE: src/Expressions/Compile/Emitters/Emitter.Invoke.cs
class Emitter (line 7) | internal static partial class Emitter
method TryEmit (line 9) | private static bool TryEmit(this InvocationExpression expression, ILGe...
FILE: src/Expressions/Compile/Emitters/Emitter.Lambda.cs
class Emitter (line 9) | internal static partial class Emitter
method TryEmit (line 11) | private static bool TryEmit(this LambdaExpression expression, ILGenera...
FILE: src/Expressions/Compile/Emitters/Emitter.MemberAccess.cs
class Emitter (line 8) | internal static partial class Emitter
method TryEmit (line 10) | private static bool TryEmit(this MemberExpression expression, ILGenera...
method EmitMemberAssign (line 20) | private static bool EmitMemberAssign(this MemberInfo member, ILGenerat...
method EmitMemberAccess (line 40) | private static bool EmitMemberAccess(this MemberInfo member, ILGenerat...
FILE: src/Expressions/Compile/Emitters/Emitter.MemberInit.cs
class Emitter (line 6) | internal static partial class Emitter
method TryEmit (line 8) | private static bool TryEmit(this MemberInitExpression expression, ILGe...
FILE: src/Expressions/Compile/Emitters/Emitter.New.cs
class Emitter (line 6) | internal static partial class Emitter
method TryEmit (line 8) | private static bool TryEmit(this NewExpression expression, ILGenerator...
FILE: src/Expressions/Compile/Emitters/Emitter.NewArrayInit.cs
class Emitter (line 8) | internal static partial class Emitter
method TryEmit (line 10) | private static bool TryEmit(this NewArrayExpression expression, ILGene...
FILE: src/Expressions/Compile/Emitters/Emitter.Parameter.cs
class Emitter (line 8) | internal static partial class Emitter
method TryEmit (line 10) | private static bool TryEmit(this ParameterExpression expression, ILGen...
FILE: src/Expressions/Compile/Emitters/Emitter.cs
class Emitter (line 11) | internal static partial class Emitter
method TryEmit (line 13) | public static bool TryEmit(this Expression expression, ILGenerator gen...
method CreateDynamicMethod (line 34) | public static DynamicMethod CreateDynamicMethod(CompilerContext contex...
method TryEmit (line 41) | private static bool TryEmit(this IList<Expression> expressions, ILGene...
method BuildLocals (line 51) | internal static LocalBuilder[] BuildLocals(this ExpandableArray<Expres...
FILE: src/Expressions/Compile/ExpressionEmitter.cs
class ExpressionEmitter (line 10) | internal static class ExpressionEmitter
method TryEmit (line 12) | public static bool TryEmit(this LambdaExpression expression, out Deleg...
method TryEmit (line 16) | public static bool TryEmit(this Expression expression, out Delegate? r...
FILE: src/Expressions/Compile/Extensions/CollectionExtensions.cs
class CollectionExtensions (line 8) | internal static class CollectionExtensions
method GetTypes (line 10) | public static Type[] GetTypes(this IList<ParameterExpression> parameters)
method Append (line 27) | public static Type[] Append(this Type type, Type[] types)
method Append (line 39) | public static Type[] Append(this Type[] types, Type type)
method Append (line 51) | public static TItem[] Append<TItem>(this TItem[] types, TItem[] others)
FILE: src/Expressions/Compile/Extensions/ILGeneratorExtensions.cs
class ILGeneratorExtensions (line 10) | internal static class ILGeneratorExtensions
method PrepareCapturedArgumentsHolderVariable (line 12) | public static LocalBuilder PrepareCapturedArgumentsHolderVariable(this...
method CopyParametersToCapturedArgumentsIfAny (line 22) | public static void CopyParametersToCapturedArgumentsIfAny(this ILGener...
method EmitMethod (line 40) | public static bool EmitMethod(this ILGenerator generator, MethodInfo i...
method LoadCapturedArgumentHolder (line 46) | public static void LoadCapturedArgumentHolder(this ILGenerator generat...
method EmitInteger (line 54) | public static void EmitInteger(this ILGenerator generator, int intValue)
method LoadParameter (line 76) | public static void LoadParameter(this ILGenerator generator, int index)
method InitValueType (line 93) | public static void InitValueType(this ILGenerator generator, Type type)
method TryEmitNumberConstant (line 101) | public static bool TryEmitNumberConstant(this ILGenerator generator, T...
FILE: src/Expressions/Compile/NestedLambda.cs
class NestedLambda (line 6) | internal class NestedLambda
method NestedLambda (line 11) | public NestedLambda(ExpandableArray<Expression> parameterExpressions, ...
FILE: src/Expressions/Compile/TreeAnalyzer.cs
class TreeAnalyzer (line 8) | internal class TreeAnalyzer
method TreeAnalyzer (line 20) | public TreeAnalyzer()
method TreeAnalyzer (line 28) | private TreeAnalyzer(bool isNestedLambda,
method Analyze (line 41) | public bool Analyze(Expression expression, params ParameterExpression[...
method Clone (line 123) | private TreeAnalyzer Clone(bool isLambda = false) =>
method Analyze (line 126) | private bool Analyze(IList<Expression> expressions, params ParameterEx...
method Analyze (line 136) | private bool Analyze(IList<MemberBinding> bindings, params ParameterEx...
FILE: src/Expressions/Compile/Utils.cs
class Utils (line 8) | internal static class Utils
method IsInPlaceEmittableConstant (line 10) | public static bool IsInPlaceEmittableConstant(Type type, object value) =>
method MapDelegateType (line 15) | public static Type MapDelegateType(Type[] paramTypes)
method GetPartialApplicationMethodInfo (line 31) | internal static MethodInfo GetPartialApplicationMethodInfo(Type[] type...
class PartialApplication (line 35) | internal static class PartialApplication
method ApplyPartial (line 40) | public static Func<TR> ApplyPartial<TV, TR>(Func<TV, TR> f, TV v) => (...
method ApplyPartial (line 41) | public static Func<T1, TR> ApplyPartial<TV, T1, TR>(Func<TV, T1, TR> f...
method ApplyPartial (line 42) | public static Func<T1, T2, TR> ApplyPartial<TV, T1, T2, TR>(Func<TV, T...
method ApplyPartial (line 43) | public static Func<T1, T2, T3, TR> ApplyPartial<TV, T1, T2, T3, TR>(Fu...
method ApplyPartial (line 44) | public static Func<T1, T2, T3, T4, TR> ApplyPartial<TV, T1, T2, T3, T4...
method ApplyPartial (line 45) | public static Func<T1, T2, T3, T4, T5, TR> ApplyPartial<TV, T1, T2, T3...
method ApplyPartial (line 46) | public static Func<T1, T2, T3, T4, T5, T6, TR> ApplyPartial<TV, T1, T2...
FILE: src/Expressions/ExpressionBuilder.Default.cs
class ExpressionBuilder (line 10) | internal static partial class ExpressionBuilder
method GetExpressionForDefault (line 12) | private static Expression? GetExpressionForDefault(ServiceRegistration...
method PrepareDefaultExpression (line 25) | private static Expression? PrepareDefaultExpression(ServiceRegistratio...
FILE: src/Expressions/ExpressionBuilder.Factory.cs
class ExpressionBuilder (line 11) | internal static partial class ExpressionBuilder
method GetExpressionForFactory (line 13) | private static Expression GetExpressionForFactory(ServiceRegistration ...
method ConstructFactoryExpression (line 30) | private static Expression ConstructFactoryExpression(FactoryOptions fa...
method GetFactoryParameters (line 41) | private static IEnumerable<Expression> GetFactoryParameters(FactoryOpt...
FILE: src/Expressions/ExpressionBuilder.Func.cs
class ExpressionBuilder (line 11) | internal static partial class ExpressionBuilder
method GetExpressionForFunc (line 13) | private static Expression GetExpressionForFunc(ServiceRegistration ser...
method GetFuncParametersWithScope (line 29) | private static Expression[] GetFuncParametersWithScope(IList<Parameter...
FILE: src/Expressions/ExpressionBuilder.cs
class ExpressionBuilder (line 11) | internal static partial class ExpressionBuilder
method BuildExpressionForRegistration (line 13) | internal static Expression? BuildExpressionForRegistration(ServiceRegi...
method BuildExpressionByRegistrationType (line 40) | private static Expression? BuildExpressionByRegistrationType(ServiceRe...
method ShouldHandleDisposal (line 59) | private static bool ShouldHandleDisposal(IContainerContext containerCo...
FILE: src/Expressions/ExpressionFactory.Member.cs
class ExpressionFactory (line 14) | internal static partial class ExpressionFactory
method GetMemberExpressions (line 16) | private static IEnumerable<Expression> GetMemberExpressions(
method GetMemberBindings (line 27) | private static IEnumerable<MemberBinding> GetMemberBindings(
method GetMemberExpression (line 38) | private static Expression GetMemberExpression(
FILE: src/Expressions/ExpressionFactory.Method.cs
class ExpressionFactory (line 16) | internal static partial class ExpressionFactory
method CreateParameterExpressionsForMethod (line 18) | private static IEnumerable<Expression> CreateParameterExpressionsForMe...
method SelectConstructor (line 41) | private static ConstructorInfo? SelectConstructor(
method CreateMethodExpressions (line 109) | private static IEnumerable<Expression> CreateMethodExpressions(
method TryBuildMethod (line 128) | private static bool TryBuildMethod(
FILE: src/Expressions/ExpressionFactory.cs
class ExpressionFactory (line 12) | internal static partial class ExpressionFactory
method ConstructBuildUpExpression (line 14) | public static Expression ConstructBuildUpExpression(
method ConstructBuildUpExpression (line 53) | public static Expression ConstructBuildUpExpression(
method ConstructExpression (line 82) | public static Expression? ConstructExpression(
method ConstructExpression (line 129) | public static Expression? ConstructExpression(
method CreateInitExpression (line 161) | private static Expression? CreateInitExpression(
FILE: src/Extensions/AssemblyExtensions.cs
class AssemblyExtensions (line 6) | internal static class AssemblyExtensions
method CollectTypes (line 8) | public static IEnumerable<Type> CollectTypes(this Assembly assembly) =>
FILE: src/Extensions/CollectionExtensions.cs
class CollectionExtensions (line 5) | internal static class CollectionExtensions
method GetOrDefault (line 7) | public static TResult? GetOrDefault<TResult>(this Dictionary<Registrat...
method GetOrDefault (line 15) | public static object? GetOrDefault(this Dictionary<RegistrationOption,...
method TryGet (line 23) | public static bool TryGet(this Dictionary<RegistrationOption, object?>...
method IsOn (line 35) | public static bool IsOn(this Dictionary<RegistrationOption, object?>? ...
FILE: src/Extensions/EnumerableExtensions.cs
class EnumerableExtensions (line 7) | internal static class EnumerableExtensions
method CastToArray (line 9) | public static TEnumerable[] CastToArray<TEnumerable>(this IEnumerable<...
method Append (line 12) | public static T[] Append<T>(this T[] array, T item)
method ContainsReference (line 24) | public static bool ContainsReference<TElement>(this TElement[] array, ...
method GetReferenceIndex (line 27) | public static int GetReferenceIndex<TElement>(this TElement[] array, T...
method LastElement (line 41) | public static TResult LastElement<TResult>(this TResult[] source) =>
method AsParameters (line 48) | public static ParameterExpression[] AsParameters(this Type[] source)
method AsParameterPairs (line 59) | public static Pair<bool, ParameterExpression>[] AsParameterPairs(this ...
method AsStack (line 70) | public static Stashbox.Utils.Data.Stack<TItem> AsStack<TItem>(this IEn...
FILE: src/Extensions/ExpressionExtensions.cs
class ExpressionExtensions (line 16) | public static class ExpressionExtensions
method PostProcess (line 18) | private static Expression PostProcess(this Expression expression)
method CompileDelegate (line 35) | public static Func<IResolutionScope, IRequestContext, object> CompileD...
method CompileDelegate (line 67) | public static Delegate CompileDelegate(this LambdaExpression expression)
method CompileDynamicDelegate (line 82) | public static Func<IResolutionScope, IRequestContext, Delegate> Compil...
method AsServiceContext (line 109) | public static ServiceContext AsServiceContext(this Expression? express...
method CompileFunc (line 118) | public static Func<T> CompileFunc<T>(this Expression<Func<T>> expressi...
method CompileFunc (line 128) | public static Func<T1, T> CompileFunc<T1, T>(this Expression<Func<T1, ...
method AssignTo (line 137) | public static BinaryExpression AssignTo(this Expression left, Expressi...
method AssignTo (line 145) | public static MemberAssignment AssignTo(this MemberInfo memberInfo, Ex...
method AsConstant (line 153) | public static ConstantExpression AsConstant(this object? obj) => Expre...
method AsConstant (line 161) | public static ConstantExpression AsConstant(this object? obj, Type typ...
method AsDefault (line 168) | public static DefaultExpression AsDefault(this Type type) => Expressio...
method AsBlock (line 176) | public static BlockExpression AsBlock(this IEnumerable<Expression> exp...
method AsBlock (line 179) | internal static BlockExpression AsBlock(this ExpandableArray<Expressio...
method AsBlock (line 182) | private static BlockExpression AsBlock(this ExpandableArray<Expression...
method AsLambda (line 191) | public static LambdaExpression AsLambda(this Expression expression, pa...
method AsLambda (line 201) | public static LambdaExpression AsLambda(this Expression expression, Ty...
method AsLambda (line 211) | public static LambdaExpression AsLambda(this Expression expression, Ty...
method AsLambda (line 220) | public static LambdaExpression AsLambda(this Expression expression, IE...
method AsLambda (line 229) | public static Expression<TDelegate> AsLambda<TDelegate>(this Expressio...
method AsVariable (line 238) | public static ParameterExpression AsVariable(this Type type, string? n...
method AsParameter (line 246) | public static ParameterExpression AsParameter(this Type type, string? ...
method CallStaticMethod (line 254) | public static MethodCallExpression CallStaticMethod(this MethodInfo me...
method CallStaticMethod (line 263) | public static MethodCallExpression CallStaticMethod(this MethodInfo me...
method CallMethod (line 273) | public static MethodCallExpression CallMethod(this Expression target, ...
method CallMethod (line 283) | public static MethodCallExpression CallMethod(this Expression target, ...
method CallMethod (line 293) | public static MethodCallExpression CallMethod(this MethodInfo methodIn...
method CallMethod (line 303) | public static MethodCallExpression CallMethod(this MethodInfo methodIn...
method ConvertTo (line 312) | public static Expression ConvertTo(this Expression expression, Type ty...
method InvokeLambda (line 320) | public static InvocationExpression InvokeLambda(this LambdaExpression ...
method InvokeDelegate (line 329) | public static InvocationExpression InvokeDelegate(this Delegate @deleg...
method InvokeDelegate (line 338) | public static InvocationExpression InvokeDelegate(this Delegate @deleg...
method MakeNew (line 347) | public static NewExpression MakeNew(this ConstructorInfo constructor, ...
method MakeNew (line 356) | public static NewExpression MakeNew(this ConstructorInfo constructor, ...
method Member (line 365) | public static MemberExpression Member(this Expression expression, Memb...
method Prop (line 374) | public static MemberExpression Prop(this Expression expression, Proper...
method Access (line 383) | public static MemberExpression Access(this PropertyInfo propertyInfo, ...
method InitMembers (line 392) | public static MemberInitExpression InitMembers(this Expression express...
method InitMembers (line 401) | public static MemberInitExpression InitMembers(this Expression express...
method InitNewArray (line 410) | public static NewArrayExpression InitNewArray(this Type type, params E...
method InitNewArray (line 419) | public static NewArrayExpression InitNewArray(this Type type, IEnumera...
FILE: src/Extensions/TypeExtensions.cs
class TypeExtensions (line 16) | internal static class TypeExtensions
method GetEnumerableType (line 18) | public static Type? GetEnumerableType(this Type type)
method IsClosedGenericType (line 29) | public static bool IsClosedGenericType(this Type type) =>
method IsOpenGenericType (line 32) | public static bool IsOpenGenericType(this Type type) =>
method GetConstructor (line 35) | public static ConstructorInfo? GetConstructor(this Type type, params T...
method IsDisposable (line 38) | public static bool IsDisposable(this Type type) =>
method IsCompositionRoot (line 45) | public static bool IsCompositionRoot(this Type type) =>
method IsResolvableType (line 48) | public static bool IsResolvableType(this Type type) =>
method GetRegisterableInterfaceTypes (line 53) | public static IEnumerable<Type> GetRegisterableInterfaceTypes(this Typ...
method GetRegisterableBaseTypes (line 61) | public static IEnumerable<Type> GetRegisterableBaseTypes(this Type type)
method GetPossibleDependencyTypes (line 71) | public static IEnumerable<Type> GetPossibleDependencyTypes(this Type t...
method Implements (line 82) | public static bool Implements(this Type type, Type interfaceType) =>
method ImplementsWithoutGenericCheck (line 87) | public static bool ImplementsWithoutGenericCheck(this Type type, Type ...
method ImplementsGenericType (line 90) | private static bool ImplementsGenericType(this Type type, Type generic...
method HasInterfaceThatMapsToGenericTypeDefinition (line 95) | private static bool HasInterfaceThatMapsToGenericTypeDefinition(this T...
method MapsToGenericTypeDefinition (line 100) | public static bool MapsToGenericTypeDefinition(this Type type, Type ge...
method GetFirstConstructor (line 105) | public static ConstructorInfo? GetFirstConstructor(this Type type) =>
method AsTypeInformation (line 108) | public static TypeInformation AsTypeInformation(this ParameterInfo par...
method AsTypeInformation (line 146) | public static TypeInformation AsTypeInformation(this MemberInfo member,
method GetUsableMethods (line 179) | public static MethodInfo[] GetUsableMethods(this Type type)
method GetUsableMembers (line 192) | public static MemberInfo[] GetUsableMembers(this Type type,
method SatisfiesGenericConstraintsOf (line 228) | public static bool SatisfiesGenericConstraintsOf(this Type implementat...
method HasDependencyNameAttribute (line 280) | private static bool HasDependencyNameAttribute(this ParameterInfo para...
method HasDependencyNameAttribute (line 285) | private static bool HasDependencyNameAttribute(this MemberInfo memberI...
method IsNullableType (line 290) | public static bool IsNullableType(this Type type) =>
method GetMethod (line 293) | public static MethodInfo GetMethod(this Delegate @delegate) =>
method IsCompiledLambda (line 296) | public static bool IsCompiledLambda(this Delegate @delegate) =>
method GetDiagnosticsView (line 299) | public static string GetDiagnosticsView(this Type type)
method IsObjectType (line 322) | private static bool IsObjectType(this Type type) => type == TypeCache<...
method HasDefaultConstructorConstraint (line 324) | private static bool HasDefaultConstructorConstraint(this GenericParame...
method HasReferenceTypeConstraint (line 327) | private static bool HasReferenceTypeConstraint(this GenericParameterAt...
method HasNotNullableValueTypeConstraint (line 330) | private static bool HasNotNullableValueTypeConstraint(this GenericPara...
method FilterProperty (line 333) | private static bool FilterProperty(this PropertyInfo prop, Dictionary<...
method FilterField (line 350) | private static bool FilterField(this FieldInfo field, Dictionary<objec...
method IsBackingField (line 367) | private static bool IsBackingField(this MemberInfo field) =>
method IsIndexer (line 370) | private static bool IsIndexer(this PropertyInfo property) =>
method GetOptionalDefaultValue (line 373) | private static TypeInformation.DefaultValueHolder? GetOptionalDefaultV...
method IsNullableMember (line 383) | private static bool IsNullableMember(this ParameterInfo parameter) =>
method IsNullableMember (line 386) | private static bool IsNullableMember(MemberInfo member, Type memberType)
method HasPublicParameterlessConstructor (line 416) | private static bool HasPublicParameterlessConstructor(this Type type) =>
method GetNameFromDependencyAttribute (line 419) | private static object? GetNameFromDependencyAttribute(this MemberInfo ...
method GetNameFromDependencyAttribute (line 429) | private static object? GetNameFromDependencyAttribute(this ParameterIn...
method HasDependencyAttribute (line 439) | private static bool HasDependencyAttribute(this MemberInfo property, C...
method HasRequiredAttribute (line 447) | private static bool HasRequiredAttribute(this MemberInfo memberInfo) =>
method GetInjectionAttribute (line 451) | private static InjectionMethodAttribute? GetInjectionAttribute(this Me...
FILE: src/ICompositionRoot.cs
type ICompositionRoot (line 6) | public interface ICompositionRoot
method Compose (line 12) | void Compose(IStashboxContainer container);
FILE: src/IContainerContext.cs
type IContainerContext (line 10) | public interface IContainerContext
FILE: src/IDecoratorRegistrator.cs
type IDecoratorRegistrator (line 9) | public interface IDecoratorRegistrator
method RegisterDecorator (line 18) | IStashboxContainer RegisterDecorator(Type typeFrom, Type typeTo, Actio...
method RegisterDecorator (line 27) | IStashboxContainer RegisterDecorator<TFrom, TTo>(Action<DecoratorConfi...
method RegisterDecorator (line 38) | IStashboxContainer RegisterDecorator(Type typeTo, Action<DecoratorConf...
method RegisterDecorator (line 47) | IStashboxContainer RegisterDecorator<TTo>(Action<DecoratorConfigurator...
method RegisterDecorator (line 57) | IStashboxContainer RegisterDecorator<TFrom>(Type typeTo,
FILE: src/IDependencyCollectionRegistrator.cs
type IDependencyCollectionRegistrator (line 10) | public interface IDependencyCollectionRegistrator
method RegisterTypesAs (line 20) | IStashboxContainer RegisterTypesAs(Type typeFrom,
method RegisterTypes (line 34) | IStashboxContainer RegisterTypes(IEnumerable<Type> types,
method ComposeBy (line 46) | IStashboxContainer ComposeBy(Type compositionRootType,
method ComposeBy (line 54) | IStashboxContainer ComposeBy(ICompositionRoot compositionRoot);
FILE: src/IDependencyReMapper.cs
type IDependencyReMapper (line 9) | public interface IDependencyReMapper
method ReMap (line 18) | IStashboxContainer ReMap<TFrom, TTo>(Action<RegistrationConfigurator<T...
method ReMap (line 29) | IStashboxContainer ReMap<TFrom>(Type typeTo, Action<RegistrationConfig...
method ReMap (line 39) | IStashboxContainer ReMap(Type typeFrom, Type typeTo, Action<Registrati...
method ReMap (line 47) | IStashboxContainer ReMap<TTo>(Action<RegistrationConfigurator<TTo, TTo...
method ReMapDecorator (line 57) | IStashboxContainer ReMapDecorator(Type typeFrom, Type typeTo, Action<D...
method ReMapDecorator (line 66) | IStashboxContainer ReMapDecorator<TFrom, TTo>(Action<DecoratorConfigur...
method ReMapDecorator (line 77) | IStashboxContainer ReMapDecorator<TFrom>(Type typeTo, Action<Decorator...
FILE: src/IDependencyRegistrator.cs
type IDependencyRegistrator (line 9) | public interface IDependencyRegistrator
method Register (line 17) | IStashboxContainer Register<TFrom, TTo>(Action<RegistrationConfigurato...
method Register (line 28) | IStashboxContainer Register<TFrom, TTo>(object? name = null)
method Register (line 39) | IStashboxContainer Register<TFrom>(Type typeTo, Action<RegistrationCon...
method Register (line 49) | IStashboxContainer Register(Type typeFrom, Type typeTo, Action<Registr...
method Register (line 57) | IStashboxContainer Register<TTo>(Action<RegistrationConfigurator<TTo, ...
method Register (line 66) | IStashboxContainer Register<TTo>(object? name = null)
method Register (line 75) | IStashboxContainer Register(Type typeTo, Action<RegistrationConfigurat...
method RegisterSingleton (line 84) | IStashboxContainer RegisterSingleton<TFrom, TTo>(object? name = null)
method RegisterSingleton (line 94) | IStashboxContainer RegisterSingleton<TTo>(object? name = null)
method RegisterSingleton (line 104) | IStashboxContainer RegisterSingleton(Type typeFrom, Type typeTo, objec...
method RegisterScoped (line 113) | IStashboxContainer RegisterScoped<TFrom, TTo>(object? name = null)
method RegisterScoped (line 124) | IStashboxContainer RegisterScoped(Type typeFrom, Type typeTo, object? ...
method RegisterScoped (line 132) | IStashboxContainer RegisterScoped<TTo>(object? name = null)
method RegisterInstance (line 144) | IStashboxContainer RegisterInstance<TInstance>(TInstance instance, obj...
method RegisterInstance (line 155) | IStashboxContainer RegisterInstance(object instance, Type serviceType,...
method WireUp (line 166) | IStashboxContainer WireUp<TInstance>(TInstance instance, object? name ...
method WireUp (line 177) | IStashboxContainer WireUp(object instance, Type serviceType, object? n...
FILE: src/IFuncRegistrator.cs
type IFuncRegistrator (line 8) | public interface IFuncRegistrator
method RegisterFunc (line 17) | IStashboxContainer RegisterFunc<TService>(Func<IDependencyResolver, TS...
method RegisterFunc (line 27) | IStashboxContainer RegisterFunc<T1, TService>(Func<T1, IDependencyReso...
method RegisterFunc (line 38) | IStashboxContainer RegisterFunc<T1, T2, TService>(Func<T1, T2, IDepend...
method RegisterFunc (line 50) | IStashboxContainer RegisterFunc<T1, T2, T3, TService>(Func<T1, T2, T3,...
method RegisterFunc (line 63) | IStashboxContainer RegisterFunc<T1, T2, T3, T4, TService>(Func<T1, T2,...
FILE: src/IResolutionScope.cs
type IResolutionScope (line 12) | public interface IResolutionScope : IDependencyResolver
method AddDisposableTracking (line 29) | object AddDisposableTracking(object disposable);
method AddRequestContextAwareDisposableTracking (line 37) | object AddRequestContextAwareDisposableTracking(object disposable, IRe...
method AddWithFinalizer (line 45) | object AddWithFinalizer(object finalizable, Action<object> finalizer);
method AddWithAsyncInitializer (line 53) | object AddWithAsyncInitializer(object initializable, Func<object, IDep...
method GetOrAddScopedObject (line 63) | object GetOrAddScopedObject(int key, Func<IResolutionScope, IRequestCo...
method InvalidateDelegateCache (line 69) | void InvalidateDelegateCache();
method GetActiveScopeNames (line 75) | IEnumerable<object> GetActiveScopeNames();
FILE: src/IStashboxContainer.cs
type IStashboxContainer (line 12) | public interface IStashboxContainer : IDependencyRegistrator, IDependenc...
method RegisterResolver (line 29) | IStashboxContainer RegisterResolver(IResolver resolver);
method CreateChildContainer (line 36) | IStashboxContainer CreateChildContainer(Action<ContainerConfigurator>?...
method CreateChildContainer (line 44) | IStashboxContainer CreateChildContainer(object identifier, Action<ISta...
method GetChildContainer (line 51) | IStashboxContainer? GetChildContainer(object identifier);
method IsRegistered (line 59) | bool IsRegistered<TFrom>(object? name = null);
method IsRegistered (line 67) | bool IsRegistered(Type typeFrom, object? name = null);
method Configure (line 74) | IStashboxContainer Configure(Action<ContainerConfigurator> config);
method Validate (line 79) | void Validate();
method GetRegistrationMappings (line 85) | IEnumerable<KeyValuePair<Type, ServiceRegistration>> GetRegistrationMa...
method GetRegistrationDiagnostics (line 91) | IEnumerable<RegistrationDiagnosticsInfo> GetRegistrationDiagnostics();
FILE: src/Lifetime/AutoLifetime.cs
class AutoLifetime (line 7) | internal class AutoLifetime(LifetimeDescriptor boundaryLifetime) : Lifet...
method BuildLifetimeAppliedExpression (line 13) | private protected override Expression? BuildLifetimeAppliedExpression(...
method ApplyLifetimeToExpression (line 31) | internal override Expression? ApplyLifetimeToExpression(Expression? ex...
FILE: src/Lifetime/EmptyLifetime.cs
class EmptyLifetime (line 7) | internal class EmptyLifetime : LifetimeDescriptor
method BuildLifetimeAppliedExpression (line 9) | private protected override Expression? BuildLifetimeAppliedExpression(...
method ApplyLifetimeToExpression (line 13) | internal override Expression? ApplyLifetimeToExpression(Expression? ex...
FILE: src/Lifetime/ExpressionLifetimeDescriptor.cs
class ExpressionLifetimeDescriptor (line 11) | public abstract class ExpressionLifetimeDescriptor : LifetimeDescriptor
method BuildLifetimeAppliedExpression (line 13) | private protected override Expression? BuildLifetimeAppliedExpression(...
method ApplyLifetimeToExpression (line 20) | internal override Expression? ApplyLifetimeToExpression(Expression? ex...
method ApplyLifetime (line 34) | protected abstract Expression ApplyLifetime(Expression expression, Ser...
FILE: src/Lifetime/FactoryLifetimeDescriptor.cs
class FactoryLifetimeDescriptor (line 11) | public abstract class FactoryLifetimeDescriptor : LifetimeDescriptor
method BuildLifetimeAppliedExpression (line 13) | private protected override Expression? BuildLifetimeAppliedExpression(...
method ApplyLifetimeToExpression (line 20) | internal override Expression? ApplyLifetimeToExpression(Expression? ex...
method GetFactoryDelegateForRegistration (line 27) | private static Func<IResolutionScope, IRequestContext, object>? GetFac...
method GetNewFactoryDelegate (line 45) | private static Func<IResolutionScope, IRequestContext, object>? GetNew...
method ApplyLifetime (line 58) | protected abstract Expression ApplyLifetime(Func<IResolutionScope, IRe...
FILE: src/Lifetime/LifetimeDescriptor.cs
class LifetimeDescriptor (line 13) | public abstract class LifetimeDescriptor
method LifetimeDescriptor (line 29) | protected LifetimeDescriptor()
method ApplyLifetime (line 34) | internal Expression? ApplyLifetime(ServiceRegistration serviceRegistra...
method BuildLifetimeAppliedExpression (line 58) | private protected abstract Expression? BuildLifetimeAppliedExpression(...
method ApplyLifetimeToExpression (line 61) | internal abstract Expression? ApplyLifetimeToExpression(Expression? ex...
method GetExpressionForRegistration (line 64) | private protected static Expression? GetExpressionForRegistration(Serv...
method IsRegistrationOutputCacheable (line 82) | private protected static bool IsRegistrationOutputCacheable(ServiceReg...
FILE: src/Lifetime/Lifetimes.cs
class Lifetimes (line 6) | public static class Lifetimes
method NamedScope (line 33) | public static LifetimeDescriptor NamedScope(object name) => new NamedS...
method Auto (line 41) | public static LifetimeDescriptor Auto(LifetimeDescriptor boundaryLifet...
FILE: src/Lifetime/NamedScopeLifetime.cs
class NamedScopeLifetime (line 14) | public class NamedScopeLifetime : FactoryLifetimeDescriptor
method NamedScopeLifetime (line 32) | public NamedScopeLifetime(object scopeName)
method ApplyLifetime (line 38) | protected override Expression ApplyLifetime(Func<IResolutionScope, IRe...
method GetScopedValue (line 51) | private static object GetScopedValue(IResolutionScope currentScope, IR...
FILE: src/Lifetime/PerRequestLifetime.cs
class PerRequestLifetime (line 12) | public class PerRequestLifetime : FactoryLifetimeDescriptor
method ApplyLifetime (line 15) | protected override Expression ApplyLifetime(Func<IResolutionScope, IRe...
FILE: src/Lifetime/ScopedLifetime.cs
class ScopedLifetime (line 13) | public class ScopedLifetime : FactoryLifetimeDescriptor
method ApplyLifetime (line 19) | protected override Expression ApplyLifetime(Func<IResolutionScope, IRe...
FILE: src/Lifetime/SingletonLifetime.cs
class SingletonLifetime (line 12) | public class SingletonLifetime : FactoryLifetimeDescriptor
method ApplyLifetime (line 18) | protected override Expression ApplyLifetime(Func<IResolutionScope, IRe...
FILE: src/Lifetime/TransientLifetime.cs
class TransientLifetime (line 11) | public class TransientLifetime : ExpressionLifetimeDescriptor
method ApplyLifetime (line 14) | protected override Expression ApplyLifetime(Expression expression,
FILE: src/Metadata.cs
class Metadata (line 8) | public sealed class Metadata<TService, TMeta>
method Metadata (line 25) | public Metadata(TService service, TMeta data)
FILE: src/Multitenant/ITenantDistributor.cs
type ITenantDistributor (line 8) | [Obsolete("The functionality of this interface was moved to IStashboxCon...
method ConfigureTenant (line 17) | void ConfigureTenant(object tenantId, Action<IStashboxContainer> tenan...
method GetTenant (line 25) | IDependencyResolver? GetTenant(object tenantId);
FILE: src/Multitenant/TenantDistributor.cs
class TenantDistributor (line 15) | [Obsolete("The functionality of this class was moved to StashboxContaine...
method TenantDistributor (line 24) | public TenantDistributor(IStashboxContainer? rootContainer = null)
method ConfigureTenant (line 30) | public void ConfigureTenant(object tenantId, Action<IStashboxContainer...
method GetTenant (line 34) | public IDependencyResolver? GetTenant(object tenantId) => rootContaine...
method RegisterResolver (line 38) | public IStashboxContainer RegisterResolver(IResolver resolver) => root...
method CreateChildContainer (line 40) | public IStashboxContainer CreateChildContainer(Action<ContainerConfigu...
method CreateChildContainer (line 42) | public IStashboxContainer CreateChildContainer(object identifier, Acti...
method GetChildContainer (line 46) | public IStashboxContainer? GetChildContainer(object identifier) => roo...
method IsRegistered (line 50) | public bool IsRegistered<TFrom>(object? name = null) => rootContainer....
method IsRegistered (line 52) | public bool IsRegistered(Type typeFrom, object? name = null) => rootCo...
method Configure (line 54) | public IStashboxContainer Configure(Action<ContainerConfigurator> conf...
method Validate (line 56) | public void Validate() => rootContainer.Validate();
method GetRegistrationMappings (line 58) | public IEnumerable<KeyValuePair<Type, ServiceRegistration>> GetRegistr...
method GetRegistrationDiagnostics (line 60) | public IEnumerable<RegistrationDiagnosticsInfo> GetRegistrationDiagnos...
method Dispose (line 62) | public void Dispose()
method DisposeAsync (line 71) | public ValueTask DisposeAsync() => Interlocked.CompareExchange(ref thi...
method Register (line 74) | public IStashboxContainer Register<TFrom, TTo>(Action<RegistrationConf...
method Register (line 76) | public IStashboxContainer Register<TFrom, TTo>(object? name = null) wh...
method Register (line 78) | public IStashboxContainer Register<TFrom>(Type typeTo, Action<Registra...
method Register (line 80) | public IStashboxContainer Register(Type typeFrom, Type typeTo, Action<...
method Register (line 82) | public IStashboxContainer Register<TTo>(Action<RegistrationConfigurato...
method Register (line 84) | public IStashboxContainer Register<TTo>(object? name = null) where TTo...
method Register (line 86) | public IStashboxContainer Register(Type typeTo, Action<RegistrationCon...
method RegisterSingleton (line 88) | public IStashboxContainer RegisterSingleton<TFrom, TTo>(object? name =...
method RegisterSingleton (line 90) | public IStashboxContainer RegisterSingleton<TTo>(object? name = null) ...
method RegisterSingleton (line 92) | public IStashboxContainer RegisterSingleton(Type typeFrom, Type typeTo...
method RegisterScoped (line 94) | public IStashboxContainer RegisterScoped<TFrom, TTo>(object? name = nu...
method RegisterScoped (line 96) | public IStashboxContainer RegisterScoped(Type typeFrom, Type typeTo, o...
method RegisterScoped (line 98) | public IStashboxContainer RegisterScoped<TTo>(object? name = null) whe...
method RegisterInstance (line 100) | public IStashboxContainer RegisterInstance<TInstance>(TInstance instan...
method RegisterInstance (line 104) | public IStashboxContainer RegisterInstance(object instance, Type servi...
method WireUp (line 108) | public IStashboxContainer WireUp<TInstance>(TInstance instance, object...
method WireUp (line 112) | public IStashboxContainer WireUp(object instance, Type serviceType, ob...
method GetService (line 114) | public object? GetService(Type serviceType) => rootContainer.GetServic...
method Resolve (line 116) | public object Resolve(Type typeFrom) => rootContainer.Resolve(typeFrom);
method Resolve (line 118) | public object Resolve(Type typeFrom, object? name, object[]? dependenc...
method ResolveOrDefault (line 120) | public object? ResolveOrDefault(Type typeFrom) => rootContainer.Resolv...
method ResolveOrDefault (line 122) | public object? ResolveOrDefault(Type typeFrom, object? name, object[]?...
method ResolveFactory (line 124) | public Delegate ResolveFactory(Type typeFrom, object? name = null, Res...
method ResolveFactoryOrDefault (line 126) | public Delegate? ResolveFactoryOrDefault(Type typeFrom, object? name =...
method BeginScope (line 128) | public IDependencyResolver BeginScope(object? name = null, bool attach...
method PutInstanceInScope (line 130) | public void PutInstanceInScope(Type typeFrom, object instance, bool wi...
method BuildUp (line 132) | public TTo BuildUp<TTo>(TTo instance, ResolutionBehavior resolutionBeh...
method Activate (line 134) | public object Activate(Type type, ResolutionBehavior resolutionBehavio...
method InvokeAsyncInitializers (line 136) | public ValueTask InvokeAsyncInitializers(CancellationToken token = def...
method CanResolve (line 138) | public bool CanResolve(Type typeFrom, object? name = null, ResolutionB...
method GetDelegateCacheEntries (line 140) | public IEnumerable<DelegateCacheEntry> GetDelegateCacheEntries() => ro...
method ReMap (line 142) | public IStashboxContainer ReMap<TFrom, TTo>(Action<RegistrationConfigu...
method ReMap (line 144) | public IStashboxContainer ReMap<TFrom>(Type typeTo, Action<Registratio...
method ReMap (line 146) | public IStashboxContainer ReMap(Type typeFrom, Type typeTo, Action<Reg...
method ReMap (line 148) | public IStashboxContainer ReMap<TTo>(Action<RegistrationConfigurator<T...
method ReMapDecorator (line 150) | public IStashboxContainer ReMapDecorator(Type typeFrom, Type typeTo, A...
method ReMapDecorator (line 152) | public IStashboxContainer ReMapDecorator<TFrom, TTo>(Action<DecoratorC...
method ReMapDecorator (line 154) | public IStashboxContainer ReMapDecorator<TFrom>(Type typeTo, Action<De...
method RegisterTypesAs (line 156) | public IStashboxContainer RegisterTypesAs(Type typeFrom, IEnumerable<T...
method RegisterTypes (line 160) | public IStashboxContainer RegisterTypes(IEnumerable<Type> types, Func<...
method ComposeBy (line 164) | public IStashboxContainer ComposeBy(Type compositionRootType, params o...
method ComposeBy (line 166) | public IStashboxContainer ComposeBy(ICompositionRoot compositionRoot) ...
method RegisterDecorator (line 168) | public IStashboxContainer RegisterDecorator(Type typeFrom, Type typeTo...
method RegisterDecorator (line 170) | public IStashboxContainer RegisterDecorator<TFrom, TTo>(Action<Decorat...
method RegisterDecorator (line 172) | public IStashboxContainer RegisterDecorator(Type typeTo, Action<Decora...
method RegisterDecorator (line 174) | public IStashboxContainer RegisterDecorator<TTo>(Action<DecoratorConfi...
method RegisterDecorator (line 176) | public IStashboxContainer RegisterDecorator<TFrom>(Type typeTo, Action...
method RegisterFunc (line 178) | public IStashboxContainer RegisterFunc<TService>(Func<IDependencyResol...
method RegisterFunc (line 180) | public IStashboxContainer RegisterFunc<T1, TService>(Func<T1, IDepende...
method RegisterFunc (line 182) | public IStashboxContainer RegisterFunc<T1, T2, TService>(Func<T1, T2, ...
method RegisterFunc (line 184) | public IStashboxContainer RegisterFunc<T1, T2, T3, TService>(Func<T1, ...
method RegisterFunc (line 186) | public IStashboxContainer RegisterFunc<T1, T2, T3, T4, TService>(Func<...
FILE: src/Override.cs
class Override (line 9) | public class Override
method Override (line 11) | private Override(object instance, object? dependencyName, Type type)
method Of (line 39) | public static Override Of<TType>(TType instance, object? name = null) ...
method Of (line 48) | public static Override Of(Type type, object instance, object? name = n...
FILE: src/ReadOnlyKeyValue.cs
type ReadOnlyKeyValue (line 10) | [DebuggerDisplay("{Value}", Name = "{Key}")]
method ReadOnlyKeyValue (line 28) | public ReadOnlyKeyValue(TKey key, TValue value)
FILE: src/Registration/DecoratorRepository.cs
class DecoratorRepository (line 13) | internal class DecoratorRepository(ContainerConfiguration containerConfi...
method AddDecorator (line 25) | public void AddDecorator(Type type, ServiceRegistration serviceRegistr...
method GetDecoratorsOrDefault (line 40) | public IEnumerable<ServiceRegistration>? GetDecoratorsOrDefault(Type i...
method GetRegistrationMappings (line 43) | public IEnumerable<KeyValuePair<Type, ServiceRegistration>> GetRegistr...
method GetRegistrationsForType (line 46) | private IEnumerable<ServiceRegistration>? GetRegistrationsForType(Type...
FILE: src/Registration/Extensions/CollectionRegistratorExtensions.cs
class CollectionRegistratorExtensions (line 14) | public static class CollectionRegistratorExtensions
method RegisterTypesAs (line 25) | public static IStashboxContainer RegisterTypesAs<TFrom>(this IDependen...
method RegisterTypesAs (line 44) | public static IStashboxContainer RegisterTypesAs<TFrom>(this IDependen...
method RegisterTypesAs (line 63) | public static IStashboxContainer RegisterTypesAs(this IDependencyColle...
method RegisterAssembly (line 83) | public static IStashboxContainer RegisterAssembly(this IDependencyColl...
method RegisterAssemblies (line 105) | public static IStashboxContainer RegisterAssemblies(this IDependencyCo...
method RegisterAssemblyContaining (line 134) | public static IStashboxContainer RegisterAssemblyContaining<TFrom>(thi...
method RegisterAssemblyContaining (line 156) | public static IStashboxContainer RegisterAssemblyContaining(this IDepe...
method ComposeAssemblies (line 175) | public static IStashboxContainer ComposeAssemblies(this IDependencyCol...
method ComposeBy (line 194) | public static IStashboxContainer ComposeBy<TCompositionRoot>(this IDep...
method ComposeAssembly (line 206) | public static IStashboxContainer ComposeAssembly(this IDependencyColle...
FILE: src/Registration/Extensions/DependencyRegistratorExtensions.cs
class DependencyRegistratorExtensions (line 8) | public static class DependencyRegistratorExtensions
method RegisterInstances (line 17) | public static IStashboxContainer RegisterInstances<TFrom>(this IDepend...
method RegisterInstances (line 33) | public static IStashboxContainer RegisterInstances<TFrom>(this IDepend...
FILE: src/Registration/Extensions/DependencyRemapperExtensions.cs
class DependencyReMapperExtensions (line 9) | public static class DependencyReMapperExtensions
method ReMap (line 18) | public static IStashboxContainer ReMap(this IDependencyReMapper reMapp...
FILE: src/Registration/Extensions/ServiceRepositoryExtensions.cs
class ServiceRepositoryExtensions (line 11) | internal static class ServiceRepositoryExtensions
method ContainsRegistration (line 13) | public static bool ContainsRegistration(this ImmutableTree<Type, Immut...
method SelectOrDefault (line 25) | public static ServiceRegistration? SelectOrDefault(this IEnumerable<Se...
method FilterExclusiveOrDefault (line 46) | public static IEnumerable<ServiceRegistration>? FilterExclusiveOrDefau...
method FilterInclusive (line 73) | public static IEnumerable<ServiceRegistration> FilterInclusive(this IE...
method IsSelectionPassed (line 79) | private static bool IsSelectionPassed(this IRegistrationSelectionRule[...
FILE: src/Registration/Fluent/BaseDecoratorConfigurator.cs
class BaseDecoratorConfigurator (line 12) | public class BaseDecoratorConfigurator<TConfigurator> : BaseFluentConfig...
method BaseDecoratorConfigurator (line 15) | internal BaseDecoratorConfigurator(Type serviceType, Type implementati...
method WhenDecoratedServiceIs (line 24) | public TConfigurator WhenDecoratedServiceIs<TTarget>() where TTarget :...
method WhenDecoratedServiceIs (line 31) | public TConfigurator WhenDecoratedServiceIs(Type targetType) => this.W...
method WhenDecoratedServiceIs (line 38) | public TConfigurator WhenDecoratedServiceIs(object name) => this.When(...
method WhenDecoratedServiceHas (line 45) | public TConfigurator WhenDecoratedServiceHas<TAttribute>() where TAttr...
method WhenDecoratedServiceHas (line 52) | public TConfigurator WhenDecoratedServiceHas(Type attributeType) =>
FILE: src/Registration/Fluent/BaseFluentConfigurator.cs
class BaseFluentConfigurator (line 18) | public class BaseFluentConfigurator<TConfigurator> : ServiceRegistration
method BaseFluentConfigurator (line 26) | internal BaseFluentConfigurator(Type serviceType, Type implementationT...
method HasServiceType (line 38) | public bool HasServiceType<TService>() => this.HasServiceType(TypeCach...
method HasServiceType (line 45) | public bool HasServiceType(Type serviceType)
method WithLifetime (line 65) | public TConfigurator WithLifetime(LifetimeDescriptor lifetime)
method WithScopedLifetime (line 75) | public TConfigurator WithScopedLifetime() => this.WithLifetime(Lifetim...
method WithSingletonLifetime (line 81) | public TConfigurator WithSingletonLifetime() => this.WithLifetime(Life...
method WithTransientLifetime (line 87) | public TConfigurator WithTransientLifetime() => this.WithLifetime(Life...
method WithPerRequestLifetime (line 94) | public TConfigurator WithPerRequestLifetime() => this.WithLifetime(Lif...
method WithAutoLifetime (line 102) | public TConfigurator WithAutoLifetime(LifetimeDescriptor boundaryLifet...
method InNamedScope (line 109) | public TConfigurator InNamedScope(object scopeName) => this.WithLifeti...
method InScopeDefinedBy (line 116) | public TConfigurator InScopeDefinedBy(Type type) => this.WithLifetime(...
method InScopeDefinedBy (line 122) | public TConfigurator InScopeDefinedBy<TScopeDefiner>() => this.WithLif...
method WithDependencyBinding (line 129) | public TConfigurator WithDependencyBinding<TDependency>(object? depend...
method WithDependencyBinding (line 138) | public TConfigurator WithDependencyBinding(Type dependencyType, object...
method WithDependencyBinding (line 157) | public TConfigurator WithDependencyBinding(string parameterName, objec...
method WhenDependantIs (line 176) | public TConfigurator WhenDependantIs<TTarget>(object? name = null) whe...
method WhenDependantIs (line 184) | public TConfigurator WhenDependantIs(Type targetType, object? name = n...
method WhenInResolutionPathOf (line 208) | public TConfigurator WhenInResolutionPathOf<TTarget>(object? name = nu...
method WhenInResolutionPathOf (line 217) | public TConfigurator WhenInResolutionPathOf(Type targetType, object? n...
method WhenHas (line 239) | public TConfigurator WhenHas<TAttribute>(object? name = null) where TA...
method WhenHas (line 246) | public TConfigurator WhenHas(Type attributeType)
method WhenResolutionPathHas (line 269) | public TConfigurator WhenResolutionPathHas<TAttribute>(object? name = ...
method WhenResolutionPathHas (line 278) | public TConfigurator WhenResolutionPathHas(Type attributeType, object?...
method When (line 300) | public TConfigurator When(Func<TypeInformation, bool> resolutionCondit...
method WithInjectionParameters (line 321) | public TConfigurator WithInjectionParameters(params KeyValuePair<strin...
method WithInjectionParameter (line 338) | public TConfigurator WithInjectionParameter(string name, object? value)
method WithAutoMemberInjection (line 357) | public TConfigurator WithAutoMemberInjection(Rules.AutoMemberInjection...
method WithRequiredMemberInjection (line 370) | public TConfigurator WithRequiredMemberInjection(bool enabled = true)
method WithConstructorSelectionRule (line 383) | public TConfigurator WithConstructorSelectionRule(Func<IEnumerable<Con...
method WithConstructorByArgumentTypes (line 397) | public TConfigurator WithConstructorByArgumentTypes(params Type[] argu...
method WithConstructorByArguments (line 418) | public TConfigurator WithConstructorByArguments(params object[] argume...
method WithoutDisposalTracking (line 438) | public TConfigurator WithoutDisposalTracking()
method ReplaceExisting (line 450) | public TConfigurator ReplaceExisting()
method ReplaceOnlyIfExists (line 462) | public TConfigurator ReplaceOnlyIfExists()
method AsImplementedTypes (line 474) | public TConfigurator AsImplementedTypes()
method AsServiceAlso (line 491) | public TConfigurator AsServiceAlso<TAdditionalService>() =>
method AsServiceAlso (line 499) | public TConfigurator AsServiceAlso(Type serviceType)
method ValidateTypeMap (line 513) | internal void ValidateTypeMap()
method ValidateImplementationIsResolvable (line 521) | internal void ValidateImplementationIsResolvable()
method SetFactory (line 529) | private protected TConfigurator SetFactory(Delegate factory, Type impl...
method SetFactory (line 537) | private protected TConfigurator SetFactory(Delegate factory, bool isCo...
method ThrowConstructorNotFoundException (line 547) | private static void ThrowConstructorNotFoundException(Type type, param...
FILE: src/Registration/Fluent/DecoratorConfigurator.cs
class DecoratorConfigurator (line 13) | public class DecoratorConfigurator<TService, TImplementation> : BaseDeco...
method DecoratorConfigurator (line 17) | internal DecoratorConfigurator(Type serviceType, Type implementationTy...
method WithDependencyBinding (line 27) | public DecoratorConfigurator<TService, TImplementation> WithDependency...
method WithFinalizer (line 47) | public DecoratorConfigurator<TService, TImplementation> WithFinalizer(...
method WithInitializer (line 62) | public DecoratorConfigurator<TService, TImplementation> WithInitialize...
method WithAsyncInitializer (line 77) | public DecoratorConfigurator<TService, TImplementation> WithAsyncIniti...
method WithFactory (line 93) | public DecoratorConfigurator<TService, TImplementation> WithFactory(Fu...
method WithFactory (line 102) | public DecoratorConfigurator<TService, TImplementation> WithFactory(Fu...
method WithFactory (line 111) | public DecoratorConfigurator<TService, TImplementation> WithFactory<T1...
method WithFactory (line 120) | public DecoratorConfigurator<TService, TImplementation> WithFactory<T1...
method WithFactory (line 129) | public DecoratorConfigurator<TService, TImplementation> WithFactory<T1...
method WithFactory (line 138) | public DecoratorConfigurator<TService, TImplementation> WithFactory<T1...
method WithFactory (line 147) | public DecoratorConfigurator<TService, TImplementation> WithFactory<T1...
method DecoratorConfigurator (line 156) | internal DecoratorConfigurator(Type serviceType, Type implementationTy...
method WithFactory (line 166) | public DecoratorConfigurator WithFactory(Func<IDependencyResolver, obj...
method WithFactory (line 175) | public DecoratorConfigurator WithFactory(Func<object> factory, bool is...
method WithFactory (line 184) | public DecoratorConfigurator WithFactory<T1>(Func<T1, object> factory,...
method WithFactory (line 193) | public DecoratorConfigurator WithFactory<T1, T2>(Func<T1, T2, object> ...
method WithFactory (line 202) | public DecoratorConfigurator WithFactory<T1, T2, T3>(Func<T1, T2, T3, ...
method WithFactory (line 211) | public DecoratorConfigurator WithFactory<T1, T2, T3, T4>(Func<T1, T2, ...
method WithFactory (line 220) | public DecoratorConfigurator WithFactory<T1, T2, T3, T4, T5>(Func<T1, ...
class DecoratorConfigurator (line 154) | public class DecoratorConfigurator : BaseDecoratorConfigurator<Decorator...
method DecoratorConfigurator (line 17) | internal DecoratorConfigurator(Type serviceType, Type implementationTy...
method WithDependencyBinding (line 27) | public DecoratorConfigurator<TService, TImplementation> WithDependency...
method WithFinalizer (line 47) | public DecoratorConfigurator<TService, TImplementation> WithFinalizer(...
method WithInitializer (line 62) | public DecoratorConfigurator<TService, TImplementation> WithInitialize...
method WithAsyncInitializer (line 77) | public DecoratorConfigurator<TService, TImplementation> WithAsyncIniti...
method WithFactory (line 93) | public DecoratorConfigurator<TService, TImplementation> WithFactory(Fu...
method WithFactory (line 102) | public DecoratorConfigurator<TService, TImplementation> WithFactory(Fu...
method WithFactory (line 111) | public DecoratorConfigurator<TService, TImplementation> WithFactory<T1...
method WithFactory (line 120) | public DecoratorConfigurator<TService, TImplementation> WithFactory<T1...
method WithFactory (line 129) | public DecoratorConfigurator<TService, TImplementation> WithFactory<T1...
method WithFactory (line 138) | public DecoratorConfigurator<TService, TImplementation> WithFactory<T1...
method WithFactory (line 147) | public DecoratorConfigurator<TService, TImplementation> WithFactory<T1...
method DecoratorConfigurator (line 156) | internal DecoratorConfigurator(Type serviceType, Type implementationTy...
method WithFactory (line 166) | public DecoratorConfigurator WithFactory(Func<IDependencyResolver, obj...
method WithFactory (line 175) | public DecoratorConfigurator WithFactory(Func<object> factory, bool is...
method WithFactory (line 184) | public DecoratorConfigurator WithFactory<T1>(Func<T1, object> factory,...
method WithFactory (line 193) | public DecoratorConfigurator WithFactory<T1, T2>(Func<T1, T2, object> ...
method WithFactory (line 202) | public DecoratorConfigurator WithFactory<T1, T2, T3>(Func<T1, T2, T3, ...
method WithFactory (line 211) | public DecoratorConfigurator WithFactory<T1, T2, T3, T4>(Func<T1, T2, ...
method WithFactory (line 220) | public DecoratorConfigurator WithFactory<T1, T2, T3, T4, T5>(Func<T1, ...
FILE: src/Registration/Fluent/FluentServiceConfigurator.cs
class FluentServiceConfigurator (line 15) | public class FluentServiceConfigurator<TService, TImplementation, TConfi...
method FluentServiceConfigurator (line 20) | internal FluentServiceConfigurator(Type serviceType, Type implementati...
method WithDependencyBinding (line 31) | public TConfigurator WithDependencyBinding<TResult>(Expression<Func<TI...
method WithFinalizer (line 52) | public TConfigurator WithFinalizer(Action<TImplementation> finalizer)
method WithInitializer (line 67) | public TConfigurator WithInitializer(Action<TImplementation, IDependen...
method WithAsyncInitializer (line 82) | public TConfigurator WithAsyncInitializer(Func<TImplementation, IDepen...
method WithFactory (line 98) | public TConfigurator WithFactory(Func<TImplementation> factory, bool i...
method WithFactory (line 110) | public TConfigurator WithFactory<TImpl>(Func<TImpl> factory, bool isCo...
method WithFactory (line 122) | public TConfigurator WithFactory(Func<IDependencyResolver, TImplementa...
method WithFactory (line 134) | public TConfigurator WithFactory<TImpl>(Func<IDependencyResolver, TImp...
method WithFactory (line 146) | public TConfigurator WithFactory<T1>(Func<T1, TImplementation> factory...
method WithFactory (line 158) | public TConfigurator WithFactory<T1, TImpl>(Func<T1, TImpl> factory, b...
method WithFactory (line 170) | public TConfigurator WithFactory<T1, T2>(Func<T1, T2, TImplementation>...
method WithFactory (line 182) | public TConfigurator WithFactory<T1, T2, T3>(Func<T1, T2, T3, TImpleme...
method WithFactory (line 194) | public TConfigurator WithFactory<T1, T2, T3, T4>(Func<T1, T2, T3, T4, ...
method WithFactory (line 206) | public TConfigurator WithFactory<T1, T2, T3, T4, T5>(Func<T1, T2, T3, ...
method FluentServiceConfigurator (line 219) | internal FluentServiceConfigurator(Type serviceType, Type implementati...
method WithDynamicResolution (line 228) | public TConfigurator WithDynamicResolution()
method WithMetadata (line 241) | public TConfigurator WithMetadata(object? metadata)
method WithName (line 254) | public TConfigurator WithName(object? name)
method DefinesScope (line 266) | public TConfigurator DefinesScope(object? scopeName = null)
method WithFactory (line 280) | public TConfigurator WithFactory(Func<IDependencyResolver, object> fac...
method WithFactory (line 289) | public TConfigurator WithFactory(Func<object> factory, bool isCompiled...
method WithFactory (line 298) | public TConfigurator WithFactory<T1>(Func<T1, object> factory, bool is...
method WithFactory (line 307) | public TConfigurator WithFactory<T1, T2>(Func<T1, T2, object> factory,...
method WithFactory (line 316) | public TConfigurator WithFactory<T1, T2, T3>(Func<T1, T2, T3, object> ...
method WithFactory (line 325) | public TConfigurator WithFactory<T1, T2, T3, T4>(Func<T1, T2, T3, T4, ...
method WithFactory (line 334) | public TConfigurator WithFactory<T1, T2, T3, T4, T5>(Func<T1, T2, T3, ...
class FluentServiceConfigurator (line 216) | public class FluentServiceConfigurator<TConfigurator> : BaseFluentConfig...
method FluentServiceConfigurator (line 20) | internal FluentServiceConfigurator(Type serviceType, Type implementati...
method WithDependencyBinding (line 31) | public TConfigurator WithDependencyBinding<TResult>(Expression<Func<TI...
method WithFinalizer (line 52) | public TConfigurator WithFinalizer(Action<TImplementation> finalizer)
method WithInitializer (line 67) | public TConfigurator WithInitializer(Action<TImplementation, IDependen...
method WithAsyncInitializer (line 82) | public TConfigurator WithAsyncInitializer(Func<TImplementation, IDepen...
method WithFactory (line 98) | public TConfigurator WithFactory(Func<TImplementation> factory, bool i...
method WithFactory (line 110) | public TConfigurator WithFactory<TImpl>(Func<TImpl> factory, bool isCo...
method WithFactory (line 122) | public TConfigurator WithFactory(Func<IDependencyResolver, TImplementa...
method WithFactory (line 134) | public TConfigurator WithFactory<TImpl>(Func<IDependencyResolver, TImp...
method WithFactory (line 146) | public TConfigurator WithFactory<T1>(Func<T1, TImplementation> factory...
method WithFactory (line 158) | public TConfigurator WithFactory<T1, TImpl>(Func<T1, TImpl> factory, b...
method WithFactory (line 170) | public TConfigurator WithFactory<T1, T2>(Func<T1, T2, TImplementation>...
method WithFactory (line 182) | public TConfigurator WithFactory<T1, T2, T3>(Func<T1, T2, T3, TImpleme...
method WithFactory (line 194) | public TConfigurator WithFactory<T1, T2, T3, T4>(Func<T1, T2, T3, T4, ...
method WithFactory (line 206) | public TConfigurator WithFactory<T1, T2, T3, T4, T5>(Func<T1, T2, T3, ...
method FluentServiceConfigurator (line 219) | internal FluentServiceConfigurator(Type serviceType, Type implementati...
method WithDynamicResolution (line 228) | public TConfigurator WithDynamicResolution()
method WithMetadata (line 241) | public TConfigurator WithMetadata(object? metadata)
method WithName (line 254) | public TConfigurator WithName(object? name)
method DefinesScope (line 266) | public TConfigurator DefinesScope(object? scopeName = null)
method WithFactory (line 280) | public TConfigurator WithFactory(Func<IDependencyResolver, object> fac...
method WithFactory (line 289) | public TConfigurator WithFactory(Func<object> factory, bool isCompiled...
method WithFactory (line 298) | public TConfigurator WithFactory<T1>(Func<T1, object> factory, bool is...
method WithFactory (line 307) | public TConfigurator WithFactory<T1, T2>(Func<T1, T2, object> factory,...
method WithFactory (line 316) | public TConfigurator WithFactory<T1, T2, T3>(Func<T1, T2, T3, object> ...
method WithFactory (line 325) | public TConfigurator WithFactory<T1, T2, T3, T4>(Func<T1, T2, T3, T4, ...
method WithFactory (line 334) | public TConfigurator WithFactory<T1, T2, T3, T4, T5>(Func<T1, T2, T3, ...
FILE: src/Registration/Fluent/RegistrationConfigurator.cs
class RegistrationConfigurator (line 11) | public class RegistrationConfigurator<TService, TImplementation> :
method RegistrationConfigurator (line 16) | internal RegistrationConfigurator(Type serviceType, Type implementatio...
method WithInstance (line 27) | public RegistrationConfigurator<TService, TImplementation> WithInstanc...
method RegistrationConfigurator (line 44) | internal RegistrationConfigurator(Type serviceType, Type implementatio...
method WithInstance (line 55) | public RegistrationConfigurator WithInstance(object instance, bool wir...
class RegistrationConfigurator (line 42) | public class RegistrationConfigurator : FluentServiceConfigurator<Regist...
method RegistrationConfigurator (line 16) | internal RegistrationConfigurator(Type serviceType, Type implementatio...
method WithInstance (line 27) | public RegistrationConfigurator<TService, TImplementation> WithInstanc...
method RegistrationConfigurator (line 44) | internal RegistrationConfigurator(Type serviceType, Type implementatio...
method WithInstance (line 55) | public RegistrationConfigurator WithInstance(object instance, bool wir...
FILE: src/Registration/Fluent/UnknownRegistrationConfigurator.cs
class UnknownRegistrationConfigurator (line 9) | public class UnknownRegistrationConfigurator : RegistrationConfigurator
method UnknownRegistrationConfigurator (line 13) | internal UnknownRegistrationConfigurator(Type serviceType, Type implem...
method SetImplementationType (line 23) | public UnknownRegistrationConfigurator SetImplementationType(Type impl...
method Skip (line 37) | public UnknownRegistrationConfigurator Skip()
FILE: src/Registration/IDecoratorRepository.cs
type IDecoratorRepository (line 10) | public interface IDecoratorRepository
method AddDecorator (line 18) | void AddDecorator(Type type, ServiceRegistration serviceRegistration, ...
method GetDecoratorsOrDefault (line 27) | IEnumerable<ServiceRegistration>? GetDecoratorsOrDefault(Type implemen...
method GetRegistrationMappings (line 33) | IEnumerable<KeyValuePair<Type, ServiceRegistration>> GetRegistrationMa...
FILE: src/Registration/IRegistrationRepository.cs
type IRegistrationRepository (line 10) | public interface IRegistrationRepository
method AddOrUpdateRegistration (line 18) | bool AddOrUpdateRegistration(ServiceRegistration registration, Type se...
method AddOrReMapRegistration (line 26) | bool AddOrReMapRegistration(ServiceRegistration registration, Type ser...
method GetRegistrationOrDefault (line 34) | ServiceRegistration? GetRegistrationOrDefault(TypeInformation typeInfo...
method GetRegistrationsOrDefault (line 42) | IEnumerable<ServiceRegistration>? GetRegistrationsOrDefault(TypeInform...
method GetRegistrationMappings (line 48) | IEnumerable<KeyValuePair<Type, ServiceRegistration>> GetRegistrationMa...
method ContainsRegistration (line 57) | bool ContainsRegistration(Type type, object? name, bool includeOpenGen...
FILE: src/Registration/OpenGenericRegistration.cs
class OpenGenericRegistration (line 10) | public class OpenGenericRegistration : ServiceRegistration
method OpenGenericRegistration (line 14) | internal OpenGenericRegistration(ServiceRegistration serviceRegistration)
method ProduceClosedRegistration (line 19) | internal ServiceRegistration ProduceClosedRegistration(Type requestedT...
FILE: src/Registration/RegistrationDiagnosticsInfo.cs
type RegistrationDiagnosticsInfo (line 8) | public readonly struct RegistrationDiagnosticsInfo
method RegistrationDiagnosticsInfo (line 31) | public RegistrationDiagnosticsInfo(Type serviceType, Type implementati...
method ToString (line 42) | public override string ToString() => $"{this.ServiceType.GetDiagnostic...
FILE: src/Registration/RegistrationRepository.cs
class RegistrationRepository (line 14) | internal class RegistrationRepository(ContainerConfiguration containerCo...
method AddOrUpdateRegistration (line 44) | public bool AddOrUpdateRegistration(ServiceRegistration registration, ...
method AddOrReMapRegistration (line 111) | public bool AddOrReMapRegistration(ServiceRegistration registration, T...
method ContainsRegistration (line 124) | public bool ContainsRegistration(Type type, object? name, bool include...
method GetRegistrationMappings (line 127) | public IEnumerable<KeyValuePair<Type, ServiceRegistration>> GetRegistr...
method GetRegistrationOrDefault (line 130) | public ServiceRegistration? GetRegistrationOrDefault(TypeInformation t...
method GetRegistrationsOrDefault (line 134) | public IEnumerable<ServiceRegistration>? GetRegistrationsOrDefault(Typ...
method GetRegistrationsForType (line 139) | private IEnumerable<ServiceRegistration>? GetRegistrationsForType(Type...
FILE: src/Registration/SelectionRules/ConditionRule.cs
class ConditionRule (line 6) | internal class ConditionRule : IRegistrationSelectionRule
method IsValidForCurrentRequest (line 8) | public bool IsValidForCurrentRequest(TypeInformation typeInformation,
FILE: src/Registration/SelectionRules/DecoratorRule.cs
class DecoratorRule (line 5) | internal class DecoratorRule : IRegistrationSelectionRule
method IsValidForCurrentRequest (line 7) | public bool IsValidForCurrentRequest(TypeInformation typeInformation, ...
FILE: src/Registration/SelectionRules/EnumerableNameRule.cs
class EnumerableNameRule (line 5) | internal class EnumerableNameRule : IRegistrationSelectionRule
method IsValidForCurrentRequest (line 7) | public bool IsValidForCurrentRequest(TypeInformation typeInformation,
FILE: src/Registration/SelectionRules/IRegistrationSelectionRule.cs
type IRegistrationSelectionRule (line 5) | internal interface IRegistrationSelectionRule
method IsValidForCurrentRequest (line 7) | bool IsValidForCurrentRequest(TypeInformation typeInformation,
FILE: src/Registration/SelectionRules/MetadataRule.cs
class MetadataRule (line 6) | internal class MetadataRule : IRegistrationSelectionRule
method IsValidForCurrentRequest (line 8) | public bool IsValidForCurrentRequest(TypeInformation typeInformation,
FILE: src/Registration/SelectionRules/NameRule.cs
class NameRule (line 5) | internal class NameRule : IRegistrationSelectionRule
method IsValidForCurrentRequest (line 7) | public bool IsValidForCurrentRequest(TypeInformation typeInformation,
FILE: src/Registration/SelectionRules/OpenGenericRule.cs
class OpenGenericRule (line 6) | internal class OpenGenericRule : IRegistrationSelectionRule
method IsValidForCurrentRequest (line 8) | public bool IsValidForCurrentRequest(TypeInformation typeInformation,
FILE: src/Registration/SelectionRules/RegistrationSelectionRules.cs
class RegistrationSelectionRules (line 3) | internal static class RegistrationSelectionRules
FILE: src/Registration/SelectionRules/ScopeNameRule.cs
class ScopeNameRule (line 6) | internal class ScopeNameRule : IRegistrationSelectionRule
method IsValidForCurrentRequest (line 8) | public bool IsValidForCurrentRequest(TypeInformation typeInformation,
FILE: src/Registration/ServiceRegistration.cs
class ServiceRegistration (line 18) | [DebuggerDisplay("Name = {Name}, Lifetime = {Lifetime.Name}", Name = "{I...
method ServiceRegistration (line 63) | internal ServiceRegistration(Type implementationType, object? name,
method GetDiscriminator (line 84) | public int GetDiscriminator(TypeInformation typeInformation, Container...
method Replaces (line 94) | internal void Replaces(ServiceRegistration serviceRegistration) =>
method IsFactory (line 97) | internal bool IsFactory() => Options.GetOrDefault(RegistrationOption.R...
method IsInstance (line 99) | internal bool IsInstance() => Options.GetOrDefault(RegistrationOption....
method IsUsableForCurrentContext (line 101) | internal static bool IsUsableForCurrentContext(TypeInformation typeInf...
method HasParentTypeConditionAndMatch (line 106) | private static bool HasParentTypeConditionAndMatch(TypeInformation typ...
method HasAttributeConditionAndMatch (line 110) | private static bool HasAttributeConditionAndMatch(TypeInformation type...
method HasResolutionConditionAndMatch (line 116) | private static bool HasResolutionConditionAndMatch(TypeInformation typ...
method CheckInPathTypeConditions (line 129) | private static bool CheckInPathTypeConditions(ExpandableArray<object?,...
method CheckTypeConditions (line 141) | private static bool CheckTypeConditions(ExpandableArray<object?, Type>...
method CheckInPathAttributeConditions (line 166) | private static bool CheckInPathAttributeConditions(ExpandableArray<obj...
method CheckAttributeConditions (line 178) | private static bool CheckAttributeConditions(ExpandableArray<object?, ...
method ReserveRegistrationId (line 200) | private static int ReserveRegistrationId() =>
method ReserveRegistrationOrder (line 203) | private static int ReserveRegistrationOrder() =>
type RegistrationOption (line 211) | public enum RegistrationOption
class FactoryOptions (line 307) | public class FactoryOptions
method FactoryOptions (line 324) | internal FactoryOptions(Delegate factory, Type[] factoryParameters, bo...
class InstanceOptions (line 335) | public class InstanceOptions
method InstanceOptions (line 347) | internal InstanceOptions(object existingInstance, bool isWireUp)
class AutoMemberOptions (line 357) | public class AutoMemberOptions
method AutoMemberOptions (line 369) | internal AutoMemberOptions(Rules.AutoMemberInjectionRules autoMemberIn...
class ConstructorOptions (line 379) | public class ConstructorOptions
method ConstructorOptions (line 391) | internal ConstructorOptions(ConstructorInfo selectedConstructor, objec...
class ConditionOptions (line 398) | internal class ConditionOptions
FILE: src/Registration/ServiceRegistrator.cs
class ServiceRegistrator (line 9) | internal static class ServiceRegistrator
method Register (line 11) | public static void Register(IContainerContext containerContext, Servic...
method ReMap (line 33) | public static void ReMap(IContainerContext containerContext, ServiceRe...
method RegisterInternal (line 47) | private static void RegisterInternal(IContainerContext containerContex...
method ReMapInternal (line 58) | private static void ReMapInternal(IContainerContext containerContext, ...
method PreProcessRegistration (line 68) | private static void PreProcessRegistration(IContainerContext container...
method PreProcessExistingInstanceIfNeeded (line 80) | private static void PreProcessExistingInstanceIfNeeded(IContainerConte...
FILE: src/Resolution/DelegateCache.cs
class DelegateCache (line 7) | internal class DelegateCache
class CacheEntry (line 13) | internal class CacheEntry
method CacheEntry (line 19) | public CacheEntry(Func<IResolutionScope, IRequestContext, object>? ser...
class DelegateCacheProvider (line 26) | internal class DelegateCacheProvider
method GetNamedCache (line 31) | public DelegateCache GetNamedCache(object name)
FILE: src/Resolution/DelegateCacheEntry.cs
type DelegateCacheEntry (line 9) | public readonly struct DelegateCacheEntry
method DelegateCacheEntry (line 38) | public DelegateCacheEntry(Type serviceType, Func<IResolutionScope, IRe...
type NamedCacheEntry (line 50) | public readonly struct NamedCacheEntry
method NamedCacheEntry (line 67) | public NamedCacheEntry(object name, Func<IResolutionScope, IRequestCon...
FILE: src/Resolution/Extensions/DependencyResolverExtensions.cs
class DependencyResolverExtensions (line 12) | public static class DependencyResolverExtensions
method Resolve (line 20) | public static TKey Resolve<TKey>(this IDependencyResolver resolver) =>
method Resolve (line 30) | public static TKey Resolve<TKey>(this IDependencyResolver resolver, Re...
method Resolve (line 41) | public static TKey Resolve<TKey>(this IDependencyResolver resolver, ob...
method Resolve (line 52) | public static TKey Resolve<TKey>(this IDependencyResolver resolver, ob...
method Resolve (line 64) | public static TKey Resolve<TKey>(this IDependencyResolver resolver, ob...
method Resolve (line 74) | public static object Resolve(this IDependencyResolver resolver, Type t...
method Resolve (line 85) | public static object Resolve(this IDependencyResolver resolver, Type t...
method Resolve (line 96) | public static object Resolve(this IDependencyResolver resolver, Type t...
method ResolveOrDefault (line 107) | public static TKey? ResolveOrDefault<TKey>(this IDependencyResolver re...
method ResolveOrDefault (line 119) | public static TKey? ResolveOrDefault<TKey>(this IDependencyResolver re...
method ResolveOrDefault (line 128) | public static TKey? ResolveOrDefault<TKey>(this IDependencyResolver re...
method ResolveOrDefault (line 138) | public static TKey? ResolveOrDefault<TKey>(this IDependencyResolver re...
method ResolveOrDefault (line 149) | public static TKey? ResolveOrDefault<TKey>(this IDependencyResolver re...
method ResolveOrDefault (line 159) | public static object? ResolveOrDefault(this IDependencyResolver resolv...
method ResolveOrDefault (line 170) | public static object? ResolveOrDefault(this IDependencyResolver resolv...
method ResolveOrDefault (line 181) | public static object? ResolveOrDefault(this IDependencyResolver resolv...
method ResolveAll (line 190) | public static IEnumerable<TKey> ResolveAll<TKey>(this IDependencyResol...
method ResolveAll (line 200) | public static IEnumerable<TKey> ResolveAll<TKey>(this IDependencyResol...
method ResolveAll (line 211) | public static IEnumerable<TKey> ResolveAll<TKey>(this IDependencyResol...
method ResolveAll (line 222) | public static IEnumerable<TKey> ResolveAll<TKey>(this IDependencyResol...
method ResolveAll (line 234) | public static IEnumerable<TKey> ResolveAll<TKey>(this IDependencyResol...
method ResolveAll (line 243) | public static IEnumerable<object> ResolveAll(this IDependencyResolver ...
method ResolveAll (line 256) | public static IEnumerable<object> ResolveAll(this IDependencyResolver ...
method ResolveAll (line 271) | public static IEnumerable<object> ResolveAll(this IDependencyResolver ...
method ResolveAll (line 285) | public static IEnumerable<object> ResolveAll(this IDependencyResolver ...
method ResolveAll (line 300) | public static IEnumerable<object> ResolveAll(this IDependencyResolver ...
method Activate (line 314) | public static TTo Activate<TTo>(this IDependencyResolver resolver, par...
method Activate (line 325) | public static object Activate(this IDependencyResolver resolver, Type ...
method Activate (line 337) | public static TTo Activate<TTo>(this IDependencyResolver resolver, Res...
method PutInstanceInScope (line 349) | public static void PutInstanceInScope<TFrom>(this IDependencyResolver ...
method CanResolve (line 361) | public static bool CanResolve<TFrom>(this IDependencyResolver resolver...
FILE: src/Resolution/Extensions/InjectionParameterExtensions.cs
class InjectionParameterExtensions (line 8) | internal static class InjectionParameterExtensions
method SelectInjectionParameterOrDefault (line 10) | public static Expression? SelectInjectionParameterOrDefault(this IEnum...
FILE: src/Resolution/Extensions/ResolutionBehaviorExtensions.cs
class ResolutionBehaviorExtensions (line 3) | internal static class ResolutionBehaviorExtensions
method Has (line 5) | public static bool Has(this ResolutionBehavior resolutionBehavior, Res...
FILE: src/Resolution/ILookupResolver.cs
type ILookup (line 3) | internal interface ILookup
method CanLookupService (line 5) | bool CanLookupService(TypeInformation typeInfo, ResolutionContext reso...
FILE: src/Resolution/IRequestContext.cs
type IRequestContext (line 8) | public interface IRequestContext
method GetDependencyOverrideOrDefault (line 15) | object? GetDependencyOverrideOrDefault(Type dependencyType);
method GetDependencyOverrideOrDefault (line 22) | TResult? GetDependencyOverrideOrDefault<TResult>();
method GetOverrides (line 27) | object[] GetOverrides();
method ExcludeFromTracking (line 34) | TInstance ExcludeFromTracking<TInstance>(TInstance value)
type IInternalRequestContext (line 38) | internal interface IInternalRequestContext : IRequestContext
method GetOrAddInstance (line 40) | object GetOrAddInstance(int key, Func<IResolutionScope, IRequestContex...
method IsInstanceExcludedFromTracking (line 42) | bool IsInstanceExcludedFromTracking(object instance);
FILE: src/Resolution/IResolutionStrategy.cs
type IResolutionStrategy (line 10) | public interface IResolutionStrategy
method RegisterResolver (line 16) | void RegisterResolver(IResolver resolver);
method BuildExpressionForType (line 24) | ServiceContext BuildExpressionForType(ResolutionContext resolutionCont...
method BuildExpressionsForEnumerableRequest (line 32) | IEnumerable<ServiceContext> BuildExpressionsForEnumerableRequest(Resol...
method BuildExpressionForRegistration (line 41) | ServiceContext BuildExpressionForRegistration(ServiceRegistration serv...
method IsTypeResolvable (line 49) | bool IsTypeResolvable(ResolutionContext resolutionContext, TypeInforma...
FILE: src/Resolution/IResolver.cs
type IResolver (line 9) | public interface IResolver;
type IServiceResolver (line 14) | public interface IServiceResolver : IResolver
method GetExpression (line 23) | ServiceContext GetExpression(
method CanUseForResolution (line 34) | bool CanUseForResolution(TypeInformation typeInfo,
type IEnumerableSupportedResolver (line 41) | public interface IEnumerableSupportedResolver : IServiceResolver
method GetExpressionsForEnumerableRequest (line 50) | IEnumerable<ServiceContext> GetExpressionsForEnumerableRequest(
FILE: src/Resolution/IWrapper.cs
type IServiceWrapper (line 10) | public interface IServiceWrapper : IResolver
method WrapExpression (line 19) | Expression WrapExpression(TypeInformation originalTypeInformation,
method TryUnWrap (line 29) | bool TryUnWrap(Type type, out Type unWrappedType);
type IEnumerableWrapper (line 35) | public interface IEnumerableWrapper : IResolver
method WrapExpression (line 44) | Expression WrapExpression(TypeInformation originalTypeInformation, Typ...
method TryUnWrap (line 53) | bool TryUnWrap(Type type, out Type unWrappedType);
type IParameterizedWrapper (line 59) | public interface IParameterizedWrapper : IResolver
method WrapExpression (line 69) | Expression WrapExpression(TypeInformation originalTypeInformation, Typ...
method TryUnWrap (line 79) | bool TryUnWrap(Type type, out Type unWrappedType, out IEnumerable<Type...
type IMetadataWrapper (line 85) | public interface IMetadataWrapper : IResolver
method WrapExpression (line 94) | Expression WrapExpression(TypeInformation originalTypeInformation, Typ...
method TryUnWrap (line 104) | bool TryUnWrap(Type type, out Type unWrappedType, out Type metadataType);
FILE: src/Resolution/RequestContext.cs
class RequestContext (line 8) | internal class RequestContext : IInternalRequestContext
method FromOverrides (line 12) | public static RequestContext FromOverrides(object[]? overrides) => new...
method Begin (line 14) | public static RequestContext Begin() => new();
method RequestContext (line 20) | private RequestContext(object[]? overrides = null)
method GetOrAddInstance (line 25) | public object GetOrAddInstance(int key, Func<IResolutionScope, IReques...
method GetDependencyOverrideOrDefault (line 35) | public object? GetDependencyOverrideOrDefault(Type dependencyType) =>
method GetDependencyOverrideOrDefault (line 38) | public TResult? GetDependencyOverrideOrDefault<TResult>() =>
method GetOverrides (line 41) | public object[] GetOverrides() => this.overrides ?? TypeCache.EmptyArr...
method IsInstanceExcludedFromTracking (line 43) | public bool IsInstanceExcludedFromTracking(object instance)
method ExcludeFromTracking (line 49) | public TInstance ExcludeFromTracking<TInstance>(TInstance value)
FILE: src/Resolution/ResolutionBehavior.cs
type ResolutionBehavior (line 8) | [Flags]
FILE: src/Resolution/ResolutionContext.cs
class ResolutionContext (line 18) | public class ResolutionContext
class PerRequestConfiguration (line 20) | internal class PerRequestConfiguration
class AutoLifetimeTracker (line 26) | internal class AutoLifetimeTracker
method ResolutionContext (line 89) | private ResolutionContext(IEnumerable<object> initialScopeNames,
method ResolutionContext (line 128) | private ResolutionContext(PerRequestConfiguration perRequestConfigurat...
method AddInstruction (line 190) | public void AddInstruction(Expression instruction) =>
method AddDefinedVariable (line 198) | public void AddDefinedVariable(int key, ParameterExpression parameter) =>
method AddDefinedVariable (line 205) | public void AddDefinedVariable(ParameterExpression parameter) =>
method CacheExpression (line 208) | internal void CacheExpression(int key, Expression expression) =>
method BeginTopLevelContext (line 211) | internal static ResolutionContext BeginTopLevelContext(
method BeginValidationContext (line 230) | internal static ResolutionContext BeginValidationContext(IContainerCon...
method BeginParentContainerContext (line 233) | internal ResolutionContext BeginParentContainerContext(IContainerConte...
method FallBackToRequestInitiatorIfNeeded (line 238) | internal ResolutionContext FallBackToRequestInitiatorIfNeeded() =>
method BeginNewScopeContext (line 245) | internal ResolutionContext BeginNewScopeContext(ReadOnlyKeyValue<objec...
method BeginSubGraph (line 255) | internal ResolutionContext BeginSubGraph() =>
method BeginUnknownTypeCheckDisabledContext (line 260) | internal ResolutionContext BeginUnknownTypeCheckDisabledContext() =>
method BeginContextWithFunctionParameters (line 263) | internal ResolutionContext BeginContextWithFunctionParameters(Paramete...
method BeginDecoratingContext (line 267) | internal ResolutionContext BeginDecoratingContext(Type decoratingType,...
method BeginLifetimeValidationContext (line 278) | internal ResolutionContext BeginLifetimeValidationContext(int lifeSpan...
method BeginAutoLifetimeTrackingContext (line 281) | internal ResolutionContext BeginAutoLifetimeTrackingContext(AutoLifeti...
method ProcessDependencyOverrides (line 287) | private static HashTree<Type, ExpandableArray<Override>> ProcessDepend...
method Clone (line 325) | private ResolutionContext Clone(
FILE: src/Resolution/ResolutionStrategy.cs
class ResolutionStrategy (line 16) | internal class ResolutionStrategy : IResolutionStrategy
method ResolutionStrategy (line 21) | public ResolutionStrategy()
method BuildExpressionForType (line 39) | public ServiceContext BuildExpressionForType(ResolutionContext resolut...
method BuildExpressionsForEnumerableRequest (line 121) | public IEnumerable<ServiceContext> BuildExpressionsForEnumerableReques...
method BuildExpressionForRegistration (line 156) | public ServiceContext BuildExpressionForRegistration(ServiceRegistrati...
method IsTypeResolvable (line 188) | public bool IsTypeResolvable(ResolutionContext resolutionContext, Type...
method RegisterResolver (line 211) | public void RegisterResolver(IResolver resolver) =>
method BuildExpressionUsingWrappersOrResolvers (line 217) | private ServiceContext BuildExpressionUsingWrappersOrResolvers(Resolut...
method BuildEnumerableExpressionUsingWrappersOrResolvers (line 286) | private IEnumerable<ServiceContext> BuildEnumerableExpressionUsingWrap...
method BuildExpressionUsingResolvers (line 336) | private ServiceContext BuildExpressionUsingResolvers(ResolutionContext...
method BuildEnumerableExpressionsUsingResolvers (line 350) | private IEnumerable<ServiceContext> BuildEnumerableExpressionsUsingRes...
method IsWrappedTypeRegistered (line 366) | private bool IsWrappedTypeRegistered(TypeInformation typeInformation, ...
method CanLookupService (line 403) | private bool CanLookupService(TypeInformation typeInfo, ResolutionCont...
method CollectDecorators (line 416) | private IEnumerable<ServiceRegistration>? CollectDecorators(Type imple...
method SearchAndFilterDecorators (line 433) | private IEnumerable<ServiceRegistration>? SearchAndFilterDecorators(Ty...
method TryUnwrapTypeFrom (line 451) | private bool TryUnwrapTypeFrom(Type wrapped, out Type unwrapped)
method BuildExpressionForDecorator (line 472) | private static Expression? BuildExpressionForDecorator(ServiceRegistra...
method BuildExpressionAndApplyLifetime (line 487) | private static Expression? BuildExpressionAndApplyLifetime(ServiceRegi...
method IsOutputLifetimeManageable (line 504) | private static bool IsOutputLifetimeManageable(ServiceRegistration ser...
FILE: src/Resolution/Resolvers/DefaultValueResolver.cs
class DefaultValueResolver (line 6) | internal class DefaultValueResolver : IServiceResolver
method GetExpression (line 8) | public ServiceContext GetExpression(
method CanUseForResolution (line 14) | public bool CanUseForResolution(TypeInformation typeInfo, ResolutionCo...
FILE: src/Resolution/Resolvers/OptionalValueResolver.cs
class OptionalValueResolver (line 5) | internal class OptionalValueResolver : IServiceResolver
method GetExpression (line 7) | public ServiceContext GetExpression(
method CanUseForResolution (line 13) | public bool CanUseForResolution(TypeInformation typeInfo, ResolutionCo...
FILE: src/Resolution/Resolvers/ParentContainerResolver.cs
class ParentContainerResolver (line 6) | internal class ParentContainerResolver : IEnumerableSupportedResolver, I...
method CanUseForResolution (line 8) | public bool CanUseForResolution(TypeInformation typeInfo, ResolutionCo...
method GetExpression (line 13) | public ServiceContext GetExpression(
method GetExpressionsForEnumerableRequest (line 20) | public IEnumerable<ServiceContext> GetExpressionsForEnumerableRequest(
method CanLookupService (line 27) | public bool CanLookupService(TypeInformation typeInfo, ResolutionConte...
FILE: src/Resolution/Resolvers/ServiceProviderResolver.cs
class ServiceProviderResolver (line 7) | internal class ServiceProviderResolver : IServiceResolver
method GetExpression (line 9) | public ServiceContext GetExpression(
method CanUseForResolution (line 15) | public bool CanUseForResolution(TypeInformation typeInfo, ResolutionCo...
FILE: src/Resolution/Resolvers/UnknownTypeResolver.cs
class UnknownTypeResolver (line 7) | internal class UnknownTypeResolver : IServiceResolver, ILookup
method CanLookupService (line 9) | public bool CanLookupService(TypeInformation typeInfo, ResolutionConte...
method CanUseForResolution (line 12) | public bool CanUseForResolution(TypeInformation typeInfo, ResolutionCo...
method GetExpression (line 18) | public ServiceContext GetExpression(
FILE: src/Resolution/ServiceContext.cs
type ServiceContext (line 9) | public readonly struct ServiceContext
method ServiceContext (line 26) | public ServiceContext(Expression serviceExpression, ServiceRegistratio...
method IsEmpty (line 32) | internal bool IsEmpty() => this.Equals(Empty);
method Equals (line 34) | private bool Equals(ServiceContext other) =>
FILE: src/Resolution/TypeInformation.cs
class TypeInformation (line 10) | public class TypeInformation
class DefaultValueHolder (line 16) | public class DefaultValueHolder(object? value)
method TypeInformation (line 71) | internal TypeInformation(Type type, object? dependencyName)
method TypeInformation (line 85) | internal TypeInformation(Type type, Type? parentType, TypeInformation?...
method Clone (line 108) | public TypeInformation Clone(Type type, object? dependencyName = null,...
FILE: src/Resolution/Wrappers/EnumerableWrapper.cs
class EnumerableWrapper (line 9) | internal class EnumerableWrapper : IEnumerableWrapper
method WrapExpression (line 11) | public Expression WrapExpression(TypeInformation originalTypeInformation,
method TryUnWrap (line 16) | public bool TryUnWrap(Type type, out Type unWrappedType)
FILE: src/Resolution/Wrappers/FuncWrapper.cs
class FuncWrapper (line 9) | internal class FuncWrapper : IParameterizedWrapper
method WrapExpression (line 11) | public Expression WrapExpression(TypeInformation originalTypeInformati...
method TryUnWrap (line 15) | public bool TryUnWrap(Type type, out Type unWrappedType, out IEnumerab...
FILE: src/Resolution/Wrappers/KeyValueWrapper.cs
class KeyValueWrapper (line 8) | internal class KeyValueWrapper : IServiceWrapper
method IsKeyValueType (line 16) | private static bool IsKeyValueType(Type type) => type.IsClosedGenericT...
method WrapExpression (line 18) | public Expression WrapExpression(TypeInformation originalTypeInformati...
method TryUnWrap (line 27) | public bool TryUnWrap(Type type, out Type unWrappedType)
FILE: src/Resolution/Wrappers/LazyWrapper.cs
class LazyWrapper (line 7) | internal class LazyWrapper : IServiceWrapper
method IsLazy (line 9) | private static bool IsLazy(Type type) => type.IsClosedGenericType() &&...
method WrapExpression (line 11) | public Expression WrapExpression(TypeInformation originalTypeInformati...
method TryUnWrap (line 19) | public bool TryUnWrap(Type type, out Type unWrappedType)
FILE: src/Resolution/Wrappers/MetadataWrapper.cs
class MetadataWrapper (line 9) | internal class MetadataWrapper : IMetadataWrapper
method IsMetadataType (line 18) | private static bool IsMetadataType(Type type) => type.IsClosedGenericT...
method WrapExpression (line 20) | public Expression WrapExpression(TypeInformation originalTypeInformati...
method TryUnWrap (line 29) | public bool TryUnWrap(Type type, out Type unWrappedType, out Type meta...
FILE: src/ResolutionScope.AsyncInitializer.cs
class ResolutionScope (line 9) | internal sealed partial class ResolutionScope
class AsyncInitializable (line 11) | private sealed class AsyncInitializable
method AsyncInitializable (line 17) | public AsyncInitializable(object item, Func<object, IDependencyResol...
method InvokeAsync (line 24) | public ValueTask InvokeAsync(IDependencyResolver resolver, Cancellat...
method AddWithAsyncInitializer (line 32) | public object AddWithAsyncInitializer(object initializable, Func<objec...
method InvokeAsyncInitializers (line 44) | public async ValueTask InvokeAsyncInitializers(CancellationToken token...
FILE: src/ResolutionScope.Disposable.cs
class ResolutionScope (line 11) | internal partial class ResolutionScope
type Finalizable (line 13) | private readonly struct Finalizable
method Finalizable (line 18) | public Finalizable(object item, Action<object> finalizer)
method AddDisposableTracking (line 28) | public object AddDisposableTracking(object disposable)
method AddRequestContextAwareDisposableTracking (line 39) | public object AddRequestContextAwareDisposableTracking(object disposab...
method AddWithFinalizer (line 47) | public object AddWithFinalizer(object finalizable, Action<object> fina...
method Dispose (line 58) | public void Dispose()
method DisposeAsync (line 72) | public async ValueTask DisposeAsync()
method DisposeChildScopesAsync (line 105) | private async ValueTask DisposeChildScopesAsync()
method DisposeChildScopes (line 114) | private void DisposeChildScopes()
method RemoveSelfFromParent (line 122) | private void RemoveSelfFromParent()
method CallFinalizers (line 132) | private void CallFinalizers()
method CallDisposes (line 142) | private void CallDisposes()
method ThrowIfDisposed (line 152) | private void ThrowIfDisposed([CallerMemberName] string caller = "<unkn...
FILE: src/ResolutionScope.Resolver.cs
class ResolutionScope (line 14) | internal partial class ResolutionScope
method Resolve (line 17) | public object Resolve(Type typeFrom)
method Resolve (line 32) | public object Resolve(Type typeFrom, object? name, object[]? dependenc...
method ResolveOrDefault (line 56) | public object? ResolveOrDefault(Type typeFrom)
method ResolveOrDefault (line 71) | public object? ResolveOrDefault(Type typeFrom, object? name, object[]?...
method GetService (line 95) | public object? GetService(Type serviceType) => this.ResolveOrDefault(s...
method ResolveFactory (line 98) | public Delegate ResolveFactory(Type typeFrom, object? name = null, Res...
method ResolveFactoryOrDefault (line 114) | public Delegate? ResolveFactoryOrDefault(Type typeFrom, object? name =...
method BuildUp (line 130) | public TTo BuildUp<TTo>(TTo instance, ResolutionBehavior resolutionBeh...
method Activate (line 145) | public object Activate(Type type, ResolutionBehavior resolutionBehavio...
method CanResolve (line 162) | public bool CanResolve(Type typeFrom, object? name = null, ResolutionB...
method BeginScope (line 173) | public IDependencyResolver BeginScope(object? name = null, bool attach...
method PutInstanceInScope (line 188) | public void PutInstanceInScope(Type typeFrom, object instance, bool wi...
method GetDelegateCacheEntries (line 209) | public IEnumerable<DelegateCacheEntry> GetDelegateCacheEntries()
method BuildAndResolveService (line 218) | private object BuildAndResolveService(Type type, object? name, object[...
method BuildAndResolveServiceOrDefault (line 234) | private object? BuildAndResolveServiceOrDefault(Type type, object? nam...
method BuildAndResolveFactoryDelegate (line 249) | private Delegate BuildAndResolveFactoryDelegate(Type type, Type[] para...
method BuildAndResolveFactoryDelegateOrDefault (line 266) | private Delegate? BuildAndResolveFactoryDelegateOrDefault(Type type, T...
method StoreAndInvokeServiceDelegate (line 283) | private object StoreAndInvokeServiceDelegate(Type serviceType,
method StoreAndInvokeNamedServiceDelegate (line 307) | private object StoreAndInvokeNamedServiceDelegate(Type serviceType, ob...
method GetObjectFromCachedFactoryOrDefault (line 329) | private T? GetObjectFromCachedFactoryOrDefault<T>(Type type, object? n...
FILE: src/ResolutionScope.cs
class ResolutionScope (line 13) | internal sealed partial class ResolutionScope : IResolutionScope
class ScopedEvaluator (line 15) | private sealed class ScopedEvaluator
method Evaluate (line 22) | public object Evaluate(IResolutionScope scope, IRequestContext reque...
method WaitForEvaluation (line 33) | private object WaitForEvaluation(Type serviceType)
method GetEvaluatedObjectOrThrow (line 61) | private static object GetEvaluatedObjectOrThrow(object evaluated)
method EvaluateFactory (line 69) | [MethodImpl(MethodImplOptions.NoInlining)]
class FailedEvaluation (line 85) | private sealed class FailedEvaluation(Exception exception)
method ResolutionScope (line 107) | public ResolutionScope(IContainerContext containerContext)
method ResolutionScope (line 114) | private ResolutionScope(ResolutionScope parent, IContainerContext cont...
method GetOrAddScopedObject (line 126) | public object GetOrAddScopedObject(int key, Func<IResolutionScope, IRe...
method InvalidateDelegateCache (line 139) | public void InvalidateDelegateCache()
method GetActiveScopeNames (line 150) | public IEnumerable<object> GetActiveScopeNames()
FILE: src/StashboxContainer.CollectionRegistrator.cs
class StashboxContainer (line 10) | public partial class StashboxContainer
method RegisterTypesAs (line 13) | public IStashboxContainer RegisterTypesAs(Type typeFrom,
method RegisterTypes (line 44) | public IStashboxContainer RegisterTypes(IEnumerable<Type> types,
method ComposeBy (line 96) | public IStashboxContainer ComposeBy(Type compositionRootType, params o...
method ComposeBy (line 109) | public IStashboxContainer ComposeBy(ICompositionRoot compositionRoot)
method RegisterTypeAs (line 118) | private void RegisterTypeAs(Type typeFrom, Type type, Action<Registrat...
FILE: src/StashboxContainer.FuncRegistrator.cs
class StashboxContainer (line 8) | public partial class StashboxContainer
method RegisterFunc (line 11) | public IStashboxContainer RegisterFunc<TService>(Func<IDependencyResol...
method RegisterFunc (line 15) | public IStashboxContainer RegisterFunc<T1, TService>(Func<T1, IDepende...
method RegisterFunc (line 19) | public IStashboxContainer RegisterFunc<T1, T2, TService>(Func<T1, T2, ...
method RegisterFunc (line 23) | public IStashboxContainer RegisterFunc<T1, T2, T3, TService>(Func<T1, ...
method RegisterFunc (line 27) | public IStashboxContainer RegisterFunc<T1, T2, T3, T4, TService>(Func<...
method RegisterFuncInternal (line 30) | private IStashboxContainer RegisterFuncInternal(Delegate factory, Type...
FILE: src/StashboxContainer.ReMapper.cs
class StashboxContainer (line 8) | public partial class StashboxContainer
method ReMap (line 11) | public IStashboxContainer ReMap<TFrom, TTo>(Action<RegistrationConfigu...
method ReMap (line 23) | public IStashboxContainer ReMap<TFrom>(Type typeTo, Action<Registratio...
method ReMap (line 38) | public IStashboxContainer ReMap(Type typeFrom, Type typeTo, Action<Reg...
method ReMap (line 51) | public IStashboxContainer ReMap<TTo>(Action<RegistrationConfigurator<T...
method ReMapDecorator (line 65) | public IStashboxContainer ReMapDecorator(Type typeFrom, Type typeTo, A...
method ReMapDecorator (line 78) | public IStashboxContainer ReMapDecorator<TFrom, TTo>(Action<DecoratorC...
method ReMapDecorator (line 90) | public IStashboxContainer ReMapDecorator<TFrom>(Type typeTo, Action<De...
method ReMapInternal (line 104) | private IStashboxContainer ReMapInternal(Type serviceType, ServiceRegi...
FILE: src/StashboxContainer.Registrator.cs
class StashboxContainer (line 10) | public partial class StashboxContainer
method Register (line 13) | public IStashboxContainer Register<TFrom, TTo>(Action<RegistrationConf...
method Register (line 27) | public IStashboxContainer Register<TFrom, TTo>(object? name = null)
method Register (line 37) | public IStashboxContainer Register<TFrom>(Type typeTo, Action<Registra...
method Register (line 59) | public IStashboxContainer Register(Type typeFrom, Type typeTo, Action<...
method Register (line 79) | public IStashboxContainer Register<TTo>(Action<RegistrationConfigurato...
method Register (line 93) | public IStashboxContainer Register<TTo>(object? name = null)
method Register (line 105) | public IStashboxContainer Register(Type typeTo, Action<RegistrationCon...
method RegisterSingleton (line 125) | public IStashboxContainer RegisterSingleton<TFrom, TTo>(object? name =...
method RegisterSingleton (line 135) | public IStashboxContainer RegisterSingleton<TTo>(object? name = null)
method RegisterSingleton (line 147) | public IStashboxContainer RegisterSingleton(Type typeFrom, Type typeTo...
method RegisterScoped (line 158) | public IStashboxContainer RegisterScoped<TFrom, TTo>(object? name = null)
method RegisterScoped (line 168) | public IStashboxContainer RegisterScoped(Type typeFrom, Type typeTo, o...
method RegisterScoped (line 179) | public IStashboxContainer RegisterScoped<TTo>(object? name = null)
method RegisterInstance (line 191) | public IStashboxContainer RegisterInstance<TInstance>(TInstance instan...
method RegisterInstance (line 203) | public IStashboxContainer RegisterInstance(object instance, Type servi...
method WireUp (line 213) | public IStashboxContainer WireUp<TInstance>(TInstance instance, object...
method WireUp (line 225) | public IStashboxContainer WireUp(object instance, Type serviceType, ob...
method RegisterDecorator (line 235) | public IStashboxContainer RegisterDecorator(Type typeFrom, Type typeTo...
method RegisterDecorator (line 256) | public IStashboxContainer RegisterDecorator<TFrom, TTo>(Action<Decorat...
method RegisterDecorator (line 272) | public IStashboxContainer RegisterDecorator(Type typeTo, Action<Decora...
method RegisterDecorator (line 287) | public IStashboxContainer RegisterDecorator<TTo>(Action<DecoratorConfi...
method RegisterDecorator (line 303) | public IStashboxContainer RegisterDecorator<TFrom>(Type typeTo, Action...
method RegisterInternal (line 325) | private IStashboxContainer RegisterInternal(Type serviceType, Type imp...
method RegisterInternal (line 336) | private IStashboxContainer RegisterInternal(Type serviceType, ServiceR...
method RegisterInstanceInternal (line 346) | private IStashboxContainer RegisterInstanceInternal(Type serviceType, ...
FILE: src/StashboxContainer.Resolver.cs
class StashboxContainer (line 9) | public partial class StashboxContainer
method Resolve (line 12) | public object Resolve(Type typeFrom) => this.rootScope.Resolve(typeFrom);
method Resolve (line 15) | public object Resolve(Type typeFrom, object? name, object[]? dependenc...
method ResolveOrDefault (line 20) | public object? ResolveOrDefault(Type typeFrom) =>
method ResolveOrDefault (line 24) | public object? ResolveOrDefault(Type typeFrom, object? name, object[]?...
method GetService (line 29) | public object? GetService(Type serviceType) => this.rootScope.ResolveO...
method ResolveFactory (line 32) | public Delegate ResolveFactory(Type typeFrom, object? name = null,
method ResolveFactoryOrDefault (line 37) | public Delegate? ResolveFactoryOrDefault(Type typeFrom, object? name =...
method BuildUp (line 42) | public TTo BuildUp<TTo>(TTo instance, ResolutionBehavior resolutionBeh...
method Activate (line 46) | public object Activate(Type type, ResolutionBehavior resolutionBehavio...
method CanResolve (line 50) | public bool CanResolve(Type typeFrom, object? name = null,
method InvokeAsyncInitializers (line 55) | public ValueTask InvokeAsyncInitializers(CancellationToken token = def...
method BeginScope (line 59) | public IDependencyResolver BeginScope(object? name = null, bool attach...
method PutInstanceInScope (line 63) | public void PutInstanceInScope(Type typeFrom, object instance, bool wi...
method GetDelegateCacheEntries (line 67) | public IEnumerable<DelegateCacheEntry> GetDelegateCacheEntries() =>
FILE: src/StashboxContainer.cs
class StashboxContainer (line 19) | public sealed partial class StashboxContainer : IStashboxContainer
class ChildContainerStore (line 21) | private sealed class ChildContainerStore
method StashboxContainer (line 40) | public StashboxContainer(Action<ContainerConfigurator>? config = null)
method StashboxContainer (line 45) | private StashboxContainer(StashboxContainer? parentContainer, IResolut...
method RegisterResolver (line 68) | public IStashboxContainer RegisterResolver(IResolver resolver)
method IsRegistered (line 78) | public bool IsRegistered<TFrom>(object? name = null) =>
method IsRegistered (line 82) | public bool IsRegistered(Type typeFrom, object? name = null)
method Validate (line 91) | public void Validate()
method CreateChildContainer (line 133) | public IStashboxContainer CreateChildContainer(Action<ContainerConfigu...
method CreateChildContainer (line 139) | public IStashboxContainer CreateChildContainer(object identifier, Acti...
method GetChildContainer (line 158) | public IStashboxContainer? GetChildContainer(object identifier) =>
method Configure (line 162) | public IStashboxContainer Configure(Action<ContainerConfigurator> config)
method GetRegistrationMappings (line 176) | public IEnumerable<KeyValuePair<Type, ServiceRegistration>> GetRegistr...
method GetRegistrationDiagnostics (line 184) | public IEnumerable<RegistrationDiagnosticsInfo> GetRegistrationDiagnos...
method ThrowIfDisposed (line 192) | private void ThrowIfDisposed([CallerMemberName] string caller = "<unkn...
method Dispose (line 199) | public void Dispose()
method DisposeAsync (line 211) | public async ValueTask DisposeAsync()
method DisposeChildContainersAsync (line 221) | private async ValueTask DisposeChildContainersAsync()
method DisposeChildContainers (line 231) | private void DisposeChildContainers()
method RemoveSelfFromParentChildContainers (line 240) | private void RemoveSelfFromParentChildContainers()
method ReserveContainerId (line 249) | private static int ReserveContainerId() =>
FILE: src/Utils/Constants.cs
class Constants (line 10) | internal static class Constants
FILE: src/Utils/Data/ExpandableArray.cs
class ExpandableArray (line 9) | internal class ExpandableArray<TItem> : IEnumerable<TItem>
method ExpandableArray (line 17) | public ExpandableArray()
method ExpandableArray (line 20) | public ExpandableArray(ExpandableArray<TItem> initial)
method ExpandableArray (line 26) | public ExpandableArray(IEnumerable<TItem> initial)
method ExpandableArray (line 30) | public ExpandableArray(TItem[] initial)
method Add (line 36) | public void Add(TItem item)
method AddOrKeep (line 42) | public void AddOrKeep(TItem item)
method AddRange (line 51) | public void AddRange(IEnumerable<TItem> items) => this.AddRange(items....
method AddRange (line 53) | public void AddRange(TItem[] items)
method AsArray (line 61) | public TItem[] AsArray()
method IndexOf (line 70) | public int IndexOf(TItem element)
method ContainsReference (line 82) | public bool ContainsReference(TItem element)
method Contains (line 94) | public bool Contains(TItem element)
method EnsureSize (line 106) | protected int EnsureSize(int increaseAmount = 1)
method First (line 121) | public TItem First() => this.Repository![0];
method GetEnumerator (line 123) | public IEnumerator<TItem> GetEnumerator()
method GetEnumerator (line 130) | IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator();
method ExpandableArray (line 135) | public ExpandableArray()
method ExpandableArray (line 138) | public ExpandableArray(ExpandableArray<TKey, TItem> initial)
method GetOrDefaultByValue (line 142) | [MethodImpl(Constants.Inline)]
method GetOrDefaultByRef (line 156) | [MethodImpl(Constants.Inline)]
method AddOrKeep (line 170) | public void AddOrKeep(TKey item, TItem value)
method AddOrUpdate (line 179) | public void AddOrUpdate(TKey key, TItem value)
method IndexAndValueOf (line 192) | public int IndexAndValueOf(TKey key, out TItem? value)
method IndexOf (line 207) | public int IndexOf(TKey key)
method ContainsReference (line 222) | public bool ContainsReference(TKey key)
class ExpandableArray (line 133) | internal class ExpandableArray<TKey, TItem> : ExpandableArray<ReadOnlyKe...
method ExpandableArray (line 17) | public ExpandableArray()
method ExpandableArray (line 20) | public ExpandableArray(ExpandableArray<TItem> initial)
method ExpandableArray (line 26) | public ExpandableArray(IEnumerable<TItem> initial)
method ExpandableArray (line 30) | public ExpandableArray(TItem[] initial)
method Add (line 36) | public void Add(TItem item)
method AddOrKeep (line 42) | public void AddOrKeep(TItem item)
method AddRange (line 51) | public void AddRange(IEnumerable<TItem> items) => this.AddRange(items....
method AddRange (line 53) | public void AddRange(TItem[] items)
method AsArray (line 61) | public TItem[] AsArray()
method IndexOf (line 70) | public int IndexOf(TItem element)
method ContainsReference (line 82) | public bool ContainsReference(TItem element)
method Contains (line 94) | public bool Contains(TItem element)
method EnsureSize (line 106) | protected int EnsureSize(int increaseAmount = 1)
method First (line 121) | public TItem First() => this.Repository![0];
method GetEnumerator (line 123) | public IEnumerator<TItem> GetEnumerator()
method GetEnumerator (line 130) | IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator();
method ExpandableArray (line 135) | public ExpandableArray()
method ExpandableArray (line 138) | public ExpandableArray(ExpandableArray<TKey, TItem> initial)
method GetOrDefaultByValue (line 142) | [MethodImpl(Constants.Inline)]
method GetOrDefaultByRef (line 156) | [MethodImpl(Constants.Inline)]
method AddOrKeep (line 170) | public void AddOrKeep(TKey item, TItem value)
method AddOrUpdate (line 179) | public void AddOrUpdate(TKey key, TItem value)
method IndexAndValueOf (line 192) | public int IndexAndValueOf(TKey key, out TItem? value)
method IndexOf (line 207) | public int IndexOf(TKey key)
method ContainsReference (line 222) | public bool ContainsReference(TKey key)
FILE: src/Utils/Data/HashTree.cs
class HashTree (line 8) | [DebuggerTypeProxy(typeof(HashTreeDebugView<,>))]
class Node (line 12) | private class Node
method Node (line 22) | public Node(TKey key, TValue value, int hash)
method Add (line 33) | public void Add(TKey key, TValue value)
method GetOrDefault (line 38) | [MethodImpl(Constants.Inline)]
method CalculateHeight (line 55) | private static int CalculateHeight(Node node)
method GetBalance (line 66) | private static int GetBalance(Node node)
method RotateLeft (line 77) | private static Node RotateLeft(Node node)
method RotateRight (line 91) | private static Node RotateRight(Node node)
method Add (line 103) | private static Node Add(Node? node, TKey key, int hash, TValue value)
method CheckCollisions (line 143) | private static void CheckCollisions(Node node, TKey key, TValue value)
method Walk (line 154) | public IEnumerable<TValue> Walk()
class HashTreeDebugView (line 231) | internal class HashTreeDebugView<TKey, TValue> where TKey : class
method HashTreeDebugView (line 235) | public HashTreeDebugView(HashTree<TKey, TValue> tree) { this.tree = tr...
FILE: src/Utils/Data/Immutable/ImmutableBucket.cs
class ImmutableBucket (line 9) | [DebuggerTypeProxy(typeof(ImmutableBucketDebugView<>))]
method ImmutableBucket (line 20) | public ImmutableBucket(TValue value)
method ImmutableBucket (line 24) | public ImmutableBucket(TValue[] repository)
method Add (line 30) | internal ImmutableBucket<TValue> Add(TValue value)
method Insert (line 42) | internal ImmutableBucket<TValue> Insert(int index, TValue value)
method ReplaceAt (line 58) | internal ImmutableBucket<TValue> ReplaceAt(int index, TValue value)
method AddIfNotExist (line 73) | public ImmutableBucket<TValue> AddIfNotExist(TValue value)
method Remove (line 91) | public ImmutableBucket<TValue> Remove(TValue value)
method ImmutableBucket (line 134) | private ImmutableBucket(ReadOnlyKeyValue<TKey, TValue>[] repository)
method Add (line 140) | public ImmutableBucket<TKey, TValue> Add(TKey key, TValue value)
method AddOrUpdate (line 152) | public ImmutableBucket<TKey, TValue> AddOrUpdate(TKey key, TValue valu...
method ReplaceIfExists (line 177) | public ImmutableBucket<TKey, TValue> ReplaceIfExists(TKey key, Func<TV...
method ReplaceIfExists (line 203) | public ImmutableBucket<TKey, TValue> ReplaceIfExists(TKey key, TValue ...
method GetOrDefaultByValue (line 234) | [MethodImpl(Constants.Inline)]
method GetOrDefaultByRef (line 248) | [MethodImpl(Constants.Inline)]
method Remove (line 262) | public ImmutableBucket<TKey, TValue> Remove(TKey key, bool byRef)
method RemoveFirst (line 286) | public ImmutableBucket<TKey, TValue> RemoveFirst()
method GetEnumerator (line 302) | public IEnumerator<TValue> GetEnumerator()
method GetEnumerator (line 308) | IEnumerator IEnumerable.GetEnumerator()
class ImmutableBucketDebugView (line 116) | internal class ImmutableBucketDebugView<TValue>
method ImmutableBucketDebugView (line 120) | public ImmutableBucketDebugView(ImmutableBucket<TValue> bucket) { this...
class ImmutableBucket (line 126) | internal class ImmutableBucket<TKey, TValue> : IEnumerable<TValue>
method ImmutableBucket (line 20) | public ImmutableBucket(TValue value)
method ImmutableBucket (line 24) | public ImmutableBucket(TValue[] repository)
method Add (line 30) | internal ImmutableBucket<TValue> Add(TValue value)
method Insert (line 42) | internal ImmutableBucket<TValue> Insert(int index, TValue value)
method ReplaceAt (line 58) | internal ImmutableBucket<TValue> ReplaceAt(int index, TValue value)
method AddIfNotExist (line 73) | public ImmutableBucket<TValue> AddIfNotExist(TValue value)
method Remove (line 91) | public ImmutableBucket<TValue> Remove(TValue value)
method ImmutableBucket (line 134) | private ImmutableBucket(ReadOnlyKeyValue<TKey, TValue>[] repository)
method Add (line 140) | public ImmutableBucket<TKey, TValue> Add(TKey key, TValue value)
method AddOrUpdate (line 152) | public ImmutableBucket<TKey, TValue> AddOrUpdate(TKey key, TValue valu...
method ReplaceIfExists (line 177) | public ImmutableBucket<TKey, TValue> ReplaceIfExists(TKey key, Func<TV...
method ReplaceIfExists (line 203) | public ImmutableBucket<TKey, TValue> ReplaceIfExists(TKey key, TValue ...
method GetOrDefaultByValue (line 234) | [MethodImpl(Constants.Inline)]
method GetOrDefaultByRef (line 248) | [MethodImpl(Constants.Inline)]
method Remove (line 262) | public ImmutableBucket<TKey, TValue> Remove(TKey key, bool byRef)
method RemoveFirst (line 286) | public ImmutableBucket<TKey, TValue> RemoveFirst()
method GetEnumerator (line 302) | public IEnumerator<TValue> GetEnumerator()
method GetEnumerator (line 308) | IEnumerator IEnumerable.GetEnumerator()
FILE: src/Utils/Data/Immutable/ImmutableLinkedList.cs
class ImmutableLinkedList (line 5) | internal class ImmutableLinkedList<TValue>
method ImmutableLinkedList (line 13) | private ImmutableLinkedList(ImmutableLinkedList<TValue> next, TValue v...
method ImmutableLinkedList (line 19) | private ImmutableLinkedList()
method Add (line 22) | public ImmutableLinkedList<TValue> Add(TValue value) =>
FILE: src/Utils/Data/Immutable/ImmutableTree.cs
class ImmutableTree (line 9) | [DebuggerTypeProxy(typeof(ImmutableTreeDebugView<>))]
method ImmutableTree (line 23) | private ImmutableTree(int hash, TValue value, ImmutableTree<TValue> le...
method ImmutableTree (line 33) | private ImmutableTree(int hash, TValue value)
method ImmutableTree (line 43) | private ImmutableTree()
method GetOrDefault (line 46) | [MethodImpl(Constants.Inline)]
method AddOrUpdate (line 58) | public ImmutableTree<TValue> AddOrUpdate(int key, TValue value, Func<T...
method Remove (line 79) | public ImmutableTree<TValue> Remove(int key)
method Balance (line 98) | private static ImmutableTree<TValue> Balance(int hash, TValue value, I...
method RotateRight (line 114) | private static ImmutableTree<TValue> RotateRight(int hash, TValue valu...
method RotateLeft (line 120) | private static ImmutableTree<TValue> RotateLeft(int hash, TValue value...
method RotateRightLeft (line 126) | private static ImmutableTree<TValue> RotateRightLeft(int hash, TValue ...
method RotateLeftRight (line 133) | private static ImmutableTree<TValue> RotateLeftRight(int hash, TValue ...
method ToString (line 140) | public override string ToString() => this.IsEmpty ? "empty" : $"{this....
method Walk (line 143) | public IEnumerable<ReadOnlyKeyValue<int, TValue>> Walk()
method ImmutableTree (line 196) | private ImmutableTree(int hash, TKey key, TValue value, ImmutableTree<...
method ImmutableTree (line 209) | private ImmutableTree()
method ImmutableTree (line 212) | private ImmutableTree(int hash, TKey key, TValue value)
method AddOrUpdate (line 223) | public ImmutableTree<TKey, TValue> AddOrUpdate(TKey key, TValue value,...
method AddOrUpdate (line 226) | public ImmutableTree<TKey, TValue> AddOrUpdate(TKey key, TValue value,...
method UpdateIfExists (line 229) | public ImmutableTree<TKey, TValue> UpdateIfExists(TKey key, bool byRef...
method UpdateIfExists (line 232) | public ImmutableTree<TKey, TValue> UpdateIfExists(TKey key, TValue val...
method GetOrDefaultByValue (line 235) | [MethodImpl(Constants.Inline)]
method GetOrDefaultByRef (line 252) | [MethodImpl(Constants.Inline)]
method Remove (line 269) | public ImmutableTree<TKey, TValue> Remove(TKey key, bool byRef) =>
method AddOrUpdate (line 272) | private ImmutableTree<TKey, TValue> AddOrUpdate(int hash, TKey key, TV...
method UpdateIfExists (line 303) | private ImmutableTree<TKey, TValue> UpdateIfExists(int hash, TKey key,...
method UpdateIfExists (line 328) | private ImmutableTree<TKey, TValue> UpdateIfExists(int hash, TKey key,...
method Remove (line 354) | private ImmutableTree<TKey, TValue> Remove(int hash, TKey key, bool by...
method CheckCollision (line 391) | private ImmutableTree<TKey, TValue> CheckCollision(int hash, TKey key,...
method ReplaceInCollisionsIfExist (line 422) | private ImmutableTree<TKey, TValue> ReplaceInCollisionsIfExist(int has...
method ReplaceInCollisionsIfExist (line 438) | private ImmutableTree<TKey, TValue> ReplaceInCollisionsIfExist(int has...
method Balance (line 454) | private static ImmutableTree<TKey, TValue> Balance(int hash, TKey key,...
method RotateRight (line 470) | private static ImmutableTree<TKey, TValue> RotateRight(int hash, TKey ...
method RotateLeft (line 476) | private static ImmutableTree<TKey, TValue> RotateLeft(int hash, TKey k...
method RotateRightLeft (line 482) | private static ImmutableTree<TKey, TValue> RotateRightLeft(int hash, T...
method RotateLeftRight (line 489) | private static ImmutableTree<TKey, TValue> RotateLeftRight(int hash, T...
method ToString (line 496) | public override string ToString() => this.IsEmpty ? "empty" : $"{this....
method Walk (line 498) | public IEnumerable<ReadOnlyKeyValue<TKey, TValue>> Walk()
class ImmutableTreeDebugView (line 170) | internal class ImmutableTreeDebugView<TValue>
method ImmutableTreeDebugView (line 174) | public ImmutableTreeDebugView(ImmutableTree<TValue> tree) { this.tree ...
method ImmutableTreeDebugView (line 533) | public ImmutableTreeDebugView(ImmutableTree<TKey, TValue> tree) { this...
class ImmutableTree (line 180) | [DebuggerTypeProxy(typeof(ImmutableTreeDebugView<,>))]
method ImmutableTree (line 23) | private ImmutableTree(int hash, TValue value, ImmutableTree<TValue> le...
method ImmutableTree (line 33) | private ImmutableTree(int hash, TValue value)
method ImmutableTree (line 43) | private ImmutableTree()
method GetOrDefault (line 46) | [MethodImpl(Constants.Inline)]
method AddOrUpdate (line 58) | public ImmutableTree<TValue> AddOrUpdate(int key, TValue value, Func<T...
method Remove (line 79) | public ImmutableTree<TValue> Remove(int key)
method Balance (line 98) | private static ImmutableTree<TValue> Balance(int hash, TValue value, I...
method RotateRight (line 114) | private static ImmutableTree<TValue> RotateRight(int hash, TValue valu...
method RotateLeft (line 120) | private static ImmutableTree<TValue> RotateLeft(int hash, TValue value...
method RotateRightLeft (line 126) | private static ImmutableTree<TValue> RotateRightLeft(int hash, TValue ...
method RotateLeftRight (line 133) | private static ImmutableTree<TValue> RotateLeftRight(int hash, TValue ...
method ToString (line 140) | public override string ToString() => this.IsEmpty ? "empty" : $"{this....
method Walk (line 143) | public IEnumerable<ReadOnlyKeyValue<int, TValue>> Walk()
method ImmutableTree (line 196) | private ImmutableTree(int hash, TKey key, TValue value, ImmutableTree<...
method ImmutableTree (line 209) | private ImmutableTree()
method ImmutableTree (line 212) | private ImmutableTree(int hash, TKey key, TValue value)
method AddOrUpdate (line 223) | public ImmutableTree<TKey, TValue> AddOrUpdate(TKey key, TValue value,...
method AddOrUpdate (line 226) | public ImmutableTree<TKey, TValue> AddOrUpdate(TKey key, TValue value,...
method UpdateIfExists (line 229) | public ImmutableTree<TKey, TValue> UpdateIfExists(TKey key, bool byRef...
method UpdateIfExists (line 232) | public ImmutableTree<TKey, TValue> UpdateIfExists(TKey key, TValue val...
method GetOrDefaultByValue (line 235) | [MethodImpl(Constants.Inline)]
method GetOrDefaultByRef (line 252) | [MethodImpl(Constants.Inline)]
method Remove (line 269) | public ImmutableTree<TKey, TValue> Remove(TKey key, bool byRef) =>
method AddOrUpdate (line 272) | private ImmutableTree<TKey, TValue> AddOrUpdate(int hash, TKey key, TV...
method UpdateIfExists (line 303) | private ImmutableTree<TKey, TValue> UpdateIfExists(int hash, TKey key,...
method UpdateIfExists (line 328) | private ImmutableTree<TKey, TValue> UpdateIfExists(int hash, TKey key,...
method Remove (line 354) | private ImmutableTree<TKey, TValue> Remove(int hash, TKey key, bool by...
method CheckCollision (line 391) | private ImmutableTree<TKey, TValue> CheckCollision(int hash, TKey key,...
method ReplaceInCollisionsIfExist (line 422) | private ImmutableTree<TKey, TValue> ReplaceInCollisionsIfExist(int has...
method ReplaceInCollisionsIfExist (line 438) | private ImmutableTree<TKey, TValue> ReplaceInCollisionsIfExist(int has...
method Balance (line 454) | private static ImmutableTree<TKey, TValue> Balance(int hash, TKey key,...
method RotateRight (line 470) | private static ImmutableTree<TKey, TValue> RotateRight(int hash, TKey ...
method RotateLeft (line 476) | private static ImmutableTree<TKey, TValue> RotateLeft(int hash, TKey k...
method RotateRightLeft (line 482) | private static ImmutableTree<TKey, TValue> RotateRightLeft(int hash, T...
method RotateLeftRight (line 489) | private static ImmutableTree<TKey, TValue> RotateLeftRight(int hash, T...
method ToString (line 496) | public override string ToString() => this.IsEmpty ? "empty" : $"{this....
method Walk (line 498) | public IEnumerable<ReadOnlyKeyValue<TKey, TValue>> Walk()
class ImmutableTreeDebugView (line 529) | internal class ImmutableTreeDebugView<TKey, TValue> where TKey : class
method ImmutableTreeDebugView (line 174) | public ImmutableTreeDebugView(ImmutableTree<TValue> tree) { this.tree ...
method ImmutableTreeDebugView (line 533) | public ImmutableTreeDebugView(ImmutableTree<TKey, TValue> tree) { this...
class ImmutableRefTree (line 539) | [DebuggerTypeProxy(typeof(ImmutableRefTreeDebugView<>))]
method ImmutableRefTree (line 554) | private ImmutableRefTree(int hash, TValue value, ImmutableRefTree<TVal...
method ImmutableRefTree (line 566) | private ImmutableRefTree()
method ImmutableRefTree (line 569) | private ImmutableRefTree(int hash, TValue value)
method AddOrSkip (line 579) | public ImmutableRefTree<TValue> AddOrSkip(TValue value) =>
method Remove (line 582) | public ImmutableRefTree<TValue> Remove(TValue value) =>
method AddOrUpdate (line 585) | private ImmutableRefTree<TValue> AddOrUpdate(int hash, TValue value)
method Remove (line 616) | private ImmutableRefTree<TValue> Remove(int hash, TValue value)
method CheckCollision (line 646) | private ImmutableRefTree<TValue> CheckCollision(int hash, TValue value)
method Balance (line 658) | private static ImmutableRefTree<TValue> Balance(int hash, TValue value...
method RotateRight (line 674) | private static ImmutableRefTree<TValue> RotateRight(int hash, TValue v...
method RotateLeft (line 680) | private static ImmutableRefTree<TValue> RotateLeft(int hash, TValue va...
method RotateRightLeft (line 686) | private static ImmutableRefTree<TValue> RotateRightLeft(int hash, TVal...
method RotateLeftRight (line 693) | private static ImmutableRefTree<TValue> RotateLeftRight(int hash, TVal...
method ToString (line 700) | public override string ToString() => this.IsEmpty ? "empty" : $"{this....
method Walk (line 702) | public IEnumerable<TValue> Walk()
class ImmutableRefTreeDebugView (line 733) | internal class ImmutableRefTreeDebugView<TValue> where TValue : class
method ImmutableRefTreeDebugView (line 737) | public ImmutableRefTreeDebugView(ImmutableRefTree<TValue> tree) { this...
FILE: src/Utils/Data/Pair.cs
class Pair (line 3) | internal class Pair<T1, T2>
method Pair (line 9) | public Pair(T1 item1, T2 item2)
FILE: src/Utils/Data/Stack.cs
class Stack (line 8) | internal class Stack<TValue> : ExpandableArray<TValue>
method FromEnumerable (line 10) | public static Stack<TValue> FromEnumerable(IEnumerable<TValue> enumera...
method Stack (line 13) | public Stack()
method Stack (line 16) | public Stack(IEnumerable<TValue> initial)
method Pop (line 20) | public TValue Pop()
method Front (line 30) | public TValue Front() => this.Length == 0 ? default : base.Repository[...
method PushBack (line 32) | public void PushBack(TValue item)
method PeekBack (line 48) | public TValue PeekBack() => this.Length == 0 ? default : this.Reposito...
method ReplaceBack (line 50) | public void ReplaceBack(TValue value) => this.Repository[0] = value;
FILE: src/Utils/Data/Tree.cs
class Tree (line 8) | [DebuggerTypeProxy(typeof(TreeDebugView<>))]
class Node (line 11) | private class Node
method Node (line 19) | public Node(int key, TValue value)
method Add (line 31) | public void Add(int key, TValue value)
method GetOrDefault (line 36) | [MethodImpl(Constants.Inline)]
method CalculateHeight (line 48) | private static int CalculateHeight(Node node)
method GetBalance (line 59) | private static int GetBalance(Node node)
method RotateLeft (line 70) | private static Node RotateLeft(Node node)
method RotateRight (line 84) | private static Node RotateRight(Node node)
method Add (line 98) | private static Node Add(Node? node, int key, TValue value)
method Walk (line 138) | public IEnumerable<TValue> Walk()
class TreeDebugView (line 215) | internal class TreeDebugView<TValue>
method TreeDebugView (line 219) | public TreeDebugView(Tree<TValue> tree) { this.tree = tree; }
FILE: src/Utils/Shield.cs
class Shield (line 9) | public static class Shield
method EnsureNotNull (line 17) | public static void EnsureNotNull<T>(T obj, string parameterName)
method EnsureNotNull (line 30) | public static void EnsureNotNull<T>(T obj, string parameterName, strin...
method EnsureNotNullOrEmpty (line 41) | public static void EnsureNotNullOrEmpty(string obj, string parameterName)
method EnsureGreaterThan (line 52) | public static void EnsureGreaterThan(int actual, int reference)
method EnsureTrue (line 63) | public static void EnsureTrue(bool condition, string message)
method EnsureTypeOf (line 74) | public static void EnsureTypeOf<TType>(object obj)
method EnsureTypeMapIsValid (line 80) | internal static void EnsureTypeMapIsValid(Type serviceType, Type imple...
method EnsureIsResolvable (line 88) | internal static void EnsureIsResolvable(Type implementationType)
method ThrowDisposedException (line 94) | internal static void ThrowDisposedException(string? name, string calle...
FILE: src/Utils/Swap.cs
class Swap (line 6) | internal static class Swap
method SwapValue (line 10) | public static bool SwapValue<T1, T2, T3, T4, TValue>(ref TValue refVal...
method RepeatSwap (line 24) | private static bool RepeatSwap<T1, T2, T3, T4, TValue>(ref TValue refV...
FILE: src/Utils/TypeCache.cs
class TypeCache (line 8) | internal static class TypeCache<TType>
method EmptyArray (line 29) | public static T[] EmptyArray<T>() => InternalArrayHelper<T>.Empty;
class InternalArrayHelper (line 31) | private static class InternalArrayHelper<T>
class TypeCache (line 13) | internal static class TypeCache
method EmptyArray (line 29) | public static T[] EmptyArray<T>() => InternalArrayHelper<T>.Empty;
class InternalArrayHelper (line 31) | private static class InternalArrayHelper<T>
FILE: test/ActivateTests.cs
class ActivateTests (line 7) | public class ActivateTests
method ActivateTests_Full (line 9) | [Fact]
method ActivateTests_Full_DepOverride (line 20) | [Fact]
method ActivateTests_Fail (line 32) | [Fact]
method ActivateTests_Fail_On_Scope (line 38) | [Fact]
type ITest (line 44) | interface ITest;
class Test (line 46) | class Test : ITest;
class Test1 (line 48) | class Test1
method Test1 (line 57) | public Test1(Test test)
method InjectMethod (line 62) | [InjectionMethod]
FILE: test/AssemblyTests.cs
class AssemblyTests (line 9) | public class AssemblyTests
method LoadTestAssembly (line 11) | [Fact]
method LoadTestAssembly_Just_Interfaces_And_Self (line 22) | [Fact]
method LoadTestAssembly_Just_Abstarct_And_Self (line 34) | [Fact]
method LoadTestAssembly_Just_Abstarct_Without_Self (line 46) | [Fact]
method RegistersTests_RegisterAssembly (line 59) | [Fact]
method RegistersTests_RegisterAssembly_AsSelf (line 70) | [Fact]
method RegistersTests_RegisterAssemblies (line 82) | [Fact]
method RegistersTests_RegisterAssemblies_AsSelf (line 98) | [Fact]
method RegistersTests_RegisterAssembly_Selector (line 114) | [Fact]
method RegistersTests_RegisterAssembly_Configurator (line 126) | [Fact]
method RegistersTests_RegisterAssembly_Configurator_AsSelf (line 142) | [Fact]
FILE: test/AsyncDisposeTests.cs
class AsyncDisposeTests (line 10) | public class AsyncDisposeTests
method Async_Dispose_Works (line 12) | [Fact]
method Async_Dispose_Multiple (line 25) | [Fact]
method Async_Dispose_Multiple_Scoped (line 38) | [Fact]
method Async_Dispose_Works_On_Scoped (line 53) | [Fact]
method Async_Dispose_Works_On_Singleton (line 69) | [Fact]
method Disposes_Either_Normal_And_Async (line 88) | [Fact]
method Prefers_Async_Disposable_Over_Normal (line 105) | [Fact]
method Async_Dispose_Works_On_Dependencies (line 118) | [Fact]
class A (line 139) | class A : AsyncDisposable, IDisposable
method Dispose (line 141) | public void Dispose()
class B (line 147) | class B : AsyncDisposable
method B (line 151) | public B(Disposable disposable)
class C (line 157) | class C : Disposable
method C (line 161) | public C(AsyncDisposable disposable)
class AsyncDisposable (line 167) | class AsyncDisposable : IAsyncDisposable
method DisposeAsync (line 173) | public ValueTask DisposeAsync()
class Disposable (line 182) | class Disposable : IDisposable
method Dispose (line 186) | public void Dispose()
FILE: test/AttributeTests.cs
class AttributeTest (line 9) | public class AttributeTest
method AttributeTests_Resolve (line 11) | [Fact]
method AttributeTests_Named_Resolution (line 41) | [Fact]
method AttributeTests_Parallel_Resolve (line 64) | [Fact]
method AttributeTests_Parallel_Lazy_Resolve (line 93) | [Fact]
method AttributeTests_InjectionMethod_WithoutMembers (line 129) | [Fact]
method AttributeTests_InjectionMethod_Private (line 139) | [Fact]
type ITest1 (line 149) | interface ITest1;
type ITest2 (line 151) | interface ITest2 { ITest1 test1 { get; set; } }
type ITest3 (line 153) | interface ITest3 { ITest2 test2 { get; set; } ITest1 test1 { get; set;...
type ITest4 (line 155) | interface ITest4 { Lazy<ITest2> test2 { get; set; } Lazy<ITest1> test1...
class Test1 (line 157) | class Test1 : ITest1;
class Test11 (line 159) | class Test11 : ITest1;
class Test12 (line 161) | class Test12 : ITest1;
class Test22 (line 163) | class Test22 : ITest2 { public ITest1 test1 { get; set; } }
class Test2 (line 165) | class Test2 : ITest2
method Test2 (line 169) | public Test2([Dependency("test11")] ITest1 test1)
class Test3 (line 176) | class Test3 : ITest3
method MethodTest (line 184) | [InjectionMethod]
method MethodTest2 (line 191) | [InjectionMethod]
method Test3 (line 198) | public Test3([Dependency("test12")] ITest1 test12, [Dependency("test...
class Test4 (line 211) | class Test4 : ITest4
method MethodTest (line 219) | [InjectionMethod]
method Test4 (line 226) | public Test4([Dependency("test12")] Lazy<ITest1> test1, [Dependency(...
class Test5 (line 238) | class Test5
method MethodTest (line 240) | [InjectionMethod]
class Test6 (line 249) | class Test6
method MethodTest (line 251) | [InjectionMethod]
FILE: test/BuildUpTests.cs
class BuildUpTests (line 8) | public class BuildUpTests
method BuildUpTests_BuildUp_Simple (line 10) | [Fact]
method BuildUpTests_BuildUp (line 20) | [Fact]
method BuildUpTests_BuildUp_As_InterfaceType (line 40) | [Fact]
method BuildUpTests_BuildUp_Scoped (line 51) | [Fact]
type ITest (line 75) | interface ITest : IDisposable { bool Disposed { get; } }
type ITest1 (line 77) | interface ITest1 { ITest Test { get; } }
type ITest3 (line 79) | interface ITest3;
class Test (line 81) | class Test : ITest
method Dispose (line 83) | public void Dispose()
class Test1 (line 94) | class Test1 : ITest1
method Init (line 99) | [InjectionMethod]
class Test2 (line 106) | class Test2
class Test3 (line 112) | class Test3 : ITest3
FILE: test/CanResolveTests.cs
class CanResolveTests (line 9) | public class CanResolveTests
method CanResolveTests_ExplicitService (line 11) | [Fact]
method CanResolveTests_OpenGeneric (line 21) | [Fact]
method CanResolveTests_ClosedGeneric (line 31) | [Fact]
method CanResolveTests_Wrapper (line 40) | [Fact]
method CanResolveTests_Enumerable (line 51) | [Fact]
method CanResolveTests_ExplicitService_Scope (line 61) | [Fact]
method CanResolveTests_OpenGeneric_Scope (line 71) | [Fact]
method CanResolveTests_ClosedGeneric_Scope (line 81) | [Fact]
method CanResolveTests_Wrapper_Scope (line 90) | [Fact]
method CanResolveTests_Enumerable_Scope (line 101) | [Fact]
method CanResolveTests_Special_Types (line 111) | [Fact]
method CanResolveTests_WithExceptionOverEmptyCollection (line 121) | [Fact]
type IA (line 132) | private interface IA;
class A (line 134) | private class A : IA;
type IB (line 136) | private interface IB<T>;
class B (line 138) | private class B<T> : IB<T>;
class C (line 141) | private class C(byte[] payload);
FILE: test/ChildContainerTests.cs
class ChildContainerTests (line 14) | public class ChildContainerTests
method ChildContainerTests_Dispose_Parent_Disposes_Child (line 16) | [Theory]
method ChildContainerTests_Dispose_Parent_Not_Disposes_Child (line 31) | [Theory]
method ChildContainerTests_Dispose_Parent_Disposes_Child_Async (line 52) | [Theory]
method ChildContainerTests_Dispose_Parent_Not_Disposes_Child_Async (line 67) | [Theory]
method ChildContainerTests_ResolveAll_Parent_Current (line 88) | [Theory]
method ChildContainerTests_ResolveAll_Scope_Parent_Current (line 102) | [Theory]
method ChildContainerTests_Resolve_Dependency_Parent_Current (line 116) | [Theory]
method ChildContainerTests_Resolve_Decorator_Parent_Current (line 162) | [Theory]
method ChildContainerTests_Resolve_Scope_Decorator_Parent_Current (line 184) | [Theory]
method ChildContainerTests_ResolveOrDefault_Decorator_Parent_Current (line 206) | [Theory]
method ChildContainerTests_ResolveOrDefault_Scope_Decorator_Parent_Current (line 228) | [Theory]
method ChildContainerTests_Resolve_Decorator_Child_Service_Parent (line 250) | [Theory]
method ChildContainerTests_Resolve_Decorator_Parent_Service_Child (line 264) | [Theory]
method ChildContainerTests_Resolve_Parent_Dependency (line 278) | [Theory]
method ChildContainerTests_Resolve_Parent_Enumerable_Dependency (line 295) | [Theory]
method ChildContainerTests_Resolve_Parent_Enumerable_Select_Dependency (line 309) | [Theory]
method ChildContainerTests_Resolve_PreferCurrent_Enumerable_Select_Dependency (line 328) | [Theory]
method ChildContainerTests_Resolve_Parent_Decorator_Dependency (line 371) | [Theory]
method ChildContainerTests_Resolve_Decorator_Enumerable_Parent_Current (line 388) | [Theory]
method ChildContainerTests_Get_NonExisting_Null (line 414) | [Fact]
method ChildContainerTests_Configure (line 422) | [Fact]
method ChildContainerTests_Configure_Dep (line 438) | [Fact]
method ChildContainerTests_Configure_Validate_Root_Throws (line 453) | [Fact]
method ChildContainerTests_Configure_Validate_Root_And_Tenants_Throws (line 465) | [Fact]
method ChildContainerTests_Configure_Validate_Valid (line 477) | [Fact]
method ChildContainerTests_Dispose (line 489) | [Fact]
method ChildContainerTests_Dispose_Tenant (line 506) | [Fact]
method ChildContainerTests_Dispose_Multiple (line 524) | [Fact]
method ChildContainerTests_Dispose_Removes_Child (line 534) | [Fact]
method ChildContainerTests_Dispose_Parent (line 553) | [Fact]
method ChildContainerTests_Dispose_Async (line 568) | [Fact]
method MultitenantTests_Dispose_Tenant_Async (line 585) | [Fact]
method MultitenantTests_Dispose_Multiple_Async (line 603) | [Fact]
method ChildContainerTests_Dispose_Removes_Child_Async (line 613) | [Fact]
type IT (line 633) | interface IT;
type IT2 (line 634) | interface IT2;
class T1 (line 636) | class T1 : IT;
class T2 (line 637) | class T2 : IT;
class T3 (line 638) | class T3 : IT;
class T4 (line 639) | class T4 : IT;
class T11 (line 641) | class T11 : IT2;
class T12 (line 642) | class T12 : IT2;
class T13 (line 643) | class T13 : IT2;
class T5 (line 645) | class T5 : IT
method T5 (line 648) | public T5(IEnumerable<IT> Dep) { this.Dep = Dep; }
class T6 (line 651) | class T6 : IT
method T6 (line 655) | public T6(IT Dep) { this.Dep = Dep; }
method Init (line 656) | public void Init(string id) => ID = id;
class D1 (line 659) | class D1
method D1 (line 663) | public D1(IT Dep) { this.Dep = Dep; }
method Init (line 664) | public void Init(string id) => ID = id;
class D2 (line 667) | class D2
method D2 (line 671) | public D2(IEnumerable<IT> Dep) { this.Dep = Dep; }
method Init (line 672) | public void Init(string id) => ID = id;
class D2_2 (line 675) | class D2_2
method D2_2 (line 679) | public D2_2(IEnumerable<IT2> Dep) { this.Dep = Dep; }
method Init (line 680) | public void Init(string id) => ID = id;
class Test (line 683) | class Test : IDisposable
method Dispose (line 687) | public void Dispose()
type IA (line 698) | interface IA;
class A (line 700) | class A : IA;
class B (line 702) | class B : IA;
class C (line 704) | class C : IA, IDisposable
method Dispose (line 708) | public void Dispose()
class D (line 717) | class D
method D (line 719) | public D(IA ia)
FILE: test/CircularDependencyTests.cs
class CircularDependencyTests (line 10) | public class CircularDependencyTests
method CircularDependencyTests_StandardResolve (line 12) | [Fact]
method CircularDependencyTests_StandardResolve_Exception_Override (line 22) | [Fact]
method CircularDependencyTests_StandardResolve_Parallel_ShouldNotThrow (line 31) | [Fact]
method CircularDependencyTests_DependencyProperty (line 42) | [Fact]
method CircularDependencyTests_InjectionMethod (line 50) | [Fact]
method CircularDependencyTests_Generic_StandardResolve (line 58) | [Fact]
method CircularDependencyTests_Generic_DependencyProperty (line 66) | [Fact]
method CircularDependencyTests_Generic_InjectionMethod (line 74) | [Fact]
method CircularDependencyTests_Func (line 82) | [Fact]
method CircularDependencyTests_Lazy (line 90) | [Fact]
method CircularDependencyTests_Tuple (line 98) | [Fact]
method CircularDependencyTests_Enumerable (line 106) | [Fact]
method CircularDependencyTests_Runtime (line 114) | [Fact]
method CircularDependencyTests_Runtime_Parameterized_Factory (line 122) | [Fact]
method CircularDependencyTests_Runtime_Async (line 131) | [Fact]
method CircularDependencyTests_Runtime_Async_Parameterized_Factory (line 139) | [Fact]
type ITest1 (line 148) | interface ITest1;
type ITest2 (line 150) | interface ITest2;
type ITest3 (line 152) | interface ITest3;
type ITest1 (line 154) | interface ITest1<I, K>;
class Test4 (line 156) | class Test4 : ITest1;
class Test1 (line 158) | class Test1<I, K> : ITest1<I, K>
method Test1 (line 160) | public Test1(ITest1<I, K> test1)
method Test1 (line 180) | public Test1(ITest1 test1)
class Test2 (line 165) | class Test2<I, K> : ITest1<I, K>
class Test3 (line 171) | class Test3<I, K> : ITest1<I, K>
method Inject (line 173) | [InjectionMethod]
method Inject (line 193) | [InjectionMethod]
class Test1 (line 178) | class Test1 : ITest1
method Test1 (line 160) | public Test1(ITest1<I, K> test1)
method Test1 (line 180) | public Test1(ITest1 test1)
class Test2 (line 185) | class Test2 : ITest1
class Test3 (line 191) | class Test3 : ITest1
method Inject (line 173) | [InjectionMethod]
method Inject (line 193) | [InjectionMethod]
class Test5 (line 198) | class Test5 : ITest1
method Test5 (line 200) | public Test5(Func<ITest1> test1)
class Test6 (line 205) | class Test6 : ITest1
method Test6 (line 207) | public Test6(Lazy<ITest1> test1)
class Test7 (line 212) | class Test7 : ITest1
method Test7 (line 214) | public Test7(Tuple<ITest1, object> test1)
class Test8 (line 219) | class Test8 : ITest1
method Test8 (line 221) | public Test8(IEnumerable<ITest1> test1)
FILE: test/CompilerTests/ConstantTests.cs
class ConstantTests (line 7) | public class ConstantTests
type FakeEnum (line 9) | enum FakeEnum { Default }
method Compile_Constant_Values (line 11) | [Theory]
FILE: test/CompilerTests/DefaultTests.cs
class DefaultTests (line 7) | public class DefaultTests
method Compile_Default_Values (line 9) | [Theory]
method Compile_DateTime_Default_Value (line 32) | [Fact]
method Compile_TimeSpan_Default_Value (line 41) | [Fact]
method Compile_Decimal_Default_Value (line 50) | [Fact]
FILE: test/CompilerTests/NullableTests.cs
class NullableTests (line 7) | public class NullableTests
method Compile_Nullable_Primitive (line 9) | [Fact]
method Compile_Nullable_Primitive_Null (line 18) | [Fact]
method Compile_Nullable_ValueType (line 27) | [Fact]
method Compile_Nullable_ValueType_Null (line 36) | [Fact]
FILE: test/ComplexResolution.cs
class ComplexResolution (line 7) | public class ComplexResolution
method Ensure_Complex_Resolution_Works (line 9) | [Theory]
class T1 (line 89) | class T1
method T1 (line 91) | public T1(T2 t2, Scoped1 scoped1, Scoped2 scoped2, Single1 single1)
class T2 (line 105) | class T2
method T2 (line 107) | public T2(T3 t3, T4 t4, Scoped1 scoped1, Scoped3 scoped3, Single1 si...
class T3 (line 125) | class T3
method T3 (line 127) | public T3(T4 t4, Scoped1 scoped1, Scoped3 scoped3, Single3 single3)
class T4 (line 141) | class T4;
class Scoped1 (line 143) | class Scoped1
method Scoped1 (line 145) | public Scoped1(T4 t4, Scoped2 scoped2, Func1 func1, Single1 single1)
class Scoped2 (line 159) | class Scoped2
method Scoped2 (line 161) | public Scoped2(T4 t4, Scoped3 scoped3, Func2 func2, Single2 single2,...
class Scoped3 (line 177) | class Scoped3;
class Single1 (line 179) | class Single1
method Single1 (line 181) | public Single1(Single2 single2, Single3 single3)
class Single2 (line 191) | class Single2
method Single2 (line 193) | public Single2(Single3 single3)
class Single3 (line 201) | class Single3;
class Func1 (line 203) | class Func1
method Func1 (line 205) | public Func1(T4 t4, Scoped3 scoped3, Single3 single3)
class Func2 (line 217) | class Func2
method Func2 (line 219) | public Func2(T4 t4, Single1 single1, Single2 single2)
FILE: test/CompositionTests.cs
class CompositionTests (line 9) | public class CompositionTests
method Composition_Test (line 11) | [Fact]
method Composition_Test_Generic (line 42) | [Fact]
method Composition_Test_MultipleDecorators (line 65) | [Fact]
method Composition_Test_MultipleDecorators_Factory (line 88) | [Fact]
method Composition_Test_MultipleDecorators_Non_Generic_Factory (line 115) | [Fact]
method Composition_Test_Enumerable (line 142) | [Fact]
method Composition_Test_Enumerable_MultipleDecorators (line 158) | [Fact]
method Composition_Test_Enumerable_Generic (line 176) | [Fact]
method Composition_Named_From_DifferentAssembly (line 191) | [Fact]
type IA (line 203) | interface IA;
type IB (line 205) | interface IB;
type IC (line 207) | interface IC;
type IG (line 209) | interface IG<T>;
type IG1 (line 211) | interface IG1<T>;
class A (line 213) | class A : IA;
class AA (line 215) | class AA : IA;
class B (line 217) | class B : IB;
class BB (line 219) | class BB : IB;
class C (line 221) | class C : IC;
class CC (line 223) | class CC : IC;
class G (line 225) | class G<T> : IG<T>;
class G1 (line 227) | class G1<T> : IG1<T>;
class GG (line 229) | class GG<T>/*WP*/ : IG<T>;
class D1 (line 231) | class D1 : IA, IB, IC
method D1 (line 233) | public D1(IA a, IB b, IC c)
class D2 (line 245) | class D2 : IA
method D2 (line 247) | public D2(IEnumerable<IA> a)
class D3 (line 255) | class D3<T> : IG<T>
method D3 (line 257) | public D3(IEnumerable<IG<T>> g)
class D4 (line 265) | class D4<T> : IG<T>, IG1<T>
method D4 (line 267) | public D4(IG<T> a, IG1<T> b)
class AD (line 277) | class AD : IA
method AD (line 279) | public AD(IA a)
class BD (line 287) | class BD : IB
method BD (line 289) | public BD(IB b)
class CD (line 297) | class CD : IC
method CD (line 299) | public CD(IC c)
FILE: test/ConditionalTests.cs
class ConditionalTests (line 7) | public class ConditionalTests
method ConditionalTests_ParentTypeCondition_First (line 9) | [Fact]
method ConditionalTests_ParentTypeCondition_When_First (line 24) | [Fact]
method ConditionalTests_ParentTypeCondition_First_NonGeneric (line 39) | [Fact]
method ConditionalTests_ParentTypeCondition_Second (line 54) | [Fact]
method ConditionalTests_ParentTypeCondition_Second_NonGeneric (line 69) | [Fact]
method ConditionalTests_ParentTypeCondition_Third (line 84) | [Fact]
method ConditionalTests_ParentTypeCondition_Third_NonGeneric (line 99) | [Fact]
method ConditionalTests_ParentTypeCondition_Third_WithName (line 114) | [Fact]
method ConditionalTests_ParentTypeCondition_Third_NonGenericWithName (line 130) | [Fact]
method ConditionalTests_AttributeCondition_First (line 146) | [Fact]
method ConditionalTests_AttributeCondition_First_NonGeneric (line 161) | [Fact]
method ConditionalTests_AttributeCondition_Second (line 176) | [Fact]
method ConditionalTests_AttributeCondition_Second_NonGeneric (line 191) | [Fact]
method ConditionalTests_AttributeCondition_Third (line 206) | [Fact]
method ConditionalTests_AttributeCondition_Third_NonGeneric (line 221) | [Fact]
method ConditionalTests_AttributeCondition_Third_WithName (line 236) | [Fact]
method ConditionalTests_AttributeCondition_Third_NonGeneric_WithName (line 252) | [Fact]
method ConditionalTests_Combined (line 268) | [Fact]
method ConditionalTests_Combined_Common (line 285) | [Fact]
method ConditionalTests_InResolutionPath (line 302) | [Fact]
method ConditionalTests_InResolutionPath_Attribute (line 315) | [Fact]
method ConditionalTests_InResolutionPath_WithName (line 328) | [Fact]
method ConditionalTests_InResolutionPath_Attribute_WithName (line 342) | [Fact]
type ITest1 (line 356) | interface ITest1;
type ITest2 (line 358) | interface ITest2 { ITest1 test1 { get; set; } ITest1 test12 { get; set...
class Dummy (line 360) | class Dummy;
class Test1 (line 362) | class Test1 : ITest1;
class Test11 (line 364) | class Test11 : ITest1;
class Test12 (line 366) | class Test12 : ITest1;
class Test13 (line 368) | class Test13 : ITest1
method Test13 (line 370) | public Test13(Dummy dummy)
class Test2 (line 378) | class Test2 : ITest2
method Test2 (line 384) | public Test2(ITest1 test12)
class Test3 (line 390) | class Test3 : ITest2
method Test3 (line 397) | public Test3([TestCondition2] ITest1 test12)
class Test4 (line 403) | class Test4
method Test4 (line 405) | public Test4(ITest1 test)
class Test5 (line 413) | class Test5
method Test5 (line 415) | public Test5(ITest1 test)
class Test6 (line 423) | class Test6
method Test6 (line 425) | public Test6([TestCondition]ITest1 test)
class TestConditionAttribute (line 433) | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | ...
class TestCondition2Attribute (line 436) | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | ...
FILE: test/ConfigurationTests.cs
class ConfigurationTests (line 6) | public class ConfigurationTests
method Ensure_Unknown_Type_Configurations_Working (line 8) | [Fact]
method Ensure_Auto_Member_Injection_Configurations_Working (line 23) | [Fact]
method Ensure_Feature_Configurations_Working (line 45) | [Fact]
method Ensure_Configuration_Change_Does_Not_Affect_Parent (line 91) | [Fact]
FILE: test/ConstructorSelectionTests.cs
class ConstructorSelectionTests (line 6) | public class ConstructorSelectionTests
method ConstructorSelectionTests_ArgTypes (line 8) | [Fact]
method ConstructorSelectionTests_Args (line 16) | [Fact]
method ConstructorSelectionTests_ArgTypes_Throws_ResolutionFailed (line 30) | [Fact]
method ConstructorSelectionTests_ArgTypes_Throws_MissingConstructor (line 40) | [Fact]
method ConstructorSelectionTests_Args_Throws_MissingConstructor (line 47) | [Fact]
method ConstructorSelectionTests_Args_Throws_MissingConstructor_OneParam (line 55) | [Fact]
method ConstructorSelectionTests_Args_Throws_MissingConstructor_MoreParams (line 63) | [Fact]
method ConstructorSelectionTests_Decorator_ArgTypes (line 72) | [Fact]
method ConstructorSelectionTests_Decorator_Args (line 82) | [Fact]
method ConstructorSelectionTests_Arg_ByInterface (line 96) | [Fact]
class Dep (line 110) | class Dep;
class Dep2 (line 112) | class Dep2;
class Dep3 (line 114) | class Dep3;
class DepDecorator (line 116) | class DepDecorator : Dep
method DepDecorator (line 121) | public DepDecorator(Dep dep)
method DepDecorator (line 126) | public DepDecorator(Dep dep, Dep2 dep2)
method DepDecorator (line 132) | public DepDecorator(Dep dep, Dep2 dep2, Dep3 dep3)
class Test (line 138) | class Test
method Test (line 143) | public Test(Dep dep)
method Test (line 148) | public Test(Dep dep, Dep2 dep2)
method Test (line 154) | public Test(Dep dep, Dep2 dep2, Dep3 dep3)
type IArg (line 160) | interface IArg;
type IArg1 (line 162) | interface IArg1;
class Arg (line 164) | class Arg : IArg;
class Arg1 (line 166) | class Arg1 : IArg1;
class Test1 (line 168) | class Test1
method Test1 (line 173) | public Test1(IArg arg, IArg1 arg1)
FILE: test/ContainerTests.cs
class ContainerTests (line 14) | public class ContainerTests
method ContainerTests_ChildContainer (line 16) | [Fact]
method ContainerTests_ChildContainer_ResolveFromParent (line 33) | [Fact]
method ContainerTests_Validate_MissingDependency (line 47) | [Fact]
method ContainerTests_Validate_CircularDependency (line 56) | [Fact]
method ContainerTests_Validate_Ok (line 66) | [Fact]
method ContainerTests_Validate_Skips_Open_Generic (line 75) | [Fact]
method ContainerTests_Validate_Throws_When_No_Public_Constructor_Found (line 83) | [Fact]
method ContainerTests_Validate_Throws_Multiple (line 92) | [Fact]
method ContainerTests_Ensure_Validate_Does_Not_Build_Singletons (line 105) | [Fact]
method ContainerTests_CheckRegistration (line 120) | [Fact]
method ContainerTests_CanResolve (line 135) | [Fact]
method ContainerTests_IsRegistered (line 163) | [Fact]
method ContainerTests_IsRegistered_VariableName (line 184) | [Fact]
method ContainerTests_IsRegistered_OpenGeneric (line 194) | [Fact]
method ContainerTests_ResolverTest (line 205) | [Fact]
method ContainerTests_ResolverTest_SupportsMany (line 215) | [Fact]
method ContainerTests_ResolverTest_Null_Context_DoesNot_Break (line 225) | [Fact]
method ContainerTests_UnknownType_Config (line 238) | [Fact]
method ContainerTests_ChildContainer_Singleton (line 253) | [Fact]
method ContainerTests_ChildContainer_Scoped (line 268) | [Fact]
method ContainerTests_ConfigurationChanged (line 283) | [Fact]
method ContainerTests_ConfigurationChange_Null (line 293) | [Fact]
method ContainerTests_Configuration_DuplicatedBehavior_Throws (line 299) | [Fact]
method ContainerTests_Configuration_DuplicatedBehavior_Does_Not_Throw_On_Replace (line 308) | [Fact]
method ContainerTests_Configuration_DuplicatedBehavior_Does_Not_Throw_On_Replace_Only_If_Exists (line 319) | [Fact]
method ContainerTests_Configuration_DuplicatedBehavior_Does_Not_Throw_On_Different_Implementation (line 330) | [Fact]
method ContainerTests_Configuration_DuplicatedBehavior_Skip (line 341) | [Fact]
method ContainerTests_Configuration_DuplicatedBehavior_Preserve (line 353) | [Fact]
method ContainerTests_Diagnostics_Print (line 363) | [Fact]
method ContainerTests_Diagnostics_Generic_Print (line 373) | [Fact]
method ContainerTests_Cache_Diag (line 386) | [Fact]
method ContainerTests_Configuration_DuplicatedBehavior_Preserve_Cache_Invalidates (line 415) | [Fact]
method ContainerTests_Configuration_DuplicatedBehavior_Replace (line 431) | [Fact]
method ContainerTests_Throws_When_TypeMap_Invalid (line 443) | [Fact]
method ContainerTests_ChildContainer_Rebuild_Singletons_In_Child (line 453) | [Fact]
method ContainerTests_ChildContainer_Rebuild_Singletons_In_Child_Deps (line 479) | [Fact]
method ContainerTests_ChildContainer_Rebuild_Singletons_In_Child_Deps_Config_On_Child (line 499) | [Fact]
method ContainerTests_Throws_Disposed_Exceptions (line 519) | [Fact]
type ITest1 (line 578) | interface ITest1;
type ITest2 (line 580) | interface ITest2;
type ITest3 (line 582) | interface ITest3;
type ITest5 (line 584) | interface ITest5
class Test1 (line 592) | class Test1 : ITest1;
class Test11 (line 594) | class Test11 : ITest1;
class Test2 (line 596) | class Test2 : ITest2
method Test2 (line 598) | public Test2(ITest1 test1)
class Test3 (line 606) | class Test3 : ITest3
method Test3 (line 608) | public Test3(ITest1 test1, ITest2 test2)
class Test4 (line 613) | class Test4 : ITest1
method Test4 (line 615) | public Test4(ITest3 test3)
class Test5 (line 621) | class Test5 : ITest5
method Test5 (line 623) | public Test5(Func<ITest2> func, Lazy<ITest2> lazy, IEnumerable<ITest...
class TestResolver (line 637) | class TestResolver : IServiceResolver
method CanUseForResolution (line 639) | public bool CanUseForResolution(TypeInformation typeInfo, Resolution...
method GetExpression (line 644) | public ServiceContext GetExpression(
class TestResolver2 (line 653) | class TestResolver2 : IEnumerableSupportedResolver
method CanUseForResolution (line 655) | public bool CanUseForResolution(TypeInformation typeInfo, Resolution...
method GetExpression (line 660) | public ServiceContext GetExpression(
method GetExpressionsForEnumerableRequest (line 668) | public IEnumerable<ServiceContext> GetExpressionsForEnumerableRequest(
class S (line 677) | class S { public int Id { get; set; } }
class TestOpenGeneric (line 679) | class TestOpenGeneric<T>;
class NoPublicConstructor (line 681) | class NoPublicConstructor
method NoPublicConstructor (line 683) | protected NoPublicConstructor() { }
FILE: test/DataTests/TreeTests.cs
class TreeTests (line 10) | public class TreeTests
method Test_Collision_Check (line 12) | [Fact]
method Test_Ref_Collision_Check (line 55) | [Fact]
method Test_Remove_Keep_Collisions (line 97) | [Fact]
method Test_Collision_Remove (line 135) | [Fact]
class A (line 173) | private class A;
class B (line 174) | private class B;
class C (line 175) | private class C;
class H1 (line 177) | private class H1
method GetHashCode (line 179) | public override int GetHashCode()
class H2 (line 185) | private class H2
method GetHashCode (line 187) | public override int GetHashCode()
class H3 (line 193) | private class H3
method GetHashCode (line 195) | public override int GetHashCode()
FILE: test/DecoratorTests.cs
class DecoratorTests (line 14) | public class DecoratorTests
method DecoratorTests_Simple (line 16) | [Theory]
method DecoratorTests_Simple2 (line 32) | [Theory]
method DecoratorTests_Simple3 (line 48) | [Theory]
method DecoratorTests_Simple_Lazy (line 64) | [Theory]
method DecoratorTests_Simple_Func (line 80) | [Theory]
method DecoratorTests_Simple_Enumerable (line 96) | [Theory]
method DecoratorTests_Decorator_Holds_Lazy (line 124) | [Theory]
method DecoratorTests_Decorator_Holds_Func (line 140) | [Theory]
method DecoratorTests_Decorator_Holds_Enumerable (line 156) | [Theory]
method DecoratorTests_Dependency (line 176) | [Theory]
method DecoratorTests_Inject_Member_With_Config (line 192) | [Theory]
method DecoratorTests_Inject_Member_With_Config_Non_Generic_Implementation (line 208) | [Theory]
method DecoratorTests_AutoMemberInjection_Throw_When_Member_Unresolvable (line 224) | [Theory]
method DecoratorTests_AutoMemberInjection_InjectionParameter (line 234) | [Theory]
method DecoratorTests_AutoMemberInjection_InjectionParameter_Fluent (line 253) | [Theory]
method DecoratorTests_ConstructorSelection_LeastParameters (line 272) | [Fact]
method DecoratorTests_ConstructorSelection_MostParameters (line 286) | [Fact]
method DecoratorTests_Multiple (line 301) | [Theory]
method DecoratorTests_Multiple_Scoped (line 321) | [Theory]
method DecoratorTests_OpenGeneric (line 343) | [Theory]
method DecoratorTests_DecoratorDependency_Null (line 359) | [Fact]
method DecoratorTests_DecoreteeDependency_Null (line 371) | [Fact]
method DecoratorTests_Disposed (line 383) | [Theory]
method DecoratorTests_Disposed_OnlyDecoreteeDisposal (line 403) | [Theory]
method DecoratorTests_Disposed_BothDisposal (line 423) | [Theory]
method DecoratorTests_ReplaceDecorator (line 443) | [Theory]
method DecoratorTests_RemapDecorator (line 464) | [Theory]
method DecoratorTests_RemapDecorator_V2 (line 487) | [Theory]
method DecoratorTests_RemapDecorator_WithConfig (line 510) | [Theory]
method DecoratorTests_Service_ImplementationType (line 533) | [Fact]
method DecoratorTests_Conditional (line 544) | [Theory]
method DecoratorTests_Enumerable (line 565) | [Theory]
method DecoratorTests_Conditional_Named (line 585) | [Theory]
method DecoratorTests_Conditional_Named_Short (line 606) | [Theory]
method DecoratorTests_Conditional_Parent (line 627) | [Theory]
method DecoratorTests_Conditional_Attribute (line 647) | [Theory]
method DecoratorTests_Conditional_Attribute_Multiple (line 667) | [Theory]
method DecoratorTests_Conditional_Attribute_Multiple_Scoped (line 688) | [Theory]
method DecoratorTests_Different_Lifetime (line 709) | [Theory]
method DecoratorTests_Inheriting_Lifetime (line 727) | [Theory]
method DecoratorTests_Different_Decoretees (line 742) | [Theory]
method DecoratorTests_Different_Decoretees_Indirect (line 760) | [Theory]
method DecoratorTests_Different_Decoretees_Indirect2 (line 777) | [Theory]
method DecoratorTests_NamedScope (line 795) | [Theory]
method DecoratorTests_NamedScope_Different_Decoretee (line 817) | [Theory]
method DecoratorTests_Factory (line 840) | [Theory]
method DecoratorTests_Factory_Generic (line 856) | [Theory]
method DecoratorTests_Target_Attribute (line 872) | [Theory]
method DecoratorTests_InjectMember (line 894) | [Theory]
method DecoratorTests_InjectMember_AttributeLess (line 908) | [Theory]
method DecoratorTests_WithFinalizer (line 922) | [Theory]
method DecoratorTests_Factory_Param1 (line 937) | [Theory]
method DecoratorTests_Factory_Param_NextDecorator (line 951) | [Theory]
method DecoratorTests_Factory_Param2 (line 966) | [Theory]
method DecoratorTests_Factory_Param3 (line 982) | [Theory]
method DecoratorTests_Factory_Param4 (line 999) | [Theory]
method DecoratorTests_Factory_Param5 (line 1017) | [Theory]
method DecoratorTests_NonGeneric_Factory_Param1 (line 1036) | [Theory]
method DecoratorTests_NonGeneric_Factory_Param_NextDecorator (line 1050) | [Theory]
method DecoratorTests_NonGeneric_Factory_Param2 (line 1065) | [Theory]
method DecoratorTests_NonGeneric_Factory_Param3 (line 1081) | [Theory]
method DecoratorTests_NonGeneric_Factory_Param4 (line 1098) | [Theory]
method DecoratorTests_NonGeneric_Factory_Param5 (line 1116) | [Theory]
method DecoratorTests_Compositor_Works (line 1135) | [Fact]
method DecoratorTests_Compositor_ChildContainer (line 1150) | [Fact]
type IT1 (line 1168) | interface IT1;
type IT2 (line 1170) | interface IT2;
type IT3 (line 1172) | interface IT3;
type IT4 (line 1174) | interface IT4;
type IT5 (line 1176) | interface IT5;
class TComp (line 1178) | class TComp : IT1, IT2, IT3, IT4, IT5;
type ITest1 (line 1181) | interface ITest1 { ITest1 Test { get; } }
type ITest2 (line 1183) | interface ITest2 { ITest2 Test2 { get; } }
type IDecoratorDep (line 1185) | interface IDecoratorDep;
type IDep (line 1187) | interface IDep;
type ITest1 (line 1189) | interface ITest1<T> { ITest1<T> Test { get; } }
type IDisp (line 1191) | interface IDisp : IDisposable
class Test1 (line 1198) | class Test1 : ITest1
class T2 (line 1203) | class T2 : ITest2
class T3 (line 1208) | class T3 : ITest2
class T4 (line 1216) | class T4 : ITest1
class Test11 (line 1224) | class Test11 : ITest1
class Test12 (line 1229) | class Test12 : ITest1
method Test12 (line 1233) | public Test12(IDep dep)
class Test13 (line 1239) | class Test13 : ITest1
class TestDisp (line 1244) | class TestDisp : IDisp
method Dispose (line 1246) | public void Dispose()
class TestDispDecorator (line 1258) | class TestDispDecorator : IDisp
method TestDispDecorator (line 1260) | public TestDispDecorator(IDisp disp)
method Dispose (line 1265) | public void Dispose()
class Test1 (line 1277) | class Test1<T> : ITest1<T>
class TestDecorator1 (line 1282) | class TestDecorator1<T> : ITest1<T>
method TestDecorator1 (line 1286) | public TestDecorator1(ITest1<T> test1)
method TestDecorator1 (line 1296) | public TestDecorator1(ITest1 test1)
class TestDecorator1 (line 1292) | class TestDecorator1 : ITest1
method TestDecorator1 (line 1286) | public TestDecorator1(ITest1<T> test1)
method TestDecorator1 (line 1296) | public TestDecorator1(ITest1 test1)
class TestDecorator2 (line 1302) | class TestDecorator2 : ITest1
method TestDecorator2 (line 1306) | public TestDecorator2(ITest1 test1)
class TestDecorator3 (line 1312) | class TestDecorator3 : ITest1
class TestDecorator14 (line 1318) | class TestDecorator14 : ITest1
class TestDecorator3Attributeless (line 1324) | class TestDecorator3Attributeless : ITest1
class TestDecorator4 (line 1329) | class TestDecorator4 : ITest1
class TestDecorator5 (line 1336) | class TestDecorator5 : ITest1
method TestDecorator5 (line 1340) | public TestDecorator5()
method TestDecorator5 (line 1343) | public TestDecorator5(ITest1 test1)
class TestDecorator6 (line 1349) | class TestDecorator6 : ITest1
method TestDecorator6 (line 1353) | public TestDecorator6(Lazy<ITest1> test1)
class TestDecorator7 (line 1359) | class TestDecorator7 : ITest1
method TestDecorator7 (line 1363) | public TestDecorator7(Func<ITest1> test1)
class TestDecorator8 (line 1369) | class TestDecorator8 : ITest1
method TestDecorator8 (line 1374) | public TestDecorator8(IEnumerable<ITest1> test1)
class TestDecorator9 (line 1381) | class TestDecorator9 : ITest1
method TestDecorator9 (line 1385) | public TestDecorator9(ITest1 test1, IDecoratorDep dep)
class TestDecorator10 (line 1391) | class TestDecorator10 : ITest2
method TestDecorator10 (line 1396) | public TestDecorator10(ITest2 test2, ITest1 test1)
class TestDecorator11 (line 1403) | class TestDecorator11 : ITest2
method TestDecorator11 (line 1407) | public TestDecorator11(ITest2 test2)
class TestDecorator12 (line 1413) | class TestDecorator12 : ITest2
method TestDecorator12 (line 1417) | public TestDecorator12(ITest1 test1)
class TestDecorator13 (line 1423) | class TestDecorator13 : ITest1
class TestHolder1 (line 1431) | class TestHolder1
class TestHolder2 (line 1437) | class TestHolder2
class TestHolder3 (line 1443) | class TestHolder3
class Decorator1Attribute (line 1452) | class Decorator1Attribute : Attribute;
class Decorator2Attribute (line 1454) | class Decorator2Attribute : Attribute;
class Decorator3Attribute (line 1456) | class Decorator3Attribute : Attribute;
class TestService (line 1458) | [Decorator1]
FILE: test/DependencyBindingTests.cs
class DependencyBindingTests (line 6) | public class DependencyBindingTests
method DependencyBindingTests_Bind_To_The_Same_Type (line 8) | [Fact]
method DependencyBindingTests_Bind_To_Different_Types (line 24) | [Fact]
method DependencyBindingTests_Override_Typed_Bindings (line 43) | [Fact]
method DependencyBindingTests_Override_Typed_Bindings_Injection_Method (line 61) | [Fact]
type ITest1 (line 79) | interface ITest1;
class Test1 (line 81) | class Test1 : ITest1;
class Test11 (line 83) | class Test11 : ITest1;
class Test12 (line 85) | class Test12 : ITest1;
class Test (line 87) | class Test
method Test (line 93) | public Test(ITest1 test1, ITest1 test2, ITest1 test3)
class TestMethodInjection (line 101) | class TestMethodInjection
method Init (line 107) | [InjectionMethod]
FILE: test/DisposeOrderTests.cs
class DisposeOrderTests (line 7) | public class DisposeOrderTests
method Ensure_Services_Are_Disposed_In_The_Right_Order (line 9) | [Fact]
method Ensure_Services_Are_Disposed_In_The_Right_Order_InScope (line 29) | [Fact]
class DisposableObj1 (line 51) | private class DisposableObj1 : IDisposable
method DisposableObj1 (line 55) | public DisposableObj1(IList<IDisposable> disposables)
method Dispose (line 60) | public void Dispose()
class DisposableObj2 (line 66) | private class DisposableObj2 : IDisposable
method DisposableObj2 (line 71) | public DisposableObj2(IList<IDisposable> disposables, DisposableObj1...
method Dispose (line 77) | public void Dispose()
class DisposableObj3 (line 83) | private class DisposableObj3 : IDisposable
method DisposableObj3 (line 89) | public DisposableObj3(IList<IDisposable> disposables, DisposableObj2...
method Dispose (line 96) | public void Dispose()
FILE: test/DisposeTests.cs
class DisposeTests (line 9) | public class DisposeTests
method DisposeTests_Singleton (line 11) | [Fact]
method DisposeTests_Singleton_WithoutDisposal (line 32) | [Fact]
method DisposeTests_Instance (line 53) | [Fact]
method DisposeTests_Instance_WithoutDisposal (line 73) | [Fact]
method DisposeTests_Instance_AsObject_WithoutDisposal (line 93) | [Fact]
method DisposeTests_Instance_WithoutDisposal_Fluent (line 113) | [Fact]
method DisposeTests_WireUp (line 133) | [Fact]
method DisposeTests_TrackTransientDisposal (line 153) | [Fact]
method DisposeTests_Scoped (line 174) | [Fact]
method DisposeTests_PutInScope_RootScope (line 216) | [Fact]
method DisposeTests_PutInScope_RootScope_WithoutDispose (line 239) | [Fact]
method DisposeTests_PutInScope_Scoped (line 262) | [Fact]
method DisposeTests_PutInScope_WithoutDispose (line 312) | [Fact]
method DisposeTests_PutInScope_Named (line 337) | [Fact]
method DisposeTests_Scoped_Factory (line 362) | [Fact]
method DisposeTests_Scoped_WithoutDisposal (line 401) | [Fact]
method DisposeTests_TrackTransientDisposal_Scoped_Transient (line 440) | [Fact]
method DisposeTests_TrackTransientDisposal_Scoped_Transient_Factory (line 477) | [Fact]
method DisposeTests_TrackTransientDisposal_Scoped_Transient_TrackingDisabled (line 514) | [Fact]
method DisposeTests_TrackTransientDisposal_ScopeOfScope_Transient (line 551) | [Fact]
method DisposeTests_TrackTransientDisposal_Scoped_Transient_ChildContainer (line 594) | [Fact]
method DisposeTests_TrackTransientDisposal_Scoped_Transient_Singleton (line 619) | [Fact]
method DisposeTests_TrackTransientDisposal_Implementation_Has_Disposable (line 655) | [Fact]
method DisposeTests_Instance_TrackTransient (line 671) | [Fact]
method DisposeTests_WireUp_TrackTransient (line 685) | [Fact]
method DisposeTests_WireUp_TrackTransient_WithoutDisposal (line 699) | [Fact]
method DisposeTests_Factory (line 713) | [Fact]
method DisposeTests_Factory_TrackTransient (line 726) | [Fact]
method DisposeTests_Factory_Scoped (line 739) | [Fact]
method DisposeTests_Factory_Scoped_WithoutTracking (line 754) | [Fact]
method DisposeTests_Multiple_Dispose_Call (line 772) | [Fact]
method DisposeTests_Scoped_Multiple_Dispose_Call (line 785) | [Fact]
method DisposeTests_Scope_Removed_From_Parent (line 799) | [Fact]
type ITest11 (line 830) | interface ITest11;
type ITest12 (line 832) | interface ITest12;
type ITest1 (line 834) | interface ITest1 : ITest11, ITest12, IDisposable { bool Disposed { get...
type ITest2 (line 836) | interface ITest2 { ITest1 Test1 { get; } }
class Test1 (line 838) | class Test1 : ITest1
method Dispose (line 842) | public void Dispose()
class Test2 (line 853) | class Test2 : ITest2
method Test2 (line 857) | public Test2(ITest1 test1)
class Test3 (line 863) | class Test3
class Test4 (line 869) | class Test4 : ITest11, IDisposable
method Dispose (line 873) | public void Dispose()
class Test5 (line 884) | class Test5
FILE: test/EnumerableTests.cs
class EnumerableTests (line 11) | public class EnumerableTests
method EnumerableTests_Resolve_Array_PreserveOrder (line 13) | [Fact]
method EnumerableTests_Resolve_IList (line 26) | [Fact]
method EnumerableTests_Resolve_ICollection (line 39) | [Fact]
method EnumerableTests_Resolve_IReadonlyCollection (line 52) | [Fact]
method EnumerableTests_Resolve_IReadOnlyList (line 65) | [Fact]
method EnumerableTests_Resolve (line 78) | [Fact]
method EnumerableTests_Resolve_Null (line 98) | [Fact]
method EnumerableTests_Resolve_Scoped_Null (line 110) | [Fact]
method EnumerableTests_Resolve_Scoped (line 124) | [Fact]
method EnumerableTests_Resolve_Parent (line 139) | [Fact]
method EnumerableTests_Resolve_Parent_Null (line 154) | [Fact]
method EnumerableTests_Resolve_Scoped_Lazy (line 166) | [Fact]
method EnumerableTests_Resolve_Parent_Lazy (line 181) | [Fact]
method EnumerableTests_Resolve_Scoped_Lazy_Null (line 196) | [Fact]
method EnumerableTests_Resolve_Parent_Lazy_Null (line 208) | [Fact]
method EnumerableTests_Resolve_Scoped_Func (line 220) | [Fact]
method EnumerableTests_Resolve_Parent_Func (line 235) | [Fact]
method EnumerableTests_Resolve_Scoped_Func_Null (line 250) | [Fact]
method EnumerableTests_Resolve_Parent_Func_Null (line 262) | [Fact]
method EnumerableTests_Resolve_Lazy (line 274) | [Fact]
method EnumerableTests_Resolve_Lazy_Null (line 287) | [Fact]
method EnumerableTests_Resolve_Func (line 297) | [Fact]
method EnumerableTests_Resolve_Func_Null (line 310) | [Fact]
method EnumerableTests_ResolveNonGeneric (line 320) | [Fact]
method EnumerableTests_ResolveNonGeneric_Scoped (line 342) | [Fact]
method EnumerableTests_Parallel_Resolve (line 366) | [Fact]
method EnumerableTests_Parallel_Resolve_NonGeneric (line 386) | [Fact]
method EnumerableTests_Resolve_PreserveOrder (line 409) | [Fact]
method EnumerableTests_ResolveAll_PreserveOrder (line 424) | [Fact]
method EnumerableTests_Resolve_PreserveOrder_Scoped (line 439) | [Fact]
method EnumerableTests_Resolve_PreserveOrder_Parent (line 457) | [Fact]
method EnumerableTests_Resolve_PreserveOrder_Scoped_Lazy (line 475) | [Fact]
method EnumerableTests_Resolve_PreserveOrder_Parent_Lazy (line 493) | [Fact]
method EnumerableTests_Resolve_PreserveOrder_Scoped_Func (line 511) | [Fact]
method EnumerableTests_Resolve_PreserveOrder_Parent_Func (line 529) | [Fact]
method EnumerableTests_Resolve_PreserveOrder_Lazy (line 547) | [Fact]
method EnumerableTests_Resolve_PreserveOrder_Func (line 562) | [Fact]
method EnumerableTests_Resolve_UniqueIds (line 577) | [Fact]
method EnumerableTests_Resolve_WithName (line 589) | [Fact]
method EnumerableTests_Resolve_WithName_Single (line 604) | [Fact]
method EnumerableTests_Resolve_WithName_FromCache (line 615) | [Fact]
method EnumerableTests_ResolveAll_Generic_WithName (line 636) | [Fact]
method EnumerableTests_ResolveAll_Generic_WithName_FromCache (line 651) | [Fact]
method EnumerableTests_ResolveAll_WithName (line 672) | [Fact]
method EnumerableTests_ResolveAll_WithName_FromCache (line 687) | [Fact]
method EnumerableTests_ResolveAll_PerRequest_WithName (line 708) | [Fact]
method EnumerableTests_Scope_Resolve_WithName (line 723) | [Fact]
method EnumerableTests_Scope_Resolve_WithName_FromCache (line 738) | [Fact]
method EnumerableTests_Scope_ResolveAll_Generic_WithName (line 759) | [Fact]
method EnumerableTests_Scope_ResolveAll_Generic_WithName_FromCache (line 774) | [Fact]
method EnumerableTests_Scope_ResolveAll_WithName (line 795) | [Fact]
method EnumerableTests_Scope_ResolveAll_WithName_FromCache (line 810) | [Fact]
method EnumerableTests_Scope_ResolveAll_PerRequest_WithName (line 831) | [Fact]
method EnumerableTests_ResolveAll_WithName_WithOverrides (line 846) | [Fact]
method EnumerableTests_ResolveAll_Generic_WithName_WithOverrides (line 860) | [Fact]
type ITest1 (line 874) | interface ITest1;
type ITest2 (line 876) | interface ITest2;
type ITest3 (line 878) | interface ITest3 { ITest1 Test { get; } }
class Test1 (line 880) | class Test1 : ITest1;
class Test11 (line 882) | class Test11 : ITest1;
class Test12 (line 884) | class Test12 : ITest1;
class Test2 (line 886) | class Test2 : ITest2
method Test2 (line 888) | public Test2(IEnumerable<ITest1> tests)
class Test22 (line 895) | class Test22 : ITest2
method Test22 (line 897) | public Test22(ITest1[] tests)
class Test31 (line 904) | class Test31 : ITest3
method Test31 (line 908) | public Test31(ITest1 test)
class Test32 (line 914) | class Test32 : ITest3
method Test32 (line 918) | public Test32(ITest1 test)
class Test33 (line 924) | class Test33 : ITest3
method Test33 (line 928) | public Test33(ITest1 test)
FILE: test/FactoryTests.cs
class FactoryTests (line 11) | public class FactoryTests
method FactoryTests_DependencyResolve (line 13) | [Theory]
method FactoryTests_DependencyResolve_ServiceUpdated (line 27) | [Theory]
method FactoryTests_Resolve (line 41) | [Theory]
method FactoryTests_Resolve_NotSame (line 55) | [Theory]
method FactoryTests_Resolve_ContainerFactory (line 74) | [Theory]
method FactoryTests_Resolve_ContainerFactory_Constructor (line 87) | [Theory]
method FactoryTests_Resolve_ContainerFactory_Initializer (line 100) | [Theory]
method FactoryTests_Resolve_Gets_The_Proper_Scope (line 112) | [Theory]
method FactoryTests_Resolve_With_Param1 (line 126) | [Theory]
method FactoryTests_Resolve_With_Param2 (line 142) | [Theory]
method FactoryTests_Resolve_With_Param3 (line 159) | [Theory]
method FactoryTests_Resolve_With_Param4 (line 177) | [Theory]
method FactoryTests_Resolve_With_Param5 (line 196) | [Theory]
method FactoryTests_Resolve_With_Param_With_Resolver (line 216) | [Theory]
method FactoryTests_NonGeneric_Resolve_Gets_The_Proper_Scope (line 233) | [Theory]
method FactoryTests_NonGeneric_Resolve_With_Param1 (line 247) | [Theory]
method FactoryTests_NonGeneric_Resolve_With_Param2 (line 263) | [Theory]
method FactoryTests_NonGeneric_Resolve_With_Param3 (line 280) | [Theory]
method FactoryTests_NonGeneric_Resolve_With_Param4 (line 298) | [Theory]
method FactoryTests_NonGeneric_Resolve_With_Param5 (line 317) | [Theory]
method FactoryTests_NonGeneric_Resolve_With_Param_With_Resolver (line 337) | [Theory]
method FactoryTests_Ensure_Exclude_Works (line 354) | [Theory]
method FactoryTests_Ensure_Exclude_Works_Scoped (line 389) | [Theory]
method FactoryTests_Resolve_Factory_Type (line 428) | [Theory]
method FactoryTests_Resolve_Factory_Delegate (line 445) | [Theory]
method FactoryTests_Resolve_Action_Throws (line 462) | [Theory]
method FactoryTests_Resolve_Multiple (line 472) | [Theory]
method FactoryTests_Resolve_Multiple_All (line 487) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation (line 502) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation_AsServiceAlso (line 512) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation_DependencyResolver_AsServiceAlso (line 523) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation_AsImplementedTypes (line 534) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation_DependencyResolver_AsImplementedTypes (line 545) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation_DependencyResolver_AsServiceAlso_Param (line 556) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation_DependencyResolver_AsImplementedTypes_Param (line 568) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation_AsServiceAlso_Interface (line 580) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation_AsImplementedTypes_Interface (line 591) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation_Unknown (line 602) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation_Unknown_Open_Generic (line 619) | [Theory]
method FactoryTests_Resolve_Action_Without_Implementation_Open_Generic (line 635) | [Theory]
type ITG (line 648) | interface ITG<T>;
class TG (line 650) | class TG<T> : ITG<T>;
type ITest (line 652) | interface ITest { string Name { get; } }
type ITest1 (line 654) | interface ITest1 { ITest Test { get; } }
type ITest2 (line 656) | interface ITest2 { ITest Test { get; } }
class Test3 (line 658) | class Test3 : ITest
class Test (line 663) | class Test : ITest
method Test (line 667) | public Test(string name)
class Test2 (line 673) | class Test2 : ITest2
class Test1 (line 679) | class Test1 : ITest1
method Init (line 683) | [InjectionMethod]
class Test12 (line 690) | class Test12 : ITest1
method Test12 (line 694) | public Test12(ITest test)
type ITest4 (line 700) | interface ITest4 : ITest
method Init (line 702) | void Init(string name);
class Test4 (line 705) | class Test4 : ITest4
method Init (line 709) | public void Init(string name) => Name = name;
class Test5 (line 712) | class Test5
method Test5 (line 716) | public Test5(IDependencyResolver dependencyResolver)
type IT1 (line 722) | interface IT1;
type IT2 (line 724) | interface IT2;
type IT3 (line 726) | interface IT3;
type IT4 (line 728) | interface IT4;
type IT5 (line 730) | interface IT5;
class TComp (line 732) | class TComp : IT1, IT2, IT3, IT4, IT5;
class Dummy (line 734) | class Dummy;
class Disposable (line 736) | class Disposable : IDisposable
method Dispose (line 739) | public void Dispose()
class TD (line 748) | class TD : IT1, IT2, IT3, IT4, IT5
method Init (line 750) | [InjectionMethod]
class TT (line 754) | class TT
method TT (line 761) | public TT(IT1 t1, IT2 t2, IT3 t3, IT4 t4)
FILE: test/FuncTests.cs
class FuncTests (line 11) | public class FuncTests
method FuncTests_Resolve (line 13) | [Fact]
method FuncTests_Resolve_AssignableFrom (line 25) | [Fact]
method FuncTests_Resolve_Choose_Last (line 37) | [Fact]
method FuncTests_Resolve_Scoped (line 50) | [Fact]
method FuncTests_Resolve_Null (line 72) | [Fact]
method FuncTests_Resolve_Lazy (line 81) | [Fact]
method FuncTests_Resolve_Lazy_Null (line 93) | [Fact]
method FuncTests_Resolve_Enumerable (line 102) | [Fact]
method FuncTests_Resolve_Enumerable_Null (line 114) | [Fact]
method FuncTests_Resolve_ConstructorDependency (line 123) | [Fact]
method FuncTests_Resolve_ConstructorDependency_Null (line 136) | [Fact]
method FuncTests_Resolve_ParameterInjection (line 146) | [Fact]
method FuncTests_Resolve_ParameterInjection_2Params (line 159) | [Fact]
method FuncTests_Resolve_Param
Condensed preview — 336 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,640K chars).
[
{
"path": ".gitattributes",
"chars": 2518,
"preview": "###############################################################################\n# Set default behavior to automatically "
},
{
"path": ".github/dependabot.yml",
"chars": 147,
"preview": "version: 2\nenable-beta-ecosystems: true\nupdates:\n - package-ecosystem: \"github-actions\"\n directory: \"/\"\n schedule"
},
{
"path": ".github/workflows/codeql-analysis.yml",
"chars": 2499,
"preview": "# For most projects, this workflow file will not need changing; you simply need\n# to commit it to your repository.\n#\n# Y"
},
{
"path": ".github/workflows/docs.yml",
"chars": 787,
"preview": "name: Deploy to GitHub Pages\n\non:\n push:\n branches: [ master ]\n paths:\n - 'docs/**'\n - '.github/workflo"
},
{
"path": ".github/workflows/linux-macOS-CI.yml",
"chars": 948,
"preview": "name: Build on Linux and macOS\non:\n push:\n branches: [ master, dev ]\n paths-ignore:\n - '**.md'\n - 'docs"
},
{
"path": ".github/workflows/sonar-analysis.yml",
"chars": 2402,
"preview": "name: SonarCloud Analysis\non:\n push:\n branches: [ master, dev ]\n paths-ignore:\n - '**.md'\n - 'docs/**'\n"
},
{
"path": ".github/workflows/stale.yml",
"chars": 1020,
"preview": "# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.\n#\n# You c"
},
{
"path": ".gitignore",
"chars": 2980,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User"
},
{
"path": ".version",
"chars": 6,
"preview": "5.20.0"
},
{
"path": "CHANGELOG.md",
"chars": 124,
"preview": "Visit the [Github Releases](https://github.com/z4kn4fein/stashbox/releases) page of the repository for a complete change"
},
{
"path": "LICENSE",
"chars": 1081,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2026 Peter Csajtai\n\nPermission is hereby granted, free of charge, to any person obt"
},
{
"path": "README.md",
"chars": 4989,
"preview": "# Stashbox\n[],\n};\n"
},
{
"path": "docs/docs/advanced/child-containers.md",
"chars": 8964,
"preview": "import CodeDescPanel from '@site/src/components/CodeDescPanel';\n\n# Child containers\n\nWith child containers, you can buil"
},
{
"path": "docs/docs/advanced/decorators.md",
"chars": 15584,
"preview": "import CodeDescPanel from '@site/src/components/CodeDescPanel';\nimport Tabs from '@theme/Tabs'; \nimport TabItem from '@t"
},
{
"path": "docs/docs/advanced/generics.md",
"chars": 9395,
"preview": "import CodeDescPanel from '@site/src/components/CodeDescPanel';\nimport Tabs from '@theme/Tabs'; \nimport TabItem from '@t"
},
{
"path": "docs/docs/advanced/special-resolution-cases.md",
"chars": 2936,
"preview": "import Tabs from '@theme/Tabs'; \nimport TabItem from '@theme/TabItem';\n\n# Special resolution cases\n\n## Unknown type reso"
},
{
"path": "docs/docs/advanced/wrappers-resolvers.md",
"chars": 11138,
"preview": "import CodeDescPanel from '@site/src/components/CodeDescPanel';\nimport Tabs from '@theme/Tabs'; \nimport TabItem from '@t"
},
{
"path": "docs/docs/configuration/container-configuration.md",
"chars": 13210,
"preview": "import CodeDescPanel from '@site/src/components/CodeDescPanel';\nimport Tabs from '@theme/Tabs'; \nimport TabItem from '@t"
},
{
"path": "docs/docs/configuration/registration-configuration.md",
"chars": 22785,
"preview": "import CodeDescPanel from '@site/src/components/CodeDescPanel';\nimport Tabs from '@theme/Tabs'; \nimport TabItem from '@t"
},
{
"path": "docs/docs/diagnostics/utilities.md",
"chars": 3516,
"preview": "import CodeDescPanel from '@site/src/components/CodeDescPanel';\nimport Tabs from '@theme/Tabs'; \nimport TabItem from '@t"
},
{
"path": "docs/docs/diagnostics/validation.md",
"chars": 6809,
"preview": "import Tabs from '@theme/Tabs'; \nimport TabItem from '@theme/TabItem';\n\n# Validation\n\nStashbox validation routines help "
},
{
"path": "docs/docs/getting-started/glossary.md",
"chars": 5212,
"preview": "import CodeDescPanel from '@site/src/components/CodeDescPanel'; \n\n# Glossary\n\nThe following terms and definitions are us"
},
{
"path": "docs/docs/getting-started/introduction.md",
"chars": 6249,
"preview": "---\ntitle: Introduction\n---\n\nimport Tabs from '@theme/Tabs'; \nimport TabItem from '@theme/TabItem';\n\nStashbox and its ex"
},
{
"path": "docs/docs/getting-started/overview.md",
"chars": 2982,
"preview": "---\ntitle: Overview\n---\n\n# Stashbox\n\n[.SidebarsConfig} */\nconst sidebars = {\n docs: [\n {\n type: '"
},
{
"path": "docs/src/components/CodeDescPanel/index.tsx",
"chars": 442,
"preview": "import React from 'react';\nimport styles from './styles.module.scss';\n\nexport default function CodeDescPanel({children})"
},
{
"path": "docs/src/components/CodeDescPanel/styles.module.scss",
"chars": 534,
"preview": ".codeDescContainer {\n width: 100%;\n display: inline-block;\n}\n\n.desc {\n float: left;\n max-width: 45%;\n wid"
},
{
"path": "docs/src/components/NavbarItems/SeparatorNavbarItem/index.tsx",
"chars": 259,
"preview": "import React from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.module.scss';\n\nexport default function "
},
{
"path": "docs/src/components/NavbarItems/SeparatorNavbarItem/styles.module.scss",
"chars": 233,
"preview": ".separator {\n height: 1.7rem;\n width: 1px;\n background-color: var(--ifm-navbar-link-color);\n opacity: .2;\n "
},
{
"path": "docs/src/components/NavbarItems/SvgNavbarItem/index.tsx",
"chars": 645,
"preview": "import useBaseUrl from '@docusaurus/useBaseUrl';\nimport clsx from 'clsx';\nimport React from 'react';\nimport SvgIcon from"
},
{
"path": "docs/src/components/NavbarItems/SvgNavbarItem/styles.module.scss",
"chars": 289,
"preview": ".icon_container {\n display: flex;\n align-items: center;\n}\n\n.icon {\n color: var(--ifm-navbar-link-color);\n wi"
},
{
"path": "docs/src/components/SvgIcon/index.tsx",
"chars": 633,
"preview": "import React from 'react';\nimport GitHubSvg from '@site/static/img/github.svg';\nimport ApiSvg from '@site/static/img/api"
},
{
"path": "docs/src/css/custom.scss",
"chars": 2180,
"preview": "/**\n * Any CSS included here will be global. The classic template\n * bundles Infima by default. Infima is a CSS framewor"
},
{
"path": "docs/src/css/pagination.scss",
"chars": 727,
"preview": ".pagination-nav__link {\n background-color: var(--base-contrast-background-color);\n border: none;\n color: #fff;\n"
},
{
"path": "docs/src/css/search.scss",
"chars": 203,
"preview": "div[class^='searchBox'], div[class*=' searchBox']{\n position: static;\n}\n\n@media (max-width: 996px) {\n div[class^='"
},
{
"path": "docs/src/css/sidebar.scss",
"chars": 973,
"preview": ".menu__list-item-collapsible {\n font-size: 13px;\n font-weight: 600;\n text-transform: uppercase;\n\n .menu__lin"
},
{
"path": "docs/src/css/tab.scss",
"chars": 878,
"preview": "li[role='tab'] {\n font-weight: 500;\n font-size: 14px;\n padding: .6rem 1rem;\n }\n\nli[role='tab'][aria-selected='"
},
{
"path": "docs/src/css/toc.scss",
"chars": 532,
"preview": ".table-of-contents {\n font-size: 13px;\n}\n\n.table-of-contents__link:not(.table-of-contents__link--active) {\n color:"
},
{
"path": "docs/src/pages/index.js",
"chars": 2402,
"preview": "import Link from '@docusaurus/Link';\nimport useDocusaurusContext from '@docusaurus/useDocusaurusContext';\nimport useBase"
},
{
"path": "docs/src/pages/index.module.scss",
"chars": 1749,
"preview": "/**\n * CSS files with the .module.css suffix will be treated as CSS modules\n * and scoped locally.\n */\n\n.heroBanner {\n "
},
{
"path": "docs/src/theme/CodeBlock/index.js",
"chars": 208,
"preview": "import CodeBlock from '@theme-original/CodeBlock';\nimport React from 'react';\n\nexport default function CodeBlockWrapper("
},
{
"path": "docs/src/theme/Footer/index.js",
"chars": 3483,
"preview": "import React from 'react';\nimport clsx from 'clsx';\nimport {useThemeConfig} from '@docusaurus/theme-common';\nimport Link"
},
{
"path": "docs/src/theme/Footer/styles.module.scss",
"chars": 746,
"preview": ".footer {\n background-color: var(--ifm-footer-background-color);\n padding: var(--ifm-footer-padding-vertical) 0;\n "
},
{
"path": "docs/src/theme/NavbarItem/ComponentTypes.js",
"chars": 358,
"preview": "import ComponentTypes from '@theme-original/NavbarItem/ComponentTypes';\nimport SvgNavbarItem from '@site/src/components/"
},
{
"path": "docs/src/utils/prismDark.mjs",
"chars": 399,
"preview": "/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found i"
},
{
"path": "docs/static/.nojekyll",
"chars": 0,
"preview": ""
},
{
"path": "sandbox/stashbox.assemblyload/Program.cs",
"chars": 1205,
"preview": "using Stashbox;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.Loader;\n\nIStashbox"
},
{
"path": "sandbox/stashbox.assemblyload/stashbox.assemblyload.csproj",
"chars": 635,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n <PropertyGroup>\n <OutputType>Exe</OutputType>\n <TargetFramework>net"
},
{
"path": "sandbox/stashbox.benchmarks/BeginScopeBenchmarks.cs",
"chars": 731,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Stashbox.Benchmarks\n{\n"
},
{
"path": "sandbox/stashbox.benchmarks/ChildContainerBenchmarks.cs",
"chars": 1416,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Stashbox.Benchmarks\n{\n"
},
{
"path": "sandbox/stashbox.benchmarks/DecoratorBenchmarks.cs",
"chars": 1140,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Stashbox.Benchmarks\n{\n"
},
{
"path": "sandbox/stashbox.benchmarks/DisposeBenchmarks.cs",
"chars": 3250,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\nusing System;\n\nnamespace Stashbox"
},
{
"path": "sandbox/stashbox.benchmarks/EnumerableBenchmarks.cs",
"chars": 1489,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing System.Collections.Generic;\nusing BenchmarkDotNet.Attributes;"
},
{
"path": "sandbox/stashbox.benchmarks/FinalizerBenchmarks.cs",
"chars": 1976,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Stashbox.Benchmarks\n{\n"
},
{
"path": "sandbox/stashbox.benchmarks/FuncBenchmarks.cs",
"chars": 1270,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\nusing System;\n\nnamespace Stashbox"
},
{
"path": "sandbox/stashbox.benchmarks/NullableBenchmarks.cs",
"chars": 770,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Stashbox.Benchmarks\n{\n"
},
{
"path": "sandbox/stashbox.benchmarks/Program.cs",
"chars": 1850,
"preview": "using System;\nusing BenchmarkDotNet.Configs;\nusing BenchmarkDotNet.Running;\n\nnamespace Stashbox.Benchmarks\n{\n class "
},
{
"path": "sandbox/stashbox.benchmarks/PropertyBenchmarks.cs",
"chars": 1125,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Stashbox.Benchmarks\n{\n"
},
{
"path": "sandbox/stashbox.benchmarks/RegisterBenchmarks.cs",
"chars": 802,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Stashbox.Benchmarks\n{\n"
},
{
"path": "sandbox/stashbox.benchmarks/ResolveBenchmarks.cs",
"chars": 1211,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Stashbox.Benchmarks\n{\n"
},
{
"path": "sandbox/stashbox.benchmarks/ScopedBenchmarks.cs",
"chars": 1340,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Stashbox.Benchmarks\n{\n"
},
{
"path": "sandbox/stashbox.benchmarks/SingletonBenchmarks.cs",
"chars": 1273,
"preview": "extern alias from_nuget;\nextern alias from_project;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Stashbox.Benchmarks\n{\n"
},
{
"path": "sandbox/stashbox.benchmarks/Stashbox.Benchmarks.csproj",
"chars": 1352,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n <PropertyGroup>\n <OutputType>Exe</OutputType>\n <TargetFramework>net8.0</Targ"
},
{
"path": "sandbox/stashbox.benchmarks/TreeBenchmarks.cs",
"chars": 1837,
"preview": "extern alias from_project;\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing Sy"
},
{
"path": "sandbox/stashbox.sandbox.sln",
"chars": 3492,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.1.3242"
},
{
"path": "sandbox/stashbox.trimmed/Program.cs",
"chars": 2110,
"preview": "using Stashbox;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\n\ntry\n{\n new A(new B());\n Console."
},
{
"path": "sandbox/stashbox.trimmed/stashbox.trimmed.csproj",
"chars": 577,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n <PropertyGroup>\n <OutputType>Exe</OutputType>\n <TargetFramework>net6.0</Targ"
},
{
"path": "src/Attributes/DependencyAttribute.cs",
"chars": 635,
"preview": "using System;\n\nnamespace Stashbox.Attributes;\n\n/// <summary>\n/// Represents an attribute for tracking dependencies.\n///"
},
{
"path": "src/Attributes/DependencyNameAttribute.cs",
"chars": 282,
"preview": "using System;\n\nnamespace Stashbox.Attributes;\n\n/// <summary>\n/// When a parameter is marked with this attribute, the co"
},
{
"path": "src/Attributes/InjectionMethodAttribute.cs",
"chars": 236,
"preview": "using System;\n\nnamespace Stashbox.Attributes;\n\n/// <summary>\n/// Represents an attribute for tracking injection methods"
},
{
"path": "src/Configuration/ContainerConfiguration.cs",
"chars": 10668,
"preview": "using Stashbox.Attributes;\nusing Stashbox.Lifetime;\nusing Stashbox.Registration.Fluent;\nusing System;\nusing System.Coll"
},
{
"path": "src/Configuration/ContainerConfigurator.cs",
"chars": 13833,
"preview": "using Stashbox.Lifetime;\nusing Stashbox.Registration.Fluent;\nusing System;\nusing System.Collections.Generic;\nusing Syst"
},
{
"path": "src/Configuration/Rules.cs",
"chars": 4401,
"preview": "using Stashbox.Exceptions;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Express"
},
{
"path": "src/ContainerContext.cs",
"chars": 1079,
"preview": "using Stashbox.Configuration;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\n\nnamespace Stashbox;\n\ninternal cl"
},
{
"path": "src/Exceptions/CompositionRootNotFoundException.cs",
"chars": 1045,
"preview": "using System;\nusing System.Reflection;\nusing System.Runtime.Serialization;\n\nnamespace Stashbox.Exceptions;\n\n/// <summar"
},
{
"path": "src/Exceptions/ConstructorNotFoundException.cs",
"chars": 2110,
"preview": "using System;\nusing System.Linq;\nusing System.Runtime.Serialization;\n\nnamespace Stashbox.Exceptions;\n\n/// <summary>\n///"
},
{
"path": "src/Exceptions/InvalidRegistrationException.cs",
"chars": 1208,
"preview": "using System;\nusing System.Runtime.Serialization;\n\nnamespace Stashbox.Exceptions;\n\n/// <summary>\n/// Represents an exce"
},
{
"path": "src/Exceptions/LifetimeValidationFailedException.cs",
"chars": 1048,
"preview": "using System;\nusing System.Runtime.Serialization;\n\nnamespace Stashbox.Exceptions;\n\n/// <summary>\n/// Represents the exc"
},
{
"path": "src/Exceptions/ResolutionFailedException.cs",
"chars": 2278,
"preview": "using System;\nusing System.Runtime.Serialization;\n\nnamespace Stashbox.Exceptions;\n\n/// <summary>\n/// Represents the exc"
},
{
"path": "src/Exceptions/ServiceAlreadyRegisteredException.cs",
"chars": 1290,
"preview": "using Stashbox.Configuration;\nusing System;\nusing System.Runtime.Serialization;\n\nnamespace Stashbox.Exceptions;\n\n/// <s"
},
{
"path": "src/Expressions/Compile/Closure.cs",
"chars": 353,
"preview": "using System.Reflection;\nusing Stashbox.Utils;\n\nnamespace Stashbox.Expressions.Compile;\n\ninternal class Closure\n{\n p"
},
{
"path": "src/Expressions/Compile/CompilerContext.cs",
"chars": 2693,
"preview": "using Stashbox.Utils.Data;\nusing System.Linq.Expressions;\nusing System.Reflection.Emit;\n\nnamespace Stashbox.Expressions"
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.Assign.cs",
"chars": 1918,
"preview": "using Stashbox.Expressions.Compile.Extensions;\nusing System.Linq.Expressions;\nusing System.Reflection.Emit;\n\nnamespace "
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.Call.cs",
"chars": 635,
"preview": "using Stashbox.Expressions.Compile.Extensions;\nusing System.Linq.Expressions;\nusing System.Reflection.Emit;\n\nnamespace "
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.Constant.cs",
"chars": 1879,
"preview": "using Stashbox.Expressions.Compile.Extensions;\nusing System;\nusing System.Linq.Expressions;\nusing System.Reflection.Emi"
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.Convert.cs",
"chars": 1469,
"preview": "using System;\nusing System.Linq.Expressions;\nusing System.Reflection;\nusing System.Reflection.Emit;\nusing Stashbox.Util"
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.Default.cs",
"chars": 1538,
"preview": "using Stashbox.Expressions.Compile.Extensions;\nusing Stashbox.Utils;\nusing System.Linq.Expressions;\nusing System.Reflec"
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.Invoke.cs",
"chars": 682,
"preview": "using Stashbox.Expressions.Compile.Extensions;\nusing System.Linq.Expressions;\nusing System.Reflection.Emit;\n\nnamespace "
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.Lambda.cs",
"chars": 3090,
"preview": "using Stashbox.Expressions.Compile.Extensions;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Reflectio"
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.MemberAccess.cs",
"chars": 1771,
"preview": "using Stashbox.Expressions.Compile.Extensions;\nusing System.Linq.Expressions;\nusing System.Reflection;\nusing System.Ref"
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.MemberInit.cs",
"chars": 973,
"preview": "using System.Linq.Expressions;\nusing System.Reflection.Emit;\n\nnamespace Stashbox.Expressions.Compile.Emitters;\n\ninterna"
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.New.cs",
"chars": 507,
"preview": "using System.Linq.Expressions;\nusing System.Reflection.Emit;\n\nnamespace Stashbox.Expressions.Compile.Emitters;\n\ninterna"
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.NewArrayInit.cs",
"chars": 1099,
"preview": "using Stashbox.Expressions.Compile.Extensions;\nusing System;\nusing System.Linq.Expressions;\nusing System.Reflection.Emi"
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.Parameter.cs",
"chars": 1594,
"preview": "using Stashbox.Expressions.Compile.Extensions;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Reflectio"
},
{
"path": "src/Expressions/Compile/Emitters/Emitter.cs",
"chars": 3133,
"preview": "using Stashbox.Expressions.Compile.Extensions;\nusing Stashbox.Utils.Data;\nusing System;\nusing System.Collections.Generi"
},
{
"path": "src/Expressions/Compile/ExpressionEmitter.cs",
"chars": 2241,
"preview": "using Stashbox.Expressions.Compile.Emitters;\nusing Stashbox.Expressions.Compile.Extensions;\nusing System;\nusing System."
},
{
"path": "src/Expressions/Compile/Extensions/CollectionExtensions.cs",
"chars": 1657,
"preview": "using Stashbox.Utils;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\n\nnamespace Stashbo"
},
{
"path": "src/Expressions/Compile/Extensions/ILGeneratorExtensions.cs",
"chars": 5306,
"preview": "using System;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Reflection;\nusing System.Reflection.Emit;\n"
},
{
"path": "src/Expressions/Compile/NestedLambda.cs",
"chars": 479,
"preview": "using Stashbox.Utils.Data;\nusing System.Linq.Expressions;\n\nnamespace Stashbox.Expressions.Compile;\n\ninternal class Nest"
},
{
"path": "src/Expressions/Compile/TreeAnalyzer.cs",
"chars": 5828,
"preview": "using Stashbox.Utils.Data;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\n\nnamespa"
},
{
"path": "src/Expressions/Compile/Utils.cs",
"chars": 2389,
"preview": "using System;\nusing System.Linq;\nusing System.Reflection;\nusing Stashbox.Utils;\n\nnamespace Stashbox.Expressions.Compile"
},
{
"path": "src/Expressions/ExpressionBuilder.Default.cs",
"chars": 2760,
"preview": "using Stashbox.Exceptions;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\nusing Stashbox.Utils;\nusing System.C"
},
{
"path": "src/Expressions/ExpressionBuilder.Factory.cs",
"chars": 2833,
"preview": "using Stashbox.Exceptions;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\nusing System;\nusing System.Collectio"
},
{
"path": "src/Expressions/ExpressionBuilder.Func.cs",
"chars": 1724,
"preview": "using Stashbox.Registration;\nusing Stashbox.Resolution;\nusing System;\nusing System.Collections.Generic;\nusing System.Li"
},
{
"path": "src/Expressions/ExpressionBuilder.cs",
"chars": 3462,
"preview": "using Stashbox.Lifetime;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\nusing Stashbox.Utils;\nusing System;\nus"
},
{
"path": "src/Expressions/ExpressionFactory.Member.cs",
"chars": 2833,
"preview": "using Stashbox.Exceptions;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\nusing Stashbox.Resolution.Extensions"
},
{
"path": "src/Expressions/ExpressionFactory.Method.cs",
"chars": 8068,
"preview": "using Stashbox.Exceptions;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\nusing Stashbox.Resolution.Extensions"
},
{
"path": "src/Expressions/ExpressionFactory.cs",
"chars": 7503,
"preview": "using Stashbox.Registration;\nusing Stashbox.Resolution;\nusing Stashbox.Utils.Data;\nusing System;\nusing System.Collectio"
},
{
"path": "src/Extensions/AssemblyExtensions.cs",
"chars": 316,
"preview": "using System.Collections.Generic;\nusing System.Linq;\n\nnamespace System.Reflection;\n\ninternal static class AssemblyExten"
},
{
"path": "src/Extensions/CollectionExtensions.cs",
"chars": 1123,
"preview": "using Stashbox.Registration;\n\nnamespace System.Collections.Generic;\n\ninternal static class CollectionExtensions\n{\n p"
},
{
"path": "src/Extensions/EnumerableExtensions.cs",
"chars": 2233,
"preview": "using Stashbox.Utils.Data;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\n\nnamespace System.Linq;\n\nin"
},
{
"path": "src/Extensions/ExpressionExtensions.cs",
"chars": 22408,
"preview": "using Stashbox;\nusing Stashbox.Configuration;\nusing Stashbox.Expressions.Compile;\nusing Stashbox.Registration;\nusing St"
},
{
"path": "src/Extensions/TypeExtensions.cs",
"chars": 23304,
"preview": "using Stashbox.Attributes;\nusing Stashbox.Configuration;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\nusing "
},
{
"path": "src/ICompositionRoot.cs",
"chars": 927,
"preview": "namespace Stashbox;\n\n/// <summary>\n/// Represents a composition root used by the <see cref=\"CollectionRegistratorExtens"
},
{
"path": "src/IContainerContext.cs",
"chars": 998,
"preview": "using Stashbox.Configuration;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\n\nnamespace Stashbox;\n\n/// <summar"
},
{
"path": "src/IDecoratorRegistrator.cs",
"chars": 2929,
"preview": "using Stashbox.Registration.Fluent;\nusing System;\n\nnamespace Stashbox;\n\n/// <summary>\n/// Represents a decorator regist"
},
{
"path": "src/IDependencyCollectionRegistrator.cs",
"chars": 2848,
"preview": "using Stashbox.Registration.Fluent;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Stashbox;\n\n/// <summary>"
},
{
"path": "src/IDependencyReMapper.cs",
"chars": 3866,
"preview": "using Stashbox.Registration.Fluent;\nusing System;\n\nnamespace Stashbox;\n\n/// <summary>\n/// Represents a dependency remap"
},
{
"path": "src/IDependencyRegistrator.cs",
"chars": 9049,
"preview": "using Stashbox.Registration.Fluent;\nusing System;\n\nnamespace Stashbox;\n\n/// <summary>\n/// Represents a dependency regis"
},
{
"path": "src/IDependencyResolver.cs",
"chars": 6849,
"preview": "using Stashbox.Resolution;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threadi"
},
{
"path": "src/IFuncRegistrator.cs",
"chars": 3374,
"preview": "using System;\n\nnamespace Stashbox;\n\n/// <summary>\n/// Represents a factory registrator.\n/// </summary>\npublic interface"
},
{
"path": "src/IResolutionScope.cs",
"chars": 2871,
"preview": "using Stashbox.Resolution;\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threadi"
},
{
"path": "src/IStashboxContainer.cs",
"chars": 3966,
"preview": "using Stashbox.Configuration;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\nusing System;\nusing System.Collec"
},
{
"path": "src/Lifetime/AutoLifetime.cs",
"chars": 1756,
"preview": "using System.Linq.Expressions;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\n\nnamespace Stashbox.Lifetime;\n\nin"
},
{
"path": "src/Lifetime/EmptyLifetime.cs",
"chars": 611,
"preview": "using Stashbox.Registration;\nusing Stashbox.Resolution;\nusing System.Linq.Expressions;\n\nnamespace Stashbox.Lifetime;\n\ni"
},
{
"path": "src/Lifetime/ExpressionLifetimeDescriptor.cs",
"chars": 1808,
"preview": "using Stashbox.Registration;\nusing Stashbox.Resolution;\nusing System;\nusing System.Linq.Expressions;\n\nnamespace Stashbo"
},
{
"path": "src/Lifetime/FactoryLifetimeDescriptor.cs",
"chars": 3285,
"preview": "using Stashbox.Registration;\nusing Stashbox.Resolution;\nusing System;\nusing System.Linq.Expressions;\n\nnamespace Stashbo"
},
{
"path": "src/Lifetime/LifetimeDescriptor.cs",
"chars": 4035,
"preview": "using Stashbox.Exceptions;\nusing Stashbox.Expressions;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\nusing Sy"
},
{
"path": "src/Lifetime/Lifetimes.cs",
"chars": 1672,
"preview": "namespace Stashbox.Lifetime;\n\n/// <summary>\n/// Contains all the built-in lifetime managers.\n/// </summary>\npublic stat"
},
{
"path": "src/Lifetime/NamedScopeLifetime.cs",
"chars": 2678,
"preview": "using Stashbox.Exceptions;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\nusing System;\nusing System.Linq.Expr"
},
{
"path": "src/Lifetime/PerRequestLifetime.cs",
"chars": 1070,
"preview": "using Stashbox.Registration;\nusing Stashbox.Resolution;\nusing Stashbox.Utils;\nusing System;\nusing System.Linq.Expressio"
},
{
"path": "src/Lifetime/ScopedLifetime.cs",
"chars": 1539,
"preview": "using Stashbox.Exceptions;\nusing Stashbox.Registration;\nusing Stashbox.Resolution;\nusing Stashbox.Utils;\nusing System;\n"
},
{
"path": "src/Lifetime/SingletonLifetime.cs",
"chars": 1305,
"preview": "using Stashbox.Registration;\nusing Stashbox.Resolution;\nusing Stashbox.Utils;\nusing System;\nusing System.Linq.Expressio"
},
{
"path": "src/Lifetime/TransientLifetime.cs",
"chars": 500,
"preview": "using Stashbox.Registration;\nusing Stashbox.Resolution;\nusing System;\nusing System.Linq.Expressions;\n\nnamespace Stashbo"
},
{
"path": "src/Metadata.cs",
"chars": 824,
"preview": "namespace Stashbox;\n\n/// <summary>\n/// Describes a wrapper for services with additional metadata.\n/// </summary>\n/// <t"
},
{
"path": "src/Multitenant/ITenantDistributor.cs",
"chars": 1473,
"preview": "using System;\n\nnamespace Stashbox.Multitenant;\n\n/// <summary>\n/// Represents a tenant distributor that manages tenants "
},
{
"path": "src/Multitenant/TenantDistributor.cs",
"chars": 14589,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Stashbox.Co"
},
{
"path": "src/Override.cs",
"chars": 1715,
"preview": "using System;\nusing Stashbox.Utils;\n\nnamespace Stashbox;\n\n/// <summary>\n/// Represents a specialized resolution override"
},
{
"path": "src/ReadOnlyKeyValue.cs",
"chars": 824,
"preview": "using System.Diagnostics;\n\nnamespace Stashbox;\n\n/// <summary>\n/// Represents a readonly key-value pair.\n/// </summary>\n"
},
{
"path": "src/Registration/DecoratorRepository.cs",
"chars": 3438,
"preview": "using Stashbox.Registration.Extensions;\nusing Stashbox.Registration.SelectionRules;\nusing Stashbox.Resolution;\nusing St"
},
{
"path": "src/Registration/Extensions/CollectionRegistratorExtensions.cs",
"chars": 11878,
"preview": "using Stashbox.Exceptions;\nusing Stashbox.Registration.Fluent;\nusing Stashbox.Utils;\nusing System;\nusing System.Collect"
},
{
"path": "src/Registration/Extensions/DependencyRegistratorExtensions.cs",
"chars": 1641,
"preview": "using System.Collections.Generic;\n\nnamespace Stashbox;\n\n/// <summary>\n/// Represents the extension methods of <see cref"
},
{
"path": "src/Registration/Extensions/DependencyRemapperExtensions.cs",
"chars": 794,
"preview": "using Stashbox.Registration.Fluent;\nusing System;\n\nnamespace Stashbox;\n\n/// <summary>\n/// Represents the extension meth"
},
{
"path": "src/Registration/Extensions/ServiceRepositoryExtensions.cs",
"chars": 3888,
"preview": "using Stashbox.Registration.SelectionRules;\nusing Stashbox.Resolution;\nusing Stashbox.Utils.Data;\nusing Stashbox.Utils."
},
{
"path": "src/Registration/Fluent/BaseDecoratorConfigurator.cs",
"chars": 2478,
"preview": "using Stashbox.Lifetime;\nusing System;\nusing System.Linq;\nusing Stashbox.Utils;\n\nnamespace Stashbox.Registration.Fluent"
},
{
"path": "src/Registration/Fluent/BaseFluentConfigurator.cs",
"chars": 26097,
"preview": "using Stashbox.Configuration;\nusing Stashbox.Exceptions;\nusing Stashbox.Lifetime;\nusing Stashbox.Resolution;\nusing Stas"
},
{
"path": "src/Registration/Fluent/DecoratorConfigurator.cs",
"chars": 13306,
"preview": "using Stashbox.Utils;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\nusing System.Threa"
},
{
"path": "src/Registration/Fluent/FluentServiceConfigurator.cs",
"chars": 17614,
"preview": "using Stashbox.Lifetime;\nusing Stashbox.Utils;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq.Expres"
},
{
"path": "src/Registration/Fluent/RegistrationConfigurator.cs",
"chars": 2701,
"preview": "using Stashbox.Lifetime;\nusing Stashbox.Utils;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Stashbox.Regi"
},
{
"path": "src/Registration/Fluent/UnknownRegistrationConfigurator.cs",
"chars": 1428,
"preview": "using Stashbox.Lifetime;\nusing System;\n\nnamespace Stashbox.Registration.Fluent;\n\n/// <summary>\n/// Represents the fluen"
},
{
"path": "src/Registration/IDecoratorRepository.cs",
"chars": 1444,
"preview": "using Stashbox.Resolution;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Stashbox.Registration;\n\n/// <summ"
},
{
"path": "src/Registration/IRegistrationRepository.cs",
"chars": 2680,
"preview": "using Stashbox.Resolution;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Stashbox.Registration;\n\n/// <summ"
},
{
"path": "src/Registration/OpenGenericRegistration.cs",
"chars": 1488,
"preview": "using Stashbox.Utils.Data.Immutable;\nusing Stashbox.Utils;\nusing System;\n\nnamespace Stashbox.Registration;\n\n/// <summar"
},
{
"path": "src/Registration/RegistrationDiagnosticsInfo.cs",
"chars": 1349,
"preview": "using System;\n\nnamespace Stashbox.Registration;\n\n/// <summary>\n/// Details about a registration.\n/// </summary>\npublic "
},
{
"path": "src/Registration/RegistrationRepository.cs",
"chars": 8121,
"preview": "using Stashbox.Configuration;\nusing Stashbox.Exceptions;\nusing Stashbox.Registration.Extensions;\nusing Stashbox.Registr"
},
{
"path": "src/Registration/SelectionRules/ConditionRule.cs",
"chars": 766,
"preview": "using Stashbox.Resolution;\nusing System.Collections.Generic;\n\nnamespace Stashbox.Registration.SelectionRules;\n\ninternal"
},
{
"path": "src/Registration/SelectionRules/DecoratorRule.cs",
"chars": 460,
"preview": "using Stashbox.Resolution;\n\nnamespace Stashbox.Registration.SelectionRules;\n\ninternal class DecoratorRule : IRegistrati"
},
{
"path": "src/Registration/SelectionRules/EnumerableNameRule.cs",
"chars": 2234,
"preview": "using Stashbox.Resolution;\n\nnamespace Stashbox.Registration.SelectionRules;\n\ninternal class EnumerableNameRule : IRegis"
},
{
"path": "src/Registration/SelectionRules/IRegistrationSelectionRule.cs",
"chars": 306,
"preview": "using Stashbox.Resolution;\n\nnamespace Stashbox.Registration.SelectionRules;\n\ninternal interface IRegistrationSelectionR"
},
{
"path": "src/Registration/SelectionRules/MetadataRule.cs",
"chars": 747,
"preview": "using Stashbox.Resolution;\nusing System.Collections.Generic;\n\nnamespace Stashbox.Registration.SelectionRules;\n\ninternal"
},
{
"path": "src/Registration/SelectionRules/NameRule.cs",
"chars": 2590,
"preview": "using Stashbox.Resolution;\n\nnamespace Stashbox.Registration.SelectionRules;\n\ninternal class NameRule : IRegistrationSel"
},
{
"path": "src/Registration/SelectionRules/OpenGenericRule.cs",
"chars": 553,
"preview": "using Stashbox.Resolution;\nusing System;\n\nnamespace Stashbox.Registration.SelectionRules;\n\ninternal class OpenGenericRu"
},
{
"path": "src/Registration/SelectionRules/RegistrationSelectionRules.cs",
"chars": 751,
"preview": "namespace Stashbox.Registration.SelectionRules;\n\ninternal static class RegistrationSelectionRules\n{\n public static r"
},
{
"path": "src/Registration/SelectionRules/ScopeNameRule.cs",
"chars": 841,
"preview": "using Stashbox.Lifetime;\nusing Stashbox.Resolution;\n\nnamespace Stashbox.Registration.SelectionRules;\n\ninternal class Sc"
},
{
"path": "src/Registration/ServiceRegistration.cs",
"chars": 14010,
"preview": "using Stashbox.Configuration;\nusing Stashbox.Lifetime;\nusing Stashbox.Resolution;\nusing Stashbox.Utils.Data;\nusing Syst"
},
{
"path": "src/Registration/ServiceRegistrator.cs",
"chars": 4336,
"preview": "using Stashbox.Lifetime;\nusing Stashbox.Utils.Data;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n"
},
{
"path": "src/Resolution/DelegateCache.cs",
"chars": 1627,
"preview": "using Stashbox.Utils;\nusing Stashbox.Utils.Data.Immutable;\nusing System;\n\nnamespace Stashbox.Resolution;\n\ninternal clas"
},
{
"path": "src/Resolution/DelegateCacheEntry.cs",
"chars": 2439,
"preview": "using System;\nusing System.Collections.Generic;\n\nnamespace Stashbox.Resolution;\n\n/// <summary>\n/// Details about Stashb"
},
{
"path": "src/Resolution/Extensions/DependencyResolverExtensions.cs",
"chars": 22762,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Runtime.CompilerServices;\nusing Stashbox.Resolution;\nusing"
},
{
"path": "src/Resolution/Extensions/InjectionParameterExtensions.cs",
"chars": 1081,
"preview": "using Stashbox.Utils;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\n\nnamespace St"
},
{
"path": "src/Resolution/Extensions/ResolutionBehaviorExtensions.cs",
"chars": 240,
"preview": "namespace Stashbox.Resolution;\n\ninternal static class ResolutionBehaviorExtensions\n{\n public static bool Has(this Re"
},
{
"path": "src/Resolution/ILookupResolver.cs",
"chars": 153,
"preview": "namespace Stashbox.Resolution;\n\ninternal interface ILookup\n{\n bool CanLookupService(TypeInformation typeInfo, Resolu"
},
{
"path": "src/Resolution/IRequestContext.cs",
"chars": 1507,
"preview": "using System;\n\nnamespace Stashbox.Resolution;\n\n/// <summary>\n/// Represents an information storage for resolution reque"
},
{
"path": "src/Resolution/IResolutionStrategy.cs",
"chars": 2354,
"preview": "using System;\nusing Stashbox.Registration;\nusing System.Collections.Generic;\n\nnamespace Stashbox.Resolution;\n\n/// <summ"
},
{
"path": "src/Resolution/IResolver.cs",
"chars": 2455,
"preview": "using System;\nusing System.Collections.Generic;\n\nnamespace Stashbox.Resolution;\n\n/// <summary>\n/// The base interface f"
},
{
"path": "src/Resolution/IWrapper.cs",
"chars": 5196,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq.Expressions;\n\nnamespace Stashbox.Resolution;\n\n/// <su"
},
{
"path": "src/Resolution/RequestContext.cs",
"chars": 1859,
"preview": "using Stashbox.Utils;\nusing Stashbox.Utils.Data;\nusing System;\nusing System.Linq;\n\nnamespace Stashbox.Resolution;\n\ninte"
},
{
"path": "src/Resolution/ResolutionBehavior.cs",
"chars": 1442,
"preview": "using System;\n\nnamespace Stashbox.Resolution;\n\n/// <summary>\n/// Service resolution behavior.\n/// </summary>\n[Flags]\npu"
},
{
"path": "src/Resolution/ResolutionContext.cs",
"chars": 17936,
"preview": "using Stashbox.Registration;\nusing Stashbox.Utils;\nusing Stashbox.Utils.Data;\nusing Stashbox.Utils.Data.Immutable;\nusin"
},
{
"path": "src/Resolution/ResolutionStrategy.cs",
"chars": 25921,
"preview": "using Stashbox.Expressions;\nusing Stashbox.Lifetime;\nusing Stashbox.Registration;\nusing Stashbox.Resolution.Resolvers;\n"
},
{
"path": "src/Resolution/Resolvers/DefaultValueResolver.cs",
"chars": 677,
"preview": "using Stashbox.Utils;\nusing System.Linq.Expressions;\n\nnamespace Stashbox.Resolution.Resolvers;\n\ninternal class DefaultV"
},
{
"path": "src/Resolution/Resolvers/OptionalValueResolver.cs",
"chars": 540,
"preview": "using System.Linq.Expressions;\n\nnamespace Stashbox.Resolution.Resolvers;\n\ninternal class OptionalValueResolver : IServi"
},
{
"path": "src/Resolution/Resolvers/ParentContainerResolver.cs",
"chars": 1789,
"preview": "using System;\nusing System.Collections.Generic;\n\nnamespace Stashbox.Resolution.Resolvers;\n\ninternal class ParentContain"
},
{
"path": "src/Resolution/Resolvers/ServiceProviderResolver.cs",
"chars": 573,
"preview": "using System;\nusing System.Linq.Expressions;\nusing Stashbox.Utils;\n\nnamespace Stashbox.Resolution.Resolvers;\n\ninternal "
},
{
"path": "src/Resolution/Resolvers/UnknownTypeResolver.cs",
"chars": 2158,
"preview": "using Stashbox.Registration;\nusing Stashbox.Registration.Fluent;\nusing System;\n\nnamespace Stashbox.Resolution.Resolvers"
},
{
"path": "src/Resolution/ServiceContext.cs",
"chars": 1307,
"preview": "using Stashbox.Registration;\nusing System.Linq.Expressions;\n\nnamespace Stashbox.Resolution;\n\n/// <summary>\n/// Represen"
},
{
"path": "src/Resolution/TypeInformation.cs",
"chars": 3936,
"preview": "using Stashbox.Utils;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Stashbox.Resolution;\n\n/// <summary>\n//"
},
{
"path": "src/Resolution/Wrappers/EnumerableWrapper.cs",
"chars": 824,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing Stashbox.Utils;"
},
{
"path": "src/Resolution/Wrappers/FuncWrapper.cs",
"chars": 1259,
"preview": "using Stashbox.Utils;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;"
}
]
// ... and 136 more files (download for full content)
About this extraction
This page contains the full source code of the z4kn4fein/stashbox GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 336 files (1.5 MB), approximately 350.0k tokens, and a symbol index with 3449 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.