public virtual void SetInputUsageType(string name, DTSUsageType usageType) { IDTSVirtualInput90 vi = Component.InputCollection[0].GetVirtualInput(); IDTSVirtualInputColumn90 vcol = vi.VirtualInputColumnCollection[name]; SetInputUsageType(vi, vcol, usageType); }
/// <summary> /// Automap must ALWAYS be called BEFORE Map() otherwise bad things will happen to the SSIS Metadata. /// </summary> protected void AutoMap() { IDTSVirtualInput90 cvi = _oledbDest.InputCollection[0].GetVirtualInput(); // The indexing APIs for collections in DTS are terrible and don't easily expose the right functions. // Building a temporary Virtual Input dictionary is much, much easier. Dictionary <string, IDTSVirtualInputColumn90> virtualInputDictionary = new Dictionary <string, IDTSVirtualInputColumn90>(); foreach (IDTSVirtualInputColumn90 vc in cvi.VirtualInputColumnCollection) { virtualInputDictionary[vc.Name.ToUpperInvariant()] = vc; } // Automatically map columns foreach (IDTSExternalMetadataColumn90 extCol in _oledbDest.InputCollection[0].ExternalMetadataColumnCollection) { if (virtualInputDictionary.ContainsKey(extCol.Name.ToUpperInvariant())) { IDTSVirtualInputColumn90 vc = virtualInputDictionary[extCol.Name.ToUpperInvariant()]; _oledbDestI.SetUsageType( _oledbDest.InputCollection[0].ID, cvi, vc.LineageID, DTSUsageType.UT_READONLY ); _oledbDest.InputCollection[0].InputColumnCollection[vc.Name].ExternalMetadataColumnID = extCol.ID; } } }
public virtual void SetInputUsageType(IDTSVirtualInput90 vi, IDTSVirtualInputColumn90 vcol, DTSUsageType usageType, bool forceOverwrite) { // This will not make a DT_READWRITE column more restrctive :) Only less restrictive if (vcol.UsageType != DTSUsageType.UT_READWRITE || forceOverwrite) { ComponentInstance.SetUsageType( Component.InputCollection[0].ID, vi, vcol.LineageID, usageType ); } }
public virtual void SetInputUsageType(IDTSVirtualInput90 vi, IDTSVirtualInputColumn90 vcol, DTSUsageType usageType) { this.SetInputUsageType(vi, vcol, usageType, false); }
public virtual void SetInputUsageType(IDTSVirtualInput90 vi, IDTSVirtualInputColumn90 vcol, DTSUsageType usageType, bool forceOverwrite) { // This will not make a DT_READWRITE column more restrctive :) Only less restrictive if (vcol.UsageType != DTSUsageType.UT_READWRITE || forceOverwrite) { ComponentInstance.SetUsageType( Component.InputCollection[0].ID, vi, vcol.LineageID, usageType ); } }
public virtual void SetInputUsageType(IDTSVirtualInput90 vi, IDTSVirtualInputColumn90 vcol, DTSUsageType usageType) { this.SetInputUsageType(vi, vcol, usageType, false); }