/// <summary> /// Gets the rows that reside in the version that corresponds to the state. /// </summary> /// <param name="changeVersion">The change version.</param> /// <returns> /// Returns a <see cref="IEnumerable{IRow}" /> representing the rows for the state. /// </returns> /// <exception cref="System.NotSupportedException">The row state is not supported.</exception> public IEnumerable <IRow> GetRows(DeltaRowChangeVersion changeVersion) { IFeatureWorkspace workspace = this.GetWorkspace(changeVersion); if (workspace != null) { ITable table = workspace.OpenTable(this.ModifiedClassInfo.ChildClassName); ICursor cursor = null; try { foreach (var oids in this.Select(o => o.OID.ToString(CultureInfo.InvariantCulture)).Batch(1000)) { IQueryFilter filter = new QueryFilterClass(); filter.WhereClause = string.Format("{0} IN ({1})", table.OIDFieldName, string.Join(",", oids.ToArray())); cursor = table.Search(filter, false); foreach (var row in cursor.AsEnumerable()) { yield return(row); } } } finally { if (cursor != null) { while (Marshal.ReleaseComObject(cursor) > 0) { } } } } }
/// <summary> /// Gets the rows that reside in the version that corresponds to the state. /// </summary> /// <param name="changeVersion">The change version.</param> /// <param name="oid">The oid.</param> /// <returns> /// Returns a <see cref="IRow" /> representing the row for the state. /// </returns> public IRow GetRow(DeltaRowChangeVersion changeVersion, int oid) { IFeatureWorkspace workspace = this.GetWorkspace(changeVersion); if (workspace == null) { return(null); } using (ComReleaser cr = new ComReleaser()) { ITable table = workspace.OpenTable(this.ModifiedClassInfo.ChildClassName); cr.ManageLifetime(table); IQueryFilter filter = new QueryFilterClass(); filter.WhereClause = string.Format("{0} = {1}", table.OIDFieldName, oid); var cursor = table.Search(filter, false); cr.ManageLifetime(cursor); foreach (var row in cursor.AsEnumerable()) { return(row); } } return(null); }
/// <summary> /// Gets the workspace for the delta row state enumeration /// </summary> /// <param name="changeVersion">The change version.</param> /// <returns> /// Returns a <see cref="IFeatureWorkspace" /> representing the workspace for that state /// </returns> private IFeatureWorkspace GetWorkspace(DeltaRowChangeVersion changeVersion) { switch (changeVersion) { case DeltaRowChangeVersion.SourceVersion: return(this.SourceVersion as IFeatureWorkspace); case DeltaRowChangeVersion.TargetVersion: return(this.TargetVersion as IFeatureWorkspace); default: return(this.CommonAncestorVersion as IFeatureWorkspace); } }
/// <summary> /// Gets the rows that reside in the version that corresponds to the state. /// </summary> /// <param name="changeVersion">The change version.</param> /// <param name="dataChangeTypes">The data change types.</param> /// <returns> /// Returns a <see cref="IEnumerable{IRow}" /> representing the rows for the state. /// </returns> /// <exception cref="System.NotSupportedException">The row state is not supported.</exception> public IEnumerable <IRow> GetRows(DeltaRowChangeVersion changeVersion, params esriDataChangeType[] dataChangeTypes) { var rows = this.GetRows(dataChangeTypes); return(rows.GetRows(changeVersion)); }
/// <summary> /// Gets the rows that reside in the version that corresponds to the state. /// </summary> /// <param name="changeVersion">The change version.</param> /// <param name="deltaRow">The delta row.</param> /// <returns> /// Returns a <see cref="IRow" /> representing the row for the state. /// </returns> public IRow GetRow(DeltaRowChangeVersion changeVersion, DeltaRow deltaRow) { return(this.GetRow(changeVersion, deltaRow.OID)); }