nspectre - declarative validation for .NET

Generator.CreateSimpleFunctionSpecification Method 

Creates an instance of a generated class implementing ISpecification.

public string CreateSimpleFunctionSpecification(
   MethodInfo function,
   string namespace,
   string name,
   Type target,
   Properties properties,
   string errorMessage,
   string key
);

Parameters

function
The function to call from the body of the IsSatisfied method.
namespace
The namespace in which the class resides.
name
The name of the class to generate.
target
The type that will be passed into the IsSatisfied method as a candidate.
properties
The properties collection used to call the function.
errorMessage
The error message to use if the candidate does not satisfy the specification.
key
A key to be used by any validation errors which are raised by this specification

Return Value

The name of the type implementing ISpecification.

See Also

Generator Class | NSpectre.Core.Engine Namespace