C# Class Catel.Data.ModelBaseExtensions

Show file Open project: Catel/Catel

Public Methods

Method Description
GetErrorMessage ( this model, string userFriendlyObjectName = null ) : string

Returns a message that contains all the current errors.

GetValidationContextForObjectGraph ( this model ) : IValidationContext

Gets the validation context for a complete object graph by also checking the properties and recursive

GetWarningMessage ( this model, string userFriendlyObjectName = null ) : string

Returns a message that contains all the current warnings.

Save ( this model, Stream stream, ISerializer serializer ) : void

Saves the specified model to the stream using the serializer.

Save ( this model, string filePath, ISerializer serializer ) : void

Saves the specified model to the file using the specified serializer.

SaveAsXml ( this model, Stream stream ) : void

Saves as XML.

SaveAsXml ( this model, string filePath ) : void

Saves the specified model to the file as xml.

Private Methods

Method Description
AddModelValidation ( this validationContext, IModel model, List handledModels ) : void
GetListMessages ( IValidationContext validationContext, ValidationResultType validationResult ) : string

Gets the list messages.

This method is used to create a message string for field warnings or errors and business warnings or errors. Just pass the right dictionary and list to this method.

Method Details

GetErrorMessage() public static method

Returns a message that contains all the current errors.
The is null.
public static GetErrorMessage ( this model, string userFriendlyObjectName = null ) : string
model this The model base.
userFriendlyObjectName string Name of the user friendly object.
return string

GetValidationContextForObjectGraph() public static method

Gets the validation context for a complete object graph by also checking the properties and recursive
The is null.
public static GetValidationContextForObjectGraph ( this model ) : IValidationContext
model this The model.
return IValidationContext

GetWarningMessage() public static method

Returns a message that contains all the current warnings.
The is null.
public static GetWarningMessage ( this model, string userFriendlyObjectName = null ) : string
model this The model base.
userFriendlyObjectName string Name of the user friendly object.
return string

Save() public static method

Saves the specified model to the stream using the serializer.
public static Save ( this model, Stream stream, ISerializer serializer ) : void
model this The model.
stream System.IO.Stream The stream.
serializer ISerializer The serializer.
return void

Save() public static method

Saves the specified model to the file using the specified serializer.
public static Save ( this model, string filePath, ISerializer serializer ) : void
model this The model.
filePath string The file path.
serializer ISerializer The serializer.
return void

SaveAsXml() public static method

Saves as XML.
public static SaveAsXml ( this model, Stream stream ) : void
model this The model.
stream System.IO.Stream The stream.
return void

SaveAsXml() public static method

Saves the specified model to the file as xml.
public static SaveAsXml ( this model, string filePath ) : void
model this The model.
filePath string The file path.
return void