private void btnNewContainer_Click(object sender, EventArgs e) { ConnectionManagerMappingEventArgs args = new ConnectionManagerMappingEventArgs(); args.ConnectionManagerElement = this.cmbCM.SelectedItem as ConnectionManagerElement; ConnectionManager cm = this.GetSelectedConnectionManager(this, args); Connection conn = cm.AcquireConnection(null) as Connection; Microsoft.Samples.DataServices.Connectivity.Container cont = conn.CreateContainer(this.ContainerId); if (cont != null) { this.cmbContainerID.Items.Add(this.ContainerId); this.cmbContainerID.SelectedIndex = this.cmbContainerID.Items.Count - 1; MessageBox.Show("Created new container: " + this.ContainerId); } else { MessageBox.Show("Failed to create a new container.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
static internal Container Create(Connection connection, SitkaClient.Entity sitkaContainer) { Container newContainer = new Container(); newContainer.CopyFrom(sitkaContainer); newContainer.connection = connection; return newContainer; }
private Entity[] GetEntities(bool preview, string lastId) { Debug.Assert(_connection != null); // Fetch the container if (_container == null) { string containerId = (string)GetPropertyValue("ContainerID"); Debug.Assert(!string.IsNullOrEmpty(containerId)); _container = _connection.GetContainerById(containerId); } // Get our entities string kind = (string)GetPropertyValue("EntityKind"); string where = (string)GetPropertyValue("Query"); int entityCount = 0; if (preview) { entityCount = (int)GetPropertyValue("PreviewCount"); } // Get the query for logging purposes string query = Container.BuildQuery(kind, lastId, entityCount, where); ComponentMetaData.FireInformation(0, "SSDS Source", string.Format(CultureInfo.CurrentUICulture, "Running query: {0}", query), string.Empty, 0, ref _cancel); Entity[] entities = _container.GetEntitiesByQuery(query); return entities; }
public Container[] GetContainers() { SitkaClient.Entity[] containers = service.Query(_scope, GetAllQuery); Container[] newArray = new Container[containers.Length]; for (int i = 0; i < containers.Length; i++) { Container c = Container.Create(this, containers[i]); newArray[i] = c; } return newArray; }
/// <summary> /// Called before execution. Initialize resources. /// </summary> public override void PreExecute() { _ContainerID = (string)this.GetPropertyValue("ContainerID"); _idColumnName = (string)this.GetPropertyValue("IDColumn"); _EntityKind = (string)this.GetPropertyValue("EntityKind"); _CreateNewID = (bool)this.GetPropertyValue("CreateNewID"); _multithread = (bool)this.GetPropertyValue("UseMultithreadInsert"); _Container = _con.GetContainerById(_ContainerID); // Cache all of our input column information // We do this here because the calls to the native interops // degrades performance during the ProcessInput() calls. IDTSInput100 input = ComponentMetaData.InputCollection[0]; Debug.Assert(input != null); _inputColumnInfo = new List<InputColumnInfo>(input.InputColumnCollection.Count); foreach (IDTSInputColumn100 column in input.InputColumnCollection) { InputColumnInfo info = new InputColumnInfo(); info.Name = column.Name; info.DataType = column.DataType; info.ID = column.ID; info.Index = BufferManager.FindColumnByLineageID(input.Buffer, column.LineageID); _inputColumnInfo.Add(info); } // Set the ID Column information if (_CreateNewID == false) { bool foundId = false; foreach (InputColumnInfo info in _inputColumnInfo) { if (info.Name == _idColumnName) { _idColumnIndex = info.Index; _idColumnId = info.ID; foundId = true; break; } } if (!foundId) { ComponentMetaData.FireError(0, ComponentMetaData.Name, "Can't find ID Column: " + _idColumnName, string.Empty, 0, out this._cancel); return; } } // Set the Error output ID _errorOutputId = ComponentMetaData.OutputCollection[0].ID; }