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
persistenceManagerPersistenceManagerUsed for getting entity keys for building EntityError objects.
breezeMetadataBreezeMetadataContains breeze metadata. The structuralTypeList is extracted from it.
BreezeEntityValidator(PersistenceManager, List<MetaType>)
Create a new instance.
public BreezeEntityValidator(PersistenceManager persistenceManager, List<MetaType> structuralTypeList)
Parameters
persistenceManagerPersistenceManagerUsed for getting entity keys for building EntityError objects.
structuralTypeListList<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
saveMapDictionary<Type, List<EntityInfo>>Map of type to entities.
throwIfInvalidboolIf 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
entityInfoEntityInfocontains the entity to validate
entityErrorsList<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.