Ministry.FluentGuard 1.0.2

Parameter checking extension methods

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

This project provides simple extension methods for handling argument validation in a fluent form.

Examples

Here's some examples of how it can be used...

public void MyMethod(object param1)
{
    param1.ThrowIfNull(nameof(param1));     
}

public void MyMethod(string param1)
{
    param1.ThrowIfNullOrEmpty(nameof(param1));    
}

It is fully fluent, returning the original object, allowing methods like this...

public int Increment(int? param1)
    => param1.ThrowIfNull(nameof(param1)) + 1;

Available Methods

The following fluent error checkas are available along with the exceptions they can generate (depedning on the value)...

  • ThrowIfNull - ArgumentNullException
  • ThrowIfNullOrEmpty - ArgumentNullException / ArgumentException
  • ThrowIf - ArgumentException
  • ThrowOutOfRangeIf - ArgumentOutOfRangeException

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

This project provides simple extension methods for handling argument validation in a fluent form.

Examples

Here's some examples of how it can be used...

public void MyMethod(object param1)
{
    param1.ThrowIfNull(nameof(param1));     
}

public void MyMethod(string param1)
{
    param1.ThrowIfNullOrEmpty(nameof(param1));    
}

It is fully fluent, returning the original object, allowing methods like this...

public int Increment(int? param1)
    => param1.ThrowIfNull(nameof(param1)) + 1;

Available Methods

The following fluent error checkas are available along with the exceptions they can generate (depedning on the value)...

  • ThrowIfNull - ArgumentNullException
  • ThrowIfNullOrEmpty - ArgumentNullException / ArgumentException
  • ThrowIf - ArgumentException
  • ThrowOutOfRangeIf - ArgumentOutOfRangeException

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

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Ministry.FluentGuard:

Package Downloads
Ministry.StrongTyped
A Library of classes to allow strongly typed class building.
Ministry.Compositions
Library of Functional Composition Extension Methods
Ministry.Reflection
Reflection helper library
Ministry.String
String helper methods
Ministry.Web.ApiSecurity
Library for adding security options to API endpoints

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.2 1,145 10/27/2018
1.0.1 1,158 5/9/2018
1.0.0 411 3/21/2018