/// <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); }
private BOSequenceNumber LoadSequenceNumber(string numberType) { BOSequenceNumber.LoadNumberGenClassDef(_tableName); var criteria = new Criteria("NumberType", Criteria.ComparisonOp.Equals, numberType); var sequenceBOSequenceNumber = BORegistry.DataAccessor.BusinessObjectLoader.GetBusinessObject <BOSequenceNumber>(criteria); if (sequenceBOSequenceNumber != null) { return(sequenceBOSequenceNumber); } sequenceBOSequenceNumber = CreateSequenceForType(numberType); return(sequenceBOSequenceNumber); }
/// <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 }); }