Ministry.State
1.1.0
Deprecated due to deprecation of AspNet Core 1 & 2
See the version list below for details.
dotnet add package Ministry.State --version 1.1.0
NuGet\Install-Package Ministry.State -Version 1.1.0
<PackageReference Include="Ministry.State" Version="1.1.0" />
paket add Ministry.State --version 1.1.0
#r "nuget: Ministry.State, 1.1.0"
// Install Ministry.State as a Cake Addin #addin nuget:?package=Ministry.State&version=1.1.0 // Install Ministry.State as a Cake Tool #tool nuget:?package=Ministry.State&version=1.1.0
A selection of libraries, each providing different base state storage implementations that become easily interchangeable.
This replaces the traditional string 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 session 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
Application 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 implementations 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 easily create a fake implementation using InMemorystateBase class for your testing.
This is also an extensible model. You can start simply with your own Session implementation extending WebSessionBase but then change your mind and make it composite - none of the consuming code would need to be changed at all.
Versions to Use
Use v1.x for AspNet Core 1 Use v2.x for AspNet Core 2 Use v6.x for AspNet Core in net 6 and above
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. 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 - temporal-net@live.co.uk
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.6 is compatible. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 1.6
- Microsoft.AspNetCore.Mvc (>= 1.1.8)
- Microsoft.Extensions.DependencyModel (>= 3.1.25)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.