Skip to content

Commit

Permalink
v3.6.0 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
z4kn4fein committed Feb 25, 2021
1 parent 67ede1f commit 20953ba
Show file tree
Hide file tree
Showing 61 changed files with 1,363 additions and 646 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.5.1
3.6.0
94 changes: 71 additions & 23 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,115 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v3.6.0] - 2021-02-25

[API changes](https://www.fuget.org/packages/Stashbox/3.6.0/lib/netstandard2.1/diff/3.5.1/)

### Added
- Parameterized factory delegates. [Read more](https://z4kn4fein.github.io/stashbox/#/usage/advanced-registration?id=factory-registration).
- Multiple conditions from the same type are now combined with **OR** logical operator. [Read more](https://z4kn4fein.github.io/stashbox/#/usage/service-resolution?id=conditional-resolution).
- Named version of the `.WhenDecoratedServiceIs()` decorator condition. [Read more](https://z4kn4fein.github.io/stashbox/#/advanced/decorators?id=conditional-decoration).

### Deprecated
- `.InjectMember()` registration configuration option. `.WithDependencyBindig()` should be used instead. [Read more](https://z4kn4fein.github.io/stashbox/#/configuration/registration-configuration?id=dependency-configuration).

### Removed
- The `GetRegistrationOrDefault(type, resolutionContext, name)` method of the `IRegistrationRepository` interface.
- Some properties of the `RegistrationContext` class were moved to internal visibility.

## [v3.5.1] - 2021-02-19
- Bugfix: When a singleton registration had been replaced with `.ReplaceExisting()`, the container still used the old instance. #98
### Fixed
- When a singleton registration was replaced with `.ReplaceExisting()`, the container still used the old instance. [#98](https://github.com/z4kn4fein/stashbox/issues/98)

## [v3.5.0] - 2021-01-31
### Added
- Assembly scanning:
- Added option to filter service types and disable self-registration.
- Recognize generic definitions.
- Added support to covariant/contravariant generic type resolution.
- Bugfix: Services with named scope lifetime were not choose right from the registration repo.
- Support to covariant/contravariant generic type resolution.

### Fixed
- Services with named scope lifetime were not chosen right from the registration repo.

## [v3.4.0] - 2020-11-15
- Added the core components of multitenant functionality.
### Added
- The core components of multitenant functionality.
- Throw `ObjectDisposedException` when the container or scope is used after their disposal.

## [v3.3.0] - 2020-11-05
- Added the option to rebuild singletons in child container with dependencies overridden in it.
- Fix: Singleton instances were built when the Validate() was called, now just the expression is generated for them.
### Added
- Option to rebuild singletons in child container with dependencies overridden in it.

### Fixed
- Singleton instances were built when the Validate() was called, now just the expression is generated for them.

## [v3.2.9] - 2020-11-02
- Added the option to replace a registration only if an existing one is registered with the same type or name.
### Added
- Option to replace a registration only if an existing one is registered with the same type or name.

## [v3.2.8] - 2020-10-17
- Switch to license expression in nuget package.
### Changed
- Switch to license expression in nuget package. [#95](https://github.com/z4kn4fein/stashbox/issues/95)

## [v3.2.7] - 2020-10-16
### Changed
- Minor bugfixes.

## [v3.2.6] - 2020-10-16
### Added
- The Validate() method now throws an AggregateException containing all the underlying exceptions.

### Changed
- Minor bugfixes.

## [v3.2.5] - 2020-10-12

### Changed
- Minor bugfixes.

## [v3.2.4] - 2020-07-22
- Added the `.WhenDecoratedServiceHas()` and `.WhenDecoratedServiceIs()` decorator configuration options.
### Added
- The `.WhenDecoratedServiceHas()` and `.WhenDecoratedServiceIs()` decorator configuration options.

## [v3.2.2] - 2020-07-21
- Added support of conditional and lifetime managed decorators #93
### Added
- Support of conditional and lifetime managed decorators [#93](https://github.com/z4kn4fein/stashbox/issues/93)

## [v3.2.1] - 2020-07-09
- Fix: Factory resolution didn't use the built-in expression compiler.
### Fixed
- Factory resolution didn't use the built-in expression compiler.

## [v3.2.0] - 2020-06-29
- Added IAsyncDisposable support #90
### Added
- IAsyncDisposable support [#90](https://github.com/z4kn4fein/stashbox/issues/90)
- It works on >=net461, >=netstandard2.0 frameworks.
- On net461 and netstandard2.0 the usage of IAsyncDisposable interface requires the
Microsoft.Bcl.AsyncInterfaces package, on netstandard2.1 it's part of the framework.
- Fix: resolving with custom parameter values #91

### Fixed
- Resolution with custom parameter values [#91](https://github.com/z4kn4fein/stashbox/issues/91)

## [v3.1.2] - 2020-06-22
- Fix: IdentityServer not compatible #88
- Fix: Call interception #89
### Fixed
- IdentityServer not compatible [#88](https://github.com/z4kn4fein/stashbox/issues/88)
- Call interception [#89](https://github.com/z4kn4fein/stashbox/issues/89)

## [v3.1.1] - 2020-06-11
- Fix: String constant is not handled well by the built-in compiler #86
- Fix: Registration behaviour doesn't respect replacing #87
### Fixed
- String constant is not handled well by the built-in compiler [#86](https://github.com/z4kn4fein/stashbox/issues/86)
- Registration behaviour doesn't respect replacing [#87](https://github.com/z4kn4fein/stashbox/issues/87)

## [v3.1.0] - 2020-06-08
- Fix: Nested named resolution could cause stack overflow #74
- Fix: Improve support for Assemblies loaded into Collectible AssemblyLoadContexts #73
- Fix: Unknown type resolution does not work recursively #77
- Fix: Exception when building expressions #76
- Fix: Bad performance #79
- Fix: Expected override behaviour not working with scopes #80
### Fixed
- Nested named resolution could cause stack overflow [#74](https://github.com/z4kn4fein/stashbox/issues/74)
- Improve support for Assemblies loaded into Collectible AssemblyLoadContexts [#73](https://github.com/z4kn4fein/stashbox/issues/73)
- Unknown type resolution does not work recursively [#77](https://github.com/z4kn4fein/stashbox/issues/77)
- Exception when building expressions [#76](https://github.com/z4kn4fein/stashbox/issues/76)
- Bad performance [#79](https://github.com/z4kn4fein/stashbox/issues/79)
- Expected override behaviour not working with scopes [#80](https://github.com/z4kn4fein/stashbox/issues/80)

### Breaking changes:
- `WithUniqueRegistrationIdentifiers()` option has been removed, `WithRegistrationBehavior()` has been added instead.
Expand All @@ -83,6 +130,7 @@
- Removed the legacy container extension functionality.
- Removed the support of PCL v259.

[v3.6.0]: https://github.com/z4kn4fein/stashbox/compare/3.5.1...3.6.0
[v3.5.1]: https://github.com/z4kn4fein/stashbox/compare/3.5.0...3.5.1
[v3.5.0]: https://github.com/z4kn4fein/stashbox/compare/3.4.0...3.5.0
[v3.4.0]: https://github.com/z4kn4fein/stashbox/compare/3.3.0...3.4.0
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ Stashbox is a lightweight, fast and portable dependency injection framework for

Github (stable) | NuGet (stable) | Fuget (stable) | NuGet (daily)
--- | --- | --- | ---
[![Github release](https://img.shields.io/github/release/z4kn4fein/stashbox.svg)](https://github.com/z4kn4fein/stashbox/releases) | [![NuGet Version](https://buildstats.info/nuget/Stashbox)](https://www.nuget.org/packages/Stashbox/) | [![Stashbox on fuget.org](https://www.fuget.org/packages/Stashbox/badge.svg)](https://www.fuget.org/packages/Stashbox) | [![Nuget pre-release](https://img.shields.io/nuget/vpre/Stashbox)](https://www.nuget.org/packages/Stashbox/)
[![Github release](https://img.shields.io/github/release/z4kn4fein/stashbox.svg)](https://github.com/z4kn4fein/stashbox/releases) | [![NuGet Version](https://buildstats.info/nuget/Stashbox)](https://www.nuget.org/packages/Stashbox/) | [![Stashbox on fuget.org](https://www.fuget.org/packages/Stashbox/badge.svg?v=3.6.0)](https://www.fuget.org/packages/Stashbox) | [![Nuget pre-release](https://img.shields.io/nuget/vpre/Stashbox)](https://www.nuget.org/packages/Stashbox/)

## Core attributes
## 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
## Supported Platforms

- .NET 4.0 and above
- .NET Core
Expand All @@ -29,7 +29,7 @@ Github (stable) | NuGet (stable) | Fuget (stable) | NuGet (daily)
- Unity

## Contact & Support
- [![Join the chat at https://gitter.im/z4kn4fein/stashbox](https://img.shields.io/gitter/room/z4kn4fein/stashbox.svg)](https://gitter.im/z4kn4fein/stashbox) [![Slack](https://img.shields.io/badge/chat-on%20slack-orange.svg?style=flat)](https://3vj.short.gy/stashbox-slack) [![OpenHub](https://www.openhub.net/p/stashbox/widgets/project_thin_badge?format=gif)](https://www.openhub.net/p/stashbox)
- [![Join the chat at https://gitter.im/z4kn4fein/stashbox](https://img.shields.io/gitter/room/z4kn4fein/stashbox.svg)](https://gitter.im/z4kn4fein/stashbox) [![Slack](https://img.shields.io/badge/chat-on%20slack-orange.svg?style=flat)](https://3vj.short.gy/stashbox-slack)
- Create an [issue](https://github.com/z4kn4fein/stashbox/issues) for bug reports, feature requests, or questions.
- Add a ⭐️ to support the project!

Expand Down
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](assets/images/icon.png)

# Stashbox <small>3.5.1</small>
# Stashbox <small>3.6.0</small>

> A lightweight, fast, and portable .NET DI framework.
Expand Down
21 changes: 10 additions & 11 deletions docs/_glossary.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Glossary
The following definitions are used in the documentation.

## Service type | Implementation type
## 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*.

<!-- panels:start -->
Expand All @@ -19,7 +19,7 @@ container.Resolve<IService>(); // returns Implementation
```
<!-- panels:end -->

## Service registration | Registered service
## Service Registration | Registered Service
It's an entity created by the container 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.

<!-- panels:start -->
Expand All @@ -34,7 +34,7 @@ var service = container.Resolve<IService>("Example");
```
<!-- panels:end -->

## Injectable dependency
## Injectable Dependency

<!-- panels:start -->
<!-- div:left-panel -->
Expand All @@ -51,7 +51,7 @@ class Implementation : IService
```
<!-- panels:end -->

## Resolution tree
## Resolution Tree
It's the structural representation of how the container resolves a service's dependencies for instantiation.

Let's see through an example:
Expand Down Expand Up @@ -79,25 +79,24 @@ When we request the service `A`, the container builds up the following resolutio
```
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](usage/lifetimes?id=transient-lifetime)) and injected into `A` along with the previously created `B`.

## Dependency resolver
It's the container itself or the [current scope](usage/scopes), depending on which was requested to resolve a particular service. They are both implementing Stashbox's `IDependencyResolver` and the .NET framework's `IServiceProvider` interface and can be used for resolution purposes.
## Dependency Resolver
It's the container itself or the [current scope](usage/scopes), depending on which was requested 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 purposes.

?> Stashbox implicitly injects the [current scope](usage/scopes) everywhere `IDependencyResolver` or `IServiceProvider` is requested.
?> Stashbox implicitly injects the [current scope](usage/scopes) wherever `IDependencyResolver` or `IServiceProvider` is requested.

## Root scope
It's the [main scope](usage/scopes) created inside every container instance. It stores and handles the lifetime of all singletons. It's the base of all subsequent scopes created by a container with the `.BeginScope()` method.
## Root Scope
It's the [main scope](usage/scopes) created inside every container instance. It stores and handles the lifetime of all singletons. It's the base of all subsequent scopes created by the container with the `.BeginScope()` method.

!> [Scoped services](usage/lifetimes?id=scoped-lifetime) requested from the container (and not from a [scope](usage/scopes)) will be managed by the root scope. This can lead to issues because their lifetime will switch to singleton. Always be sure that you are not resolving scoped services directly from the container, only from a [scope](usage/scopes).

## Named resolution
## Named Resolution

<!-- panels:start -->
<!-- div:left-panel -->
It's a resolution request for a named service. The same applies, when the container sees that a dependency in the resolution tree has a name (set by [attributes](usage/service-resolution?id=attributes) or [bindings](usage/service-resolution?id=dependency-binding)), it will search for a matching [Named registration](usage/basics?id=named-registration) to inject.
<!-- div:right-panel -->
```cs
container.Register<IService, Implementation>("Example");

// the named resolution initiated by request.
var service = container.Resolve<IService>("Example");
```
Expand Down
18 changes: 9 additions & 9 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
- **Getting started**
- [Overview](getting-started/overview)
- [Quick start](getting-started/quick-start)
- [Quick Start](getting-started/quick-start)
- [Glossary](_glossary)
- **Using Stashbox**
- [Basic usage](usage/basics)
- [Advanced registration](usage/advanced-registration)
- [Service resolution](usage/service-resolution)
- [Basic Usage](usage/basics)
- [Advanced Registration](usage/advanced-registration)
- [Service Resolution](usage/service-resolution)
- [Scopes](usage/scopes)
- [Lifetimes](usage/lifetimes)
- **Configuration**
- [Registration configuration](configuration/registration-configuration)
- [Container configuration](configuration/container-configuration)
- [Registration Configuration](configuration/registration-configuration)
- [Container Configuration](configuration/container-configuration)
- **Advanced topics**
- [Generics](advanced/generics)
- [Decorators](advanced/decorators)
- [Resolvers](advanced/resolvers)
- [Child container](advanced/child-container)
- [Child Containers](advanced/child-containers)
- [Special Resolution Cases](advanced/special-resolution-cases)
- **Diagnostics**
- [Validation](diagnostics/validation)
- [Exceptions](diagnostics/exceptions)
- [Utilities](diagnostics/utilities)
- **Links**
- [<img src="assets/images/slack.svg" alt="Slack" width=16>Slack](https://3vj.short.gy/stashbox-slack)
- [<img src="assets/images/gitter.svg" alt="Gitter" width=16>Gitter](https://gitter.im/z4kn4fein/stashbox)
- [<img src="assets/images/github.svg" alt="GitHub" width=16>GitHub](https://github.com/z4kn4fein/stashbox)
- [<img src="assets/images/nuget.svg" alt="NuGet" width=16>NuGet](https://www.nuget.org/packages/Stashbox/)
- [<img src="assets/images/api.svg" alt="API" width=16>API documentation](https://www.fuget.org/packages/Stashbox/)
- [<img src="assets/images/api.svg" alt="API" width=16>API Documentation](https://www.fuget.org/packages/Stashbox/)
Loading

0 comments on commit 20953ba

Please sign in to comment.