/// <summary>
        /// Creates a new instance of <see cref="SurfaceLinesCsvImporterConfiguration{T}"/>.
        /// </summary>
        /// <param name="transformer">The transformer to use in this configuration.</param>
        /// <param name="updateStrategy">The strategy to use in this configuration.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="transformer"/>
        /// or <paramref name="updateStrategy"/> is <c>null</c>.</exception>
        public SurfaceLinesCsvImporterConfiguration(ISurfaceLineTransformer <T> transformer, ISurfaceLineUpdateDataStrategy <T> updateStrategy)
        {
            if (updateStrategy == null)
            {
                throw new ArgumentNullException(nameof(updateStrategy));
            }

            if (transformer == null)
            {
                throw new ArgumentNullException(nameof(transformer));
            }

            UpdateStrategy = updateStrategy;
            Transformer    = transformer;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SurfaceLinesCsvImporter{T}"/> class.
        /// </summary>
        /// <param name="importTarget">The import target.</param>
        /// <param name="filePath">The path to the file to import from.</param>
        /// <param name="messageProvider">The message provider to provide messages during importer actions.</param>
        /// <param name="configuration">The mechanism specific configuration containing all necessary surface lines components.</param>
        /// <exception cref="ArgumentNullException">Thrown when any of the input parameters is <c>null</c>.</exception>
        public SurfaceLinesCsvImporter(
            ObservableUniqueItemCollectionWithSourcePath <T> importTarget,
            string filePath,
            IImporterMessageProvider messageProvider,
            SurfaceLinesCsvImporterConfiguration <T> configuration)
            : base(filePath, importTarget)
        {
            if (messageProvider == null)
            {
                throw new ArgumentNullException(nameof(messageProvider));
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            this.messageProvider      = messageProvider;
            surfaceLineUpdateStrategy = configuration.UpdateStrategy;
            updatedInstances          = Enumerable.Empty <IObservable>();
            surfaceLineTransformer    = configuration.Transformer;
        }