You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

Architect.AmbientContexts

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Architect.AmbientContexts

Provides the basis for implementing the Ambient Context pattern. Includes a Clock implementation based on it. The Ambient Context pattern is an Inversion of Control (IoC) pattern that provides static access to a dependency while controlling the dependency from the outside. The pattern optimizes code reachability at the cost of reduced transparency, making it suitable for obvious, ubiquitous, rarely-changing dependencies. For example, an entity's constructor can access Clock.UtcNow, avoiding the need to inject the creation datetime or a dependency, at the cost of hiding the fact that a unit test could control the timestamp from the outside. An example from .NET is System.Transactions.TransactionScope. Any code (such as the database connector) can access the static Transaction.Current, yet outer code in the current execution flow controls it, through TransactionScopes. https://github.com/TheArchitectDev/Architect.AmbientContexts Release notes: 2.0.1: - Updated dependencies to the latest versions and removed some unused dependencies. 2.0.0: - BREAKING: ClockScope no longer has a configurable default scope. (See also next item). - BREAKING: Removed explicit support for "configured default scopes", i.e. scopes configured on startup. They posed too many concurrency risks, such as in test runs. (Default scopes without any configuration are still supported.) - BREAKING: Removed the RemoveAmbientScope() method. Deactivate() should be used instead. - Added support for netstandard2.0. - ClockScope's constructor now prefers UTC datetimes, to avoid lossy conversions (due to DST). - ClockScope now exposes a convenience constructor that takes a DateTime instead of a Func<DateTime>. 1.1.1: - Manually disposing scopes from a deeper async level (such as a DisposeAsync() method with the async keyword) now properly affects methods up the call stack and no longer breaks scope nesting. - Improved the protections against race conditions. - Parent properties are no longer unset on disposal (although implementations should not rely on this detail). - Performance improvement: A scope now avoids even instantiating its AsyncLocal as long as only its default scope is used, as is common in production for certain scopes. - Performance improvement: The JIT can now inline more code, since exceptions have been moved into helper methods. 1.1.0: - Introduced non-generic AmbientScope base class. - Performance improvement: A scope now avoids touching its AsyncLocal as long as only its default scope is used, as is common in production for certain scopes.

2.0.1
nugetNuGet
Version published
Maintainers
1
Created
The README file is missing

Keywords

AmbientContext

FAQs

Package last updated on 19 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts