Public NotInheritable Class RowBuffer Inherits ArcGIS.Core.CoreObjectsBase Implements System.IDisposable
public sealed class RowBuffer : ArcGIS.Core.CoreObjectsBase, System.IDisposable
Public NotInheritable Class RowBuffer Inherits ArcGIS.Core.CoreObjectsBase Implements System.IDisposable
public sealed class RowBuffer : ArcGIS.Core.CoreObjectsBase, System.IDisposable
{
await QueuedTask.Run(() =>
{
string message = String.Empty;
bool creationResult = false;
EditOperation editOperation = new EditOperation();
using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri("path\\to\\sde\\file\\sdefile.sde"))))
using (Table enterpriseTable = geodatabase.OpenDataset<Table>("LocalGovernment.GDB.piCIPCost"))
{
// Declare the callback here. We are not executing it .yet.
editOperation.Callback(context =>
{
TableDefinition tableDefinition = enterpriseTable.GetDefinition();
int assetNameIndex = tableDefinition.FindField("ASSETNA");
using (RowBuffer rowBuffer = enterpriseTable.CreateRowBuffer())
{
// Either the field index or the field name can be used in the indexer.
rowBuffer[assetNameIndex] = "wMain";
rowBuffer["COST"] = 700;
rowBuffer["ACTION"] = "Open Cut";
// subtype value for "Abandon".
rowBuffer[tableDefinition.GetSubtypeField()] = 3;
using (Row row = enterpriseTable.CreateRow(rowBuffer))
{
// To Indicate that the attribute table has to be updated.
context.Invalidate(row);
}
}
}, enterpriseTable);
try
{
creationResult = editOperation.Execute();
if (!creationResult) message = editOperation.ErrorMessage;
}
catch (GeodatabaseException exObj)
{
message = exObj.Message;
}
}
if (!string.IsNullOrEmpty(message))
{
Debug.WriteLine(message);
}
});
}
{
await QueuedTask.Run(() =>
{
string message = String.Empty;
bool creationResult = false;
using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri("path\\to\\sde\\file\\sdefile.sde"))))
using (FeatureClass enterpriseFeatureClass = geodatabase.OpenDataset<FeatureClass>("LocalGovernment.GDB.FacilitySite"))
{
//Declare the callback here. We are not executing it yet
EditOperation editOperation = new EditOperation();
editOperation.Callback(context =>
{
FeatureClassDefinition facilitySiteDefinition = enterpriseFeatureClass.GetDefinition();
int facilityIdIndex = facilitySiteDefinition.FindField("FACILITYID");
using (RowBuffer rowBuffer = enterpriseFeatureClass.CreateRowBuffer())
{
// Either the field index or the field name can be used in the indexer.
rowBuffer[facilityIdIndex] = "wMain";
rowBuffer["NAME"] = "Griffith Park";
rowBuffer["OWNTYPE"] = "Municipal";
rowBuffer["FCODE"] = "Park";
// Add it to Attractions Subtype.
rowBuffer[facilitySiteDefinition.GetSubtypeField()] = 820;
List<Coordinate2D> newCoordinates = new List<Coordinate2D>
{
new Coordinate2D(1021570, 1880583),
new Coordinate2D(1028730, 1880994),
new Coordinate2D(1029718, 1875644),
new Coordinate2D(1021405, 1875397)
};
rowBuffer[facilitySiteDefinition.GetShapeField()] = new PolygonBuilderEx(newCoordinates).ToGeometry();
using (Feature feature = enterpriseFeatureClass.CreateRow(rowBuffer))
{
//To Indicate that the attribute table has to be updated
context.Invalidate(feature);
}
}
}, enterpriseFeatureClass);
try
{
creationResult = editOperation.Execute();
if (!creationResult) message = editOperation.ErrorMessage;
}
catch (GeodatabaseException exObj)
{
message = exObj.Message;
}
}
if (!string.IsNullOrEmpty(message))
Debug.WriteLine(message);
});
}
System.Object
ArcGIS.Core.CoreObjectsBase
ArcGIS.Core.Data.RowBuffer
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)