AnsweredAssumed Answered

Implicit/Explict Save of Feature Data (WPF/v100.0)

Question asked by keith.gemeinhart on Dec 20, 2016
Latest reply on Dec 23, 2016 by akajanus-esristaff

I have generated a runtime geodatabase from a sync-enabled feature service as described on this page ... Create an offline map—ArcGIS Runtime SDK for .NET | ArcGIS for Developers . That works OK, but is somewhat unreliable in that I had to try multiple times to get it to download. Maybe I'll post a separate question on that.


In code I do something like this to setup my map ...


var gdb = await Geodatabase.OpenAsync(master.GeodatabasePath);

foreach (var table in gdb.GeodatabaseFeatureTables)
    await table.LoadAsync();


    var layer = new FeatureLayer(table);
    layer.Id = table.TableName;




Then later ...


var attributes = new Dictionary<string, object>();
attributes.Add("PlanId", 1);
attributes.Add("PlanGuid", Guid.NewGuid());


var layer = Mapview.Map.OperationalLayers["Aoi"] as FeatureLayer;
var newFeature = layer.FeatureTable.CreateFeature(attributes, _aoiGeometry);


await layer.FeatureTable.AddFeatureAsync(newFeature);


That works fine too.


However, I noticed that the feature is written immediately to the attached geodatabase. Is there a way to delay writing to the database until I make an explicit call?


I suppose I could initially create graphics, and then when I want to persist them, create features from the graphics. That's a simple enough concept but seems convoluted in that I would also have to created a bunch of graphics from existing features every time my query criteria changes.


Or is there a better workflow instead? My goal is to work offline only. We will never sync back to the server after creating the initial (empty) geodatabase. I do need to be able to perform all of the basic create, update, insert, select operations on the feature data. Would FeatureCollection be a viable alternative?