![]() |
VOOZH | about |
dotnet add package Ministry.State --version 6.0.0
NuGet\Install-Package Ministry.State -Version 6.0.0
<PackageReference Include="Ministry.State" Version="6.0.0" />
<PackageVersion Include="Ministry.State" Version="6.0.0" />Directory.Packages.props
<PackageReference Include="Ministry.State" />Project file
paket add Ministry.State --version 6.0.0
#r "nuget: Ministry.State, 6.0.0"
#:package Ministry.State@6.0.0
#addin nuget:?package=Ministry.State&version=6.0.0Install as a Cake Addin
#tool nuget:?package=Ministry.State&version=6.0.0Install as a Cake Tool
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.
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.
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.
The CookieStateBase class provides an IStateStorage base implementation that stores and retrieves values from cookies directly.
Application state can be accessed using exactly the same methodology by inheriting from the ApplicationStateBase class.
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.
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
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...
You can download the package for this project from any of the following package managers...
If you would like to contribute to the project, please contact me.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 6.0.0 | 383 | 12/29/2023 | |
| 2.1.0 | 210 | 12/29/2023 | 2.1.0 is deprecated because it is no longer maintained. |
| 2.0.0 | 3,203 | 10/28/2018 | 2.0.0 is deprecated because it is no longer maintained. |
| 1.1.0 | 260 | 12/29/2023 | 1.1.0 is deprecated because it is no longer maintained. |
| 1.0.0 | 900 | 10/28/2018 | 1.0.0 is deprecated because it is no longer maintained. |
| 0.4.1 | 11,231 | 10/28/2018 | 0.4.1 is deprecated because it is no longer maintained. |