/// <summary> /// Reads from a stream. Uses the given <see cref="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. /// </summary> /// <param name="xmlReader">The xml reader to use</param> /// <param name="boReader">The <see cref="IBusinessObjectXmlReader"/> to use. This object /// converts the xml data into business objects, so you can control how the objects are deserialised by /// creating your own.</param> /// <returns>A <see cref="DataStoreInMemory"/> containing all objects that were in the xml</returns> public IEnumerable <IBusinessObject> Read(XmlReader xmlReader, IBusinessObjectXmlReader boReader) { BOSequenceNumber.LoadNumberGenClassDef(); var objects = new List <IBusinessObject>(); var bos = boReader.Read(xmlReader); bos.ForEach(bo => objects.Add(ConfigureObjectAfterLoad(bo))); ReadResult = boReader.PropertyReadExceptions.Count() == 0 ? new Result(true) : new Result(false, BuildExceptionMessage(boReader.PropertyReadExceptions)); return(objects); }
/// <summary> /// Reads from a stream. Uses the given <see cref="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. /// </summary> /// <param name="xmlReader">The xml reader to use</param> /// <param name="boReader">The <see cref="IBusinessObjectXmlReader"/> to use. This object /// converts the xml data into business objects, so you can control how the objects are deserialised by /// creating your own.</param> /// <returns>A <see cref="DataStoreInMemory"/> containing all objects that were in the xml</returns> public DataStoreInMemory Read(XmlReader xmlReader, IBusinessObjectXmlReader boReader) { BOSequenceNumber.LoadNumberGenClassDef(); var objects = new ConcurrentDictionary <Guid, IBusinessObject>(); var bos = boReader.Read(xmlReader); bos.ForEach( bo => { var objectToAdd = ConfigureObjectAfterLoad(bo); objects.TryAdd(objectToAdd.ID.GetAsGuid(), objectToAdd); }); ReadResult = !boReader.PropertyReadExceptions.Any() ? new Result(true) : new Result(false, BuildExceptionMessage(boReader.PropertyReadExceptions)); return(new DataStoreInMemory { AllObjects = objects }); }
/// <summary> /// Reads from a stream. Uses the given <see cref="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. /// </summary> /// <param name="xmlReader">The xml reader to use</param> /// <param name="boReader">The <see cref="IBusinessObjectXmlReader"/> to use. This object /// converts the xml data into business objects, so you can control how the objects are deserialised by /// creating your own.</param> /// <returns>A <see cref="DataStoreInMemory"/> containing all objects that were in the xml</returns> public DataStoreInMemory Read(XmlReader xmlReader, IBusinessObjectXmlReader boReader) { BOSequenceNumber.LoadNumberGenClassDef(); var objects = new ConcurrentDictionary<Guid, IBusinessObject>(); var bos = boReader.Read(xmlReader); bos.ForEach( bo => { var objectToAdd = ConfigureObjectAfterLoad(bo); objects.TryAdd(objectToAdd.ID.GetAsGuid(), objectToAdd); }); ReadResult = !boReader.PropertyReadExceptions.Any() ? new Result(true) : new Result(false, BuildExceptionMessage(boReader.PropertyReadExceptions)); return new DataStoreInMemory {AllObjects = objects}; }
/// <summary> /// Reads from a stream. Uses the given <see cref="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. /// </summary> /// <param name="stream">The stream to read the xml from</param> /// <param name="boReader">The <see cref="IBusinessObjectXmlReader"/> to use. This object /// converts the xml data into business objects, so you can control how the objects are deserialised by /// creating your own.</param> /// <returns>A <see cref="DataStoreInMemory"/> containing all objects that were in the xml</returns> public DataStoreInMemory Read(Stream stream, IBusinessObjectXmlReader boReader) { var reader = XmlReader.Create(stream, GetSettings()); return Read(reader, boReader); }
/// <summary> /// Reads from a stream. Uses the given <see cref="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. /// </summary> /// <param name="stream">The stream to read the xml from</param> /// <param name="boReader">The <see cref="IBusinessObjectXmlReader"/> to use. This object /// converts the xml data into business objects, so you can control how the objects are deserialised by /// creating your own.</param> /// <returns>A <see cref="DataStoreInMemory"/> containing all objects that were in the xml</returns> public IEnumerable <IBusinessObject> Read(Stream stream, IBusinessObjectXmlReader boReader) { var reader = XmlReader.Create(stream, GetSettings()); return(Read(reader, boReader)); }
/// <summary> /// Reads from a stream. Uses the given <see cref="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. /// </summary> /// <param name="xmlReader">The xml reader to use</param> /// <param name="boReader">The <see cref="IBusinessObjectXmlReader"/> to use. This object /// converts the xml data into business objects, so you can control how the objects are deserialised by /// creating your own.</param> /// <returns>A <see cref="DataStoreInMemory"/> containing all objects that were in the xml</returns> public IEnumerable<IBusinessObject> Read(XmlReader xmlReader, IBusinessObjectXmlReader boReader) { BOSequenceNumber.LoadNumberGenClassDef(); var objects = new List<IBusinessObject>(); var bos = boReader.Read(xmlReader); bos.ForEach(bo => objects.Add(ConfigureObjectAfterLoad(bo))); ReadResult = boReader.PropertyReadExceptions.Count() == 0 ? new Result(true) : new Result(false, BuildExceptionMessage(boReader.PropertyReadExceptions)); return objects; }
/// <summary> /// Reads from a stream. Uses the given <see cref="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. /// </summary> /// <param name="stream">The stream to read the xml from</param> /// <param name="boReader">The <see cref="IBusinessObjectXmlReader"/> to use. This object /// converts the xml data into business objects, so you can control how the objects are deserialised by /// creating your own.</param> /// <returns>A <see cref="DataStoreInMemory"/> containing all objects that were in the xml</returns> public IEnumerable<IBusinessObject> Read(Stream stream, IBusinessObjectXmlReader boReader) { var reader = XmlReader.Create(stream, GetSettings()); return Read(reader, boReader); }
/// <summary> /// Reads from a stream. Uses the given <see cref="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. /// </summary> /// <param name="stream">The stream to read the xml from</param> /// <param name="boReader">The <see cref="IBusinessObjectXmlReader"/> to use. This object /// converts the xml data into business objects, so you can control how the objects are deserialised by /// creating your own.</param> /// <returns>A <see cref="DataStoreInMemory"/> containing all objects that were in the xml</returns> public DataStoreInMemory Read(Stream stream, IBusinessObjectXmlReader boReader) { var reader = XmlReader.Create(stream, GetSettings()); return(Read(reader, boReader)); }