Ministry.StrongTyped 1.4.0

Additional Details

This project used to do many things but now is just a stub package that references a load of smaller packages containing the functionality that was previously in this package to provide an upgrade path.

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Ministry.StrongTyped --version 1.4.0
NuGet\Install-Package Ministry.StrongTyped -Version 1.4.0
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.StrongTyped" Version="1.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ministry.StrongTyped --version 1.4.0
#r "nuget: Ministry.StrongTyped, 1.4.0"
#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.StrongTyped as a Cake Addin
#addin nuget:?package=Ministry.StrongTyped&version=1.4.0

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

Ministry.StrongTyped

This project is set up to provide base classes for generating strongly typed access to traditionally simple object or string type stores, such as ASP.Net Session state and the matching interfaces and test fakes to enable simple unit testing scenarios for the same.

Parameter Checking

As coders we frequently find ourselves writing the same code over and over again to check the validity of passed parameters to a method. Using the CheckParameter static class in the Ministry.StrongTyped library you can replace this...

#!c#
if (myParameter == null) throw new ArgumentNullException("myParameter");

with

#!c#
CheckParameter.IsNotNull(myParameter, "myParameter");

or, for Strings and StringBuilders, this...

#!c#
if (myParameter == null) throw new ArgumentNullException("myParameter");
if (myParameter == String.Empty) throw new ArgumentException("The parameter 'myParameter' cannot be empty", myParameter );

with

#!c#
CheckParameter.IsNotNullOrEmpty(myParameter, "myParameter");

There is also a method for passing in your own criteria matching function.

String Manipulations

The library adds a suite of extension methods to Strings...

  • AddSpacesByCasing - Adds spaces between ProperCased words.
  • AddCharactersByCasing - Adds characters between ProperCased words.
  • IsNullOrEmpty - Returns true if the string is null or empty.
  • IsNotNullOrEmpty - Returns true if the string is not null or empty.
  • RemoveFromEnd - Removes a given number of characters from the end of the string.
  • RemoveFromStart - Removes a given number of characters from the start of the string.
  • Split - Converts a delimited string into an array.

And also to StringBuilders...

  • AppendIfEmpty - Appends to the builder only if it is currently empty.
  • AppendIfNotEmpty - Appends to the builder only if it is currently not empty.
  • AppendLineIfEmpty - Appends a line to the builder only if it is currently empty.
  • AppendLineIfNotEmpty - Appends a line to the builder only if it is currently not empty.
  • RemoveFromEnd - Removes a given number of characters from the end.
  • RemoveFromStart - Removes a given number of characters from the start.

And to collections...

  • Delimit - Converts an IEnumerable of strings or KeyValuePairs into a single delimited string.
  • List - Converts an IEnumerable of strings or KeyValuePairs into a single, line terminator delimited list.

Conversions

A selection of extension methods to provide easy conversion between some of the primary data types.

  • Boolean.ToInt32 - Converts a boolean value to an integer with optional parameters to specify the translated true and false values.
  • Boolean.ToString - Takes a defined type of conversion to convert a bool value into either True / False, Yes / No or Y / N strings.
  • Int32.ToBoolean - Converts an integer greater than 0 into true.
  • String.ToBoolean - Converts any valid string to a representative boolean value. The conversion is case insensitive and will take either 1 / 0 / -1, Yes / No, True / False or Y / N as valid input strings.

WebSession

Using Session State in your Application

Use a WebSessionBase 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 IWebSession to enable testing of components that previously would have been extremely hard to test because of a dependency on session state.

Faking WebSession

The IWebSession interface provides an in-memory alternative to Session that can be used within your tests to remove a dependency on session state by using the IWebSession interface instead.

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.ministryotech.co.uk

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

Most of our content is stored on both Github and Bitbucket.

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.

The source code can be used in a simple text editor or within Visual Studio using NodeJS Tools for Visual Studio.

Who do I talk to?

  • Keith Jackson - keith@ministryotech.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.

Version Downloads Last updated

Fixed a minor bug in null returns on get from session state.