November Happy Hour will be moved to Thursday December 5th.

Class ValidationService

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Default implemetation of IValidationService.

Inheritance
System.Object
ValidationService
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Validation.Internal
Assembly: EPiServer.Framework.dll
Version: 11.20.7
Syntax
[InitializableModule]
[ModuleDependency(typeof(ServiceContainerInitialization))]
public class ValidationService : IContextValidationService, IValidationService, IInitializableModule
Remarks

The implementation will scan for all implementaions of IValidate<T> and during validation call all instances where type parameter T can be assigned to from the instance that is to be validated.

Constructors

ValidationService()

Declaration
public ValidationService()

Properties

RegisteredValidators

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Gets the registered validators.

Declaration
public IList<ValidatorWrapper> RegisteredValidators { get; }
Property Value
Type Description
System.Collections.Generic.IList<ValidatorWrapper>

The registered validators.

Remarks

The purpose of exposing registered validators is to make it possible to remove any unwanted validator. Note however that the underlying list is not thread safe so any changes to this list should be done from an initialization module.

Methods

Initialize(InitializationEngine)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Initializes this instance.

Declaration
public void Initialize(InitializationEngine context)
Parameters
Type Name Description
InitializationEngine context

The initialization context.

Remarks

Gets called as part of the EPiServer Framework initialization sequence. Note that it will be called only once per AppDomain, unless the method throws an exception. If an exception is thrown, the initialization method will be called repeatedly for each request reaching the site until the method succeeds.

Initialize(ITypeScannerLookup, IServiceLocator)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Initializes a new instance of the ValidationService class.

Declaration
public virtual void Initialize(ITypeScannerLookup typeScannerLookup, IServiceLocator serviceLocator)
Parameters
Type Name Description
ITypeScannerLookup typeScannerLookup

The type scanner lookup.

IServiceLocator serviceLocator

The service locator.

Uninitialize(InitializationEngine)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Resets the module into an uninitialized state.

Declaration
public void Uninitialize(InitializationEngine context)
Parameters
Type Name Description
InitializationEngine context

The context.

Remarks

This method is usually not called when running under a web application since the web app may be shut down very abruptly, but your module should still implement it properly since it will make integration and unit testing much simpler.

Any work done by Initialize(InitializationEngine) as well as any code executing on InitComplete should be reversed.

Validate(Object)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. Validates the specified instance.

Declaration
public IEnumerable<ValidationError> Validate(object instance)
Parameters
Type Name Description
System.Object instance

The instance.

Returns
Type Description
System.Collections.Generic.IEnumerable<ValidationError>

Validate<T>(Object, T)

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice.

Declaration
public IEnumerable<ValidationError> Validate<T>(object instance, T context)
Parameters
Type Name Description
System.Object instance
T context
Returns
Type Description
System.Collections.Generic.IEnumerable<ValidationError>
Type Parameters
Name Description
T

Implements

Extension Methods