netfx-System.AmbientSingleton 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).

Install-Package netfx-System.AmbientSingleton -Version 1.2.1
dotnet add package netfx-System.AmbientSingleton --version 1.2.1
<PackageReference Include="netfx-System.AmbientSingleton" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add netfx-System.AmbientSingleton --version 1.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

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.

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.

Version History

Version Downloads Last updated
1.2.1 1,658 1/21/2013
1.2.0 853 1/14/2013
1.1.0 938 12/3/2012
1.0.0 1,334 1/10/2012