Exemplo n.º 1
0
        /// <summary>
        /// Loads the data transported from another system into a <see cref="TransportedDomainObjects"/> container.
        /// </summary>
        /// <param name="stream">The <see cref="Stream"/> from which to load the data.</param>
        /// <param name="strategy">The strategy to use when importing data. This must match the strategy being used with <see cref="Export(System.IO.Stream,Remotion.Data.DomainObjects.DomainImplementation.Transport.IExportStrategy)"/>.</param>
        /// <returns>A container holding the objects loaded from the given data.</returns>
        /// <exception cref="ObjectsNotFoundException">A referenced related object is not part of the transported data and does not exist on the
        /// target system.</exception>
        /// <remarks>
        /// Given a <see cref="DomainObjectTransporter"/>, the binary data can be retrieved from <see cref="Export(System.IO.Stream,Remotion.Data.DomainObjects.DomainImplementation.Transport.IExportStrategy)"/>.
        /// </remarks>
        public static TransportedDomainObjects LoadTransportData(Stream stream, IImportStrategy strategy)
        {
            ArgumentUtility.CheckNotNull("stream", stream);
            ArgumentUtility.CheckNotNull("strategy", strategy);

            return(DomainObjectImporter.CreateImporterFromStream(stream, strategy).GetImportedObjects());
        }
Exemplo n.º 2
0
        public static DomainObjectImporter CreateImporterFromStream(Stream stream, IImportStrategy strategy)
        {
            ArgumentUtility.CheckNotNull("stream", stream);
            ArgumentUtility.CheckNotNull("strategy", strategy);

            var transportItems = strategy.Import(stream).ToArray();

            return(new DomainObjectImporter(transportItems));
        }
Exemplo n.º 3
0
 private TransportedDomainObjects ExportAndLoadTransportData(IImportStrategy importStrategy, IExportStrategy exportStrategy)
 {
     _transporter.Export(_stream, exportStrategy);
     _stream.Seek(0, SeekOrigin.Begin);
     return(DomainObjectTransporter.LoadTransportData(_stream, importStrategy));
 }
 public void UseStrategy(IImportStrategy strategy)
 {
     CurrentStrategy = strategy;
 }
Exemplo n.º 5
0
 private ContactImporter(IImportStrategy importStrategy, string pathToImportedFile)
 {
     ImportStrategy     = importStrategy;
     PathToImportedFile = pathToImportedFile;
 }
 public CustomerProcessor(IImportStrategy importStrategy)
 {
     ImporterStrategy = importStrategy;
 }