Table of Contents

Class BreezeEntityValidator

Namespace
Breeze.Persistence
Assembly
Breeze.Persistence.dll

Validates entities using Breeze metadata. This duplicates the validation performed on the Breeze client.

public class BreezeEntityValidator
Inheritance
BreezeEntityValidator
Inherited Members

Constructors

BreezeEntityValidator(PersistenceManager, BreezeMetadata)

Create a new instance.

public BreezeEntityValidator(PersistenceManager persistenceManager, BreezeMetadata breezeMetadata)

Parameters

persistenceManager PersistenceManager

Used for getting entity keys for building EntityError objects.

breezeMetadata BreezeMetadata

Contains breeze metadata. The structuralTypeList is extracted from it.

BreezeEntityValidator(PersistenceManager, List<MetaType>)

Create a new instance.

public BreezeEntityValidator(PersistenceManager persistenceManager, List<MetaType> structuralTypeList)

Parameters

persistenceManager PersistenceManager

Used for getting entity keys for building EntityError objects.

structuralTypeList List<MetaType>

Contains the validator information for properties of entity and complex types.

Methods

ValidateEntities(Dictionary<Type, List<EntityInfo>>, bool)

Validate all the entities in the saveMap.

public List<EntityError> ValidateEntities(Dictionary<Type, List<EntityInfo>> saveMap, bool throwIfInvalid)

Parameters

saveMap Dictionary<Type, List<EntityInfo>>

Map of type to entities.

throwIfInvalid bool

If true, throws an EntityErrorsException if any entity is invalid

Returns

List<EntityError>

List containing an EntityError for each failed validation.

Exceptions

EntityErrorsException

Contains all the EntityErrors. Only thrown if throwIfInvalid is true.

ValidateEntity(EntityInfo, List<EntityError>)

Validates a single entity. Skips validation (returns true) if entity is marked Deleted.

public bool ValidateEntity(EntityInfo entityInfo, List<EntityError> entityErrors)

Parameters

entityInfo EntityInfo

contains the entity to validate

entityErrors List<EntityError>

An EntityError is added to this list for each error found in the entity

Returns

bool

true if entity is valid, false if invalid.