QueuedTask.Run(() =>
{
var editOp = new EditOperation();
editOp.Name = "Blob Cursor";
var featLayer = MapView.Active.Map.FindLayers("Hydrant").First() as FeatureLayer;
editOp.Callback((context) =>
{
using (var rc = featLayer.GetTable().Search(null, false))
{
while (rc.MoveNext())
{
using (var record = rc.Current)
{
//read the blob field and save to a file
var msw = new MemoryStream();
msw = record["BlobField"] as MemoryStream;
using (FileStream file = new FileStream(@"d:\temp\blob.jpg", FileMode.Create, FileAccess.Write))
{
msw.WriteTo(file);
}
//read file into memory stream
var msr = new MemoryStream();
using (FileStream file = new FileStream(@"d:\images\Hydrant.jpg", FileMode.Open, FileAccess.Read))
{
file.CopyTo(msr);
}
//put the memory stream in the blob field and save to feature
record["BlobField"] = msr;
record.Store();
}
}
}
}, featLayer.GetTable());
editOp.Execute();
});