Ministry.State 0.4.1

Additional Details

Deprecated due to deprecation of AspNet Core 1 & 2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ministry.State --version 0.4.1                
NuGet\Install-Package Ministry.State -Version 0.4.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ministry.State" Version="0.4.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ministry.State --version 0.4.1                
#r "nuget: Ministry.State, 0.4.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ministry.State as a Cake Addin
#addin nuget:?package=Ministry.State&version=0.4.1

// Install Ministry.State as a Cake Tool
#tool nuget:?package=Ministry.State&version=0.4.1                

A selection of libraries, each providing different base state storage implementations that become easilly interchangable.

This replaces the traditional strink=g dictionary based methods of accessing state storage which, when used out of the box, make testing impossible with a solid mockable interface and alternative implementations to swap out web sesion with in memory state, for example.

WebSession

Using Session State in your Application

Use a WebSessionStateBase class. Recommended usage is to inherit from this class in your application and use that class to access session state. You can then swap out your session wrapper with any other implementation of IStateStorage to enable testing of components that previously would have been extremely hard to test because of a dependency on session state.

Faking WebSession

The IStateStorage interface provides an in-memory alternative to Session that can be used within your tests to remove a dependency on session state by using a custom implementation using InMemoryStateBase.

Cookies

The CookieStateBase class provides an IStateStorage base implementation that stores and retrieves values from cookies directly.

Application State

Applicaton state can be accessed using exactly the same methodology by inheriting from the ApplicationStateBase class.

Composite State

IStateStorage is non judgemental - It simply provides a way by which you can access and save data. If you want a complex state storage mechanism for your application, you could create your own implementation of IStateStorage with strongly typed properties for all of your key data items and then, internally, use various other IStateStorage implemntations to store different items in different places, making use of Web Session, Cookies and Application state within a single State Repository.

If you extend the IStateStorage interface with your own interface to cover the new properties that you add to it you can then easilly create a fake implementation using InMemorystateBase class for your testing.

This is also an extensible model. You can start simply with your own Sesion implementation extending WebSessionBase but then change your mind and make it composite - none of the consuming code would need to be changed at all.

The Ministry of Technology Open Source Products

Welcome to The Ministry of Technology open source products. All open source Ministry of Technology products are distributed under the MIT License for maximum re-usability. Details on more of our products and services can be found on our website at http://www.minotech.co.uk

Our other open source repositories can be found here...

Where can I get it?

You can download the package for this project from any of the following package managers...

Contribution guidelines

If you would like to contribute to the project, please contact me.

Who do I talk to?

  • Keith Jackson - keith@minotech.co.uk
Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.