All updates to features in a feature source are performed using an MgFeatureCommandCollection. The feature command collection can contain commands to add new features, delete existing features, update existing features, lock features, or unlock features.
To add a new feature, create an MgInsertFeatures object. MgInsertFeatures has two constructors. One has an MgPropertyCollection parameter and is used to insert a single feature. The other has an MgBatchPropertyCollection parameter and is used to insert multiple features in a single command.
The MgPropertyCollection contains values for the feature properties, including the feature geometry property. Create an empty MgPropertyCollection, then add properties using MgPropertyCollection.Add(). The different property types, such as MgGeometryProperty or MgInt32Property, are all derived from the base class MgProperty.
MgAgfReaderWriter agfReaderWriter = new MgAgfReaderWriter;
geometryStream = agfReaderWriter.Write(geometry);
Create a property collection to contain the feature properties. Add the geometry property. Add any other required properties. The property names are case sensitive and must match the names defined in the feature class.
MgPropertyCollection properties = new MgPropertyCollection();
geomProp = new MgGeometryProperty( "SHPGEOM", geometryStream);
MgFeatureCommandCollection commands =
insertCommand = new MgInsertFeatures(className, properties);
Deleting and updating features is similar. The constructors for MgDeleteFeatures and MgUpdateFeatures require different parameters, but the feature commands can be added to the same MgFeatureCommandCollection.