public override void PreExecute() { this.columnInformation = new List <ColumnInfo>(); IDTSOutput100 output = ComponentMetaData.OutputCollection[0]; var cloudStorageAccount = CloudStorageAccount.Parse((string)this.ComponentMetaData.CustomPropertyCollection["StorageConnectionString"].Value); context = new GenericTableContext(cloudStorageAccount.TableEndpoint.AbsoluteUri, cloudStorageAccount.Credentials); foreach (IDTSOutputColumn100 col in output.OutputColumnCollection) { ColumnInfo ci = new ColumnInfo(); ci.BufferColumnIndex = BufferManager.FindColumnByLineageID(output.Buffer, col.LineageID); ci.ColumnName = col.Name; columnInformation.Add(ci); } }
public override IDTSCustomProperty100 SetComponentProperty(string propertyName, object propertyValue) { var resultingColumn = base.SetComponentProperty(propertyName, propertyValue); var storageConnectionString = (string)this.ComponentMetaData.CustomPropertyCollection["StorageConnectionString"].Value; var strSource = (string)this.ComponentMetaData.CustomPropertyCollection["TableName"].Value; string tableName = string.Empty; string srcPartitionKey = string.Empty; if (strSource != string.Empty) { string[] str1 = strSource.Split(';'); tableName = str1[0].Split('=')[1]; srcPartitionKey = str1[1].Split('=')[1]; } if (!string.IsNullOrEmpty(storageConnectionString) && !string.IsNullOrEmpty(tableName)) { var cloudStorageAccount = CloudStorageAccount.Parse(storageConnectionString); var context = new GenericTableContext(cloudStorageAccount.TableEndpoint.AbsoluteUri, cloudStorageAccount.Credentials); var firstRow = context.GetFirstOrDefault(tableName); if (firstRow != null) { var output = this.ComponentMetaData.OutputCollection[0]; foreach (var column in firstRow.GetProperties()) { var newOutputCol = output.OutputColumnCollection.New(); newOutputCol.Name = column.ColumnName; newOutputCol.SetDataTypeProperties(column.DtsType, 0, 0, 0, 0); } } } return(resultingColumn); }