public bool AddTableExtensionReference( ITableExtensionReference tableExtensionReference) { Guard.NotNull(tableExtensionReference, nameof(tableExtensionReference)); return(this.tablesById.TryAdd(tableExtensionReference.TableDescriptor.Guid, tableExtensionReference)); }
/// <summary> /// Generate a table reference from a given type. /// </summary> /// <param name="candidateType"> /// Data extension type. /// </param> /// <param name="reference"> /// Data extension reference. /// </param> /// <returns> /// <c>true</c> if succeeded, <c>false</c> otherwise. /// </returns> public bool TryCreateTableReference( Type candidateType, out ITableExtensionReference reference) { Guard.NotNull(candidateType, nameof(candidateType)); return(TableExtensionReference.TryCreateReference(candidateType, out reference)); }
/// <summary> /// A table has access to source data cookers, composite data cookers, and data processors. /// </summary> /// <param name="tableExtensionReference"> /// Reference to a table data extension. /// </param> /// <returns> /// A set of data uniquely tailored to this table. /// </returns> public IDataExtensionRetrieval CreateDataRetrievalForTable( ITableExtensionReference tableExtensionReference) { Guard.NotNull(tableExtensionReference, nameof(tableExtensionReference)); if (tableExtensionReference.Availability != DataExtensionAvailability.Available) { throw new ArgumentException("Data retrieval requested for table that is not available."); } var filteredData = new FilteredDataRetrieval(this, tableExtensionReference.DependencyReferences); return(filteredData); }
private void AddTableSourceCookers( ITableExtensionReference tableReference, IDictionary <string, HashSet <ISourceDataCookerFactory> > referencesBySource) { Guard.NotNull(tableReference, nameof(tableReference)); Guard.NotNull(referencesBySource, nameof(referencesBySource)); if (tableReference.Availability != DataExtensionAvailability.Available) { // if a table is selected, it came from the available tables list which were all // confirmed available when the list was populated. how did it change? Debug.Assert(false); return; } var requiredDataCookers = tableReference.DependencyReferences.RequiredSourceDataCookerPaths; foreach (var dataCookerPath in requiredDataCookers) { var dataCookerReference = this.dataExtensions.GetSourceDataCookerReference(dataCookerPath); if (dataCookerReference == null) { // we're only operating on tables that are marked as available. // this means that all required resources are also available in the data extension repository // Debug.Assert(false); continue; } if (string.IsNullOrWhiteSpace(dataCookerReference.Path.SourceParserId)) { // we just pulled this from the RequiredSourceDataCookerPaths, it should have no // data cookers without a valid source Id // Debug.Assert(false); continue; } if (!referencesBySource.ContainsKey(dataCookerReference.Path.SourceParserId)) { referencesBySource.Add(dataCookerReference.Path.SourceParserId, new HashSet <ISourceDataCookerFactory>()); } referencesBySource[dataCookerReference.Path.SourceParserId].Add(dataCookerReference); } }
internal static bool TryCreateReference( Type candidateType, bool allowInternalTables, out ITableExtensionReference reference) { Guard.NotNull(candidateType, nameof(candidateType)); reference = null; if (TableDescriptorFactory.TryCreate( candidateType, tableConfigSerializer, out var isInternalTable, out var tableDescriptor, out var tableBuildAction, out var tableIsDataAvailableFunc)) { if (isInternalTable) { if (!allowInternalTables) { return(false); } Debug.Assert(tableBuildAction != null); } var tableReference = new TableExtensionReference( candidateType, tableDescriptor, tableBuildAction, tableIsDataAvailableFunc); tableReference.IsInternalTable = isInternalTable; reference = tableReference; } return(reference != null); }
/// <inheritdoc /> public IDataExtensionRetrieval GetDataExtensionRetrieval(TableDescriptor tableDescriptor) { lock (this.dataProcessor) { if (this.dataExtensionRetrievalFactory == null) { throw new InvalidOperationException( $"{nameof(FinalizeTables)} must be called before calling " + $"{nameof(GetDataExtensionRetrieval)}."); } } if (!this.tableReferences.ContainsKey(tableDescriptor)) { return(null); } ITableExtensionReference reference = this.tableReferences[tableDescriptor]; Debug.Assert(reference != null); return(this.dataExtensionRetrievalFactory.CreateDataRetrievalForTable(reference)); }
internal static bool TryCreateReference( Type candidateType, out ITableExtensionReference reference) { return(TryCreateReference(candidateType, false, out reference)); }