./nugetz

#Ambient

15 packages tagged with “Ambient

pkg

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.

v2.0.1329.0K
AmbientContextAmbientScopeambientcontextscope
pkg

Architect.EntityFramework.DbContextManagement

Manage your DbContexts the right way. The persistence or infrastructure layer uses the DbContext (e.g. from a repository). Controlling its scope and transaction lifetime, however, is ideally the reponsibility of the orchestrating layer (e.g. from an application service). This package adds that ability to Entity Framework Core 5.0.0 and up. https://github.com/TheArchitectDev/Architect.EntityFramework.DbContextManagement Release notes: 2.0.1: - Enhancement: Upgraded package versions. 2.0.0: - BREAKING: Now using AmbientContexts 2.0.0. - Semi-breaking: Failure on commit (extremely rare) now throws IOException instead of Exception. - Added static DbContextScope<TDbContext>.HasDbContext, to match the feature set of IDbContextAccessor. - Retries now ensure that the connection is closed before retrying, to avoid the risk of leaking session state. (As with EF's DbContext disposal in general, this relies on the database provider's connection reset.) - Scoped execution now protects against dangerous "failure on commit" retries even on manual commits (rather than just on IExecutionScope's implicit commit). - Worked around an EF bug where the DbContext would obscure the exception caused by a broken model behind an ObjectDisposedException, even though DbContext._disposed=false. - Scoped execution: Fixed a bug where the exception caused by a broken model would be obscured behind a wrongful IncompatibleVersionException. - MockDbContextProvider: Fixed a bug where nested scopes would not work as expected. - MockDbContextProvider: Fixed a bug where soft attempts to roll back a transaction when there was none could cause an unintended TransactionAbortedException. 1.0.1: - Now using AmbientContexts 1.1.1, which fixes extremely rare bugs and improves performance.

v2.0.133.1K
DbContextDbContextScopeAmbientDbContextEntityFrameworkEntity