C# Class Habanero.BO.ObjectTreeXmlReader

This class reads an xml stream and loads the objects in it into an IEnumerable[IBusinessObject]. It will update existing objects. For example, if you are deserialising an object from an xml stream that exists in your data store, it will load the object from the data store and update its properties from the xml stream. It won't persist after this. If the object does not exist in the data store then it will instantiate the object and set up its properties as a new object, ready to persist.
Mostrar archivo Open project: Chillisoft/habanero Class Usage Examples

Public Methods

Method Description
Read ( Stream stream ) : IEnumerable

Reads from a stream that contains xml text. Creates the XmlReader that reads the stream and then uses a default IBusinessObjectXmlReader to create the objects from the xml. Any errors that occur when setting properties on objects will be added to the ReadResult property. Once this method returns, check the Successful flag of the ReadResult to see if there are errors, and check the Message flag to see what the errors were.

Read ( Stream stream, IBusinessObjectXmlReader boReader ) : IEnumerable

Reads from a stream. Uses the given IBusinessObjectXmlReader to create the objects from the xml. Any errors that occur when setting properties on objects will be added to the ReadResult property. Once this method returns, check the Successful flag of the ReadResult to see if there are errors, and check the Message flag to see what the errors were.

Read ( XmlReader xmlReader ) : IEnumerable

Reads from an XmlReader. Uses a default IBusinessObjectXmlReader to create the objects from the xml. Any errors that occur when setting properties on objects will be added to the ReadResult property. Once this method returns, check the Successful flag of the ReadResult to see if there are errors, and check the Message flag to see what the errors were.

Read ( XmlReader xmlReader, IBusinessObjectXmlReader boReader ) : IEnumerable

Reads from a stream. Uses the given IBusinessObjectXmlReader to create the objects from the xml. Any errors that occur when setting properties on objects will be added to the ReadResult property. Once this method returns, check the Successful flag of the ReadResult to see if there are errors, and check the Message flag to see what the errors were.

Read ( string xml ) : IEnumerable

Reads from a string that contains xml text. Creates the XmlReader that reads the string and then uses a default IBusinessObjectXmlReader to create the objects from the xml. Any errors that occur when setting properties on objects will be added to the ReadResult property. Once this method returns, check the Successful flag of the ReadResult to see if there are errors, and check the Message flag to see what the errors were.

Protected Methods

Method Description
ConfigureObjectAfterLoad ( IBusinessObject bo ) : IBusinessObject

Sets up the object after loading. In this case: 1. Tries to load the object from the data store. If it exists: --a. Updates the existing object's properties --b. Returns the existing object 2. Otherwise: --a. Calls the BusinessObject.AfterLoad() method on the object --b. Backs up the property values, setting the persisted values of the properties

GetSettings ( ) : XmlReaderSettings

Returns the default XmlReaderSettings used. Override this to change them.

Private Methods

Method Description
BuildExceptionMessage ( IEnumerable propertyReadExceptions ) : string
ConfigureNewBo ( IBusinessObject bo ) : void
GetExistingBo ( IClassDef classDef, IBusinessObject bo ) : IBusinessObject
TryGetUpdatedExistingBo ( IBusinessObject bo ) : IBusinessObject
UpdateExistingBo ( IBusinessObject bo, IBusinessObject existingBo ) : void

Method Details

ConfigureObjectAfterLoad() protected method

Sets up the object after loading. In this case: 1. Tries to load the object from the data store. If it exists: --a. Updates the existing object's properties --b. Returns the existing object 2. Otherwise: --a. Calls the BusinessObject.AfterLoad() method on the object --b. Backs up the property values, setting the persisted values of the properties
protected ConfigureObjectAfterLoad ( IBusinessObject bo ) : IBusinessObject
bo IBusinessObject The object to configure
return IBusinessObject

GetSettings() protected method

Returns the default XmlReaderSettings used. Override this to change them.
protected GetSettings ( ) : XmlReaderSettings
return System.Xml.XmlReaderSettings

Read() public method

Reads from a stream that contains xml text. Creates the XmlReader that reads the stream and then uses a default IBusinessObjectXmlReader to create the objects from the xml. Any errors that occur when setting properties on objects will be added to the ReadResult property. Once this method returns, check the Successful flag of the ReadResult to see if there are errors, and check the Message flag to see what the errors were.
public Read ( Stream stream ) : IEnumerable
stream Stream The stream to read from. This stream must contain xml text
return IEnumerable

Read() public method

Reads from a stream. Uses the given IBusinessObjectXmlReader to create the objects from the xml. Any errors that occur when setting properties on objects will be added to the ReadResult property. Once this method returns, check the Successful flag of the ReadResult to see if there are errors, and check the Message flag to see what the errors were.
public Read ( Stream stream, IBusinessObjectXmlReader boReader ) : IEnumerable
stream Stream The stream to read the xml from
boReader IBusinessObjectXmlReader The to use. This object /// converts the xml data into business objects, so you can control how the objects are deserialised by /// creating your own.
return IEnumerable

Read() public method

Reads from an XmlReader. Uses a default IBusinessObjectXmlReader to create the objects from the xml. Any errors that occur when setting properties on objects will be added to the ReadResult property. Once this method returns, check the Successful flag of the ReadResult to see if there are errors, and check the Message flag to see what the errors were.
public Read ( XmlReader xmlReader ) : IEnumerable
xmlReader XmlReader The reader to use
return IEnumerable

Read() public method

Reads from a stream. Uses the given IBusinessObjectXmlReader to create the objects from the xml. Any errors that occur when setting properties on objects will be added to the ReadResult property. Once this method returns, check the Successful flag of the ReadResult to see if there are errors, and check the Message flag to see what the errors were.
public Read ( XmlReader xmlReader, IBusinessObjectXmlReader boReader ) : IEnumerable
xmlReader XmlReader The xml reader to use
boReader IBusinessObjectXmlReader The to use. This object /// converts the xml data into business objects, so you can control how the objects are deserialised by /// creating your own.
return IEnumerable

Read() public method

Reads from a string that contains xml text. Creates the XmlReader that reads the string and then uses a default IBusinessObjectXmlReader to create the objects from the xml. Any errors that occur when setting properties on objects will be added to the ReadResult property. Once this method returns, check the Successful flag of the ReadResult to see if there are errors, and check the Message flag to see what the errors were.
public Read ( string xml ) : IEnumerable
xml string The xml to read
return IEnumerable