netfx-System.AmbientSingleton
1.2.1
dotnet add package netfx-System.AmbientSingleton --version 1.2.1
NuGet\Install-Package netfx-System.AmbientSingleton -Version 1.2.1
<PackageReference Include="netfx-System.AmbientSingleton" Version="1.2.1" />
paket add netfx-System.AmbientSingleton --version 1.2.1
#r "nuget: netfx-System.AmbientSingleton, 1.2.1"
// Install netfx-System.AmbientSingleton as a Cake Addin #addin nuget:?package=netfx-System.AmbientSingleton&version=1.2.1 // Install netfx-System.AmbientSingleton as a Cake Tool #tool nuget:?package=netfx-System.AmbientSingleton&version=1.2.1
Provides an easy way to implement the singleton (anti?) pattern so that it is ambient-safe, propagates with a call context and can be overriden per ambient (i.e. in tests).
Learn more about Target Frameworks and .NET Standard.
-
- netfx-Guard (>= 1.3.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on netfx-System.AmbientSingleton:
Package | Downloads |
---|---|
Adapter.Interfaces.Source
Only two APIs are provided: the IAdapterService and its facade extension method As in the Adapters type. You can chose to use the former service directly instead of the convenience extension method. You don't lose any testability in doing either way, although you do need to pass around the adapter service in one case. ======= Example ======= // Calling code assumes there is a service always setup before invoking. // If there isn't, an InvalidOperationException is thrown automatically. // Use adapter extension method As as needed, i.e. // say we need to use it as an MSBuild project, if possible IMSBuildProject msbuild = project.As<IMSBuildProject>(); if (msbuild != null) // do MSBuild stuff with it. |
|
Adapter.Implementation.Source
The provided adapter pattern allows to convert any object to any other supported type, as provided by the registered adapters. This package provides the actual implementation of the service. It should only be added to the bootstrapping component of your application. ======= Example ======= IProject project = GetCurrentProject(); // say we need to use it as an MSBuild project, if possible IMSBuildProject msbuild = project.As<IMSBuildProject>(); if (msbuild != null) // do MSBuild stuff with it. ======= Adapters ======= public class ProjectToMsBuildAdapter : IAdapter<IProject, IMSBuildProject> { // Implement actual conversion. } The conversion behavior is now decoupled from the usage. Note that to create adapter implementations, you need to install the Adapter.Sdk package. |
|
netfx-System.Clock
An IClock interface and default implementation SystemClock to make time-based logic testable. |
|
NetFx.Patterns.Adapter.Interfaces
Provides an the public API to perform general purpose adaptation of one type to another via registered adapters |
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.2.1
* Changed to use CallContext.SetData/GetData instead of forcing LogicalSetData/GetData.
this allows the default behavior of only remoting across AppDomain/process boundaries
the actual values that implement ILogicalThreadAffinative.