/// <summary> /// Enables a source data cooker on the <see cref="SourceProcessingSession"/>. /// </summary> /// <param name="sourceDataCookerFactory">Source data cooker factory</param> public void EnableCooker(ISourceDataCookerFactory sourceDataCookerFactory) { Guard.NotNull(sourceDataCookerFactory, nameof(sourceDataCookerFactory)); if (this.SourceProcessingSession == null) { return; } EnableCookerCore(sourceDataCookerFactory); if (sourceDataCookerFactory.CreateInstance() is ISourceDataCooker <T, TContext, TKey> cooker) { if (!StringComparer.Ordinal.Equals(cooker.Path.SourceParserId, this.SourceParserId)) { Debug.Assert(false, "Attempting to enable a source data cooker on the wrong source parser."); } else { this.SourceProcessingSession.RegisterSourceDataCooker(cooker); this.OnDataCookerEnabled(cooker); } } else { throw new ArgumentException("The given cooker reference is not applicable to this data processor."); } }
private void EnableRequiredSourceDataCookers() { var requiredCookers = this.extensibilitySupport.GetAllRequiredSourceDataCookers(); foreach (var dataCookerPath in requiredCookers) { ISourceDataCookerFactory cookerFactory = this.ApplicationEnvironment.SourceDataCookerFactoryRetrieval.GetSourceDataCookerFactory(dataCookerPath); EnableCooker(cookerFactory); } this.OnAllCookersEnabled(); }
/// <summary> /// Enables an implementation to perform additional processing during a call to <see cref="EnableCooker"/>. /// </summary> /// <param name="sourceDataCookerFactory">Source data cooker factory</param> protected virtual void EnableCookerCore(ISourceDataCookerFactory sourceDataCookerFactory) { }