ThinkGeo.com    |     Documentation    |     Premium Support

Maybe a bug with layer transactions

 Hi, 


I am getting an error with the following code about the "The FeatureSource is already in a transaction" . I am using custom overlays and there are two different overlays with their own layers... the error popup when the second begin transcation statement is executed.


  


 



 layerOverlayOwned = (LayerOverlay)map.CustomOverlays["PropertyTypeOwned"];
            InMemoryFeatureLayer PropertyTypeLayerOwned = (InMemoryFeatureLayer)layerOverlayOwned.Layers["PropertyTypeLayerOwned"];
            PropertyTypeLayerOwned.FeatureSource.Open();
            PropertyTypeLayerOwned.FeatureSource.BeginTransaction();
            PropertyTypeLayerOwned.Columns.Add(new FeatureSourceColumn("PropertyTypeCode", "INTEGER", 32));
            PropertyTypeLayerOwned.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear();
            PropertyTypeLayerOwned.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(areaStyle_Center_Hatch_A);
            PropertyTypeLayerOwned.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            layerOverlayLeased = (LayerOverlay)map.CustomOverlays["PropertyTypeLeased"];
            InMemoryFeatureLayer PropertyTypeLayerLeased = (InMemoryFeatureLayer)layerOverlayLeased.Layers["PropertyTypeLayerLeased"];
            PropertyTypeLayerLeased.FeatureSource.Open();
            PropertyTypeLayerLeased.FeatureSource.BeginTransaction();
            PropertyTypeLayerLeased.Columns.Add(new FeatureSourceColumn("PropertyTypeCode", "INTEGER", 32));
            PropertyTypeLayerLeased.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear();
            PropertyTypeLayerLeased.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(areaStyle_Center_Hatch_C);
            PropertyTypeLayerLeased.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;


Hello Jean-marie, 
  
 Thanks for your post, I test your code but can’t reproduce your error when I run the code, so I tried to run the code two consecutively, and then I got the error, is this the way how you recreate your problem? If it is, the way to resolve it is add 
 FeatureSource.CommitTransaction() before a new transaction start. 
  
 If I misunderstanding this, many thanks to you for providing your sample to help me reproduce your situation. 
  
 Regards, 
  
 Gary

Hi Gary, 
  
 My mistake,…  I was having the same inmemory layer inside the razor view… used by two different overlays!!! 
  
 thanks again. 
  


Hi Jean, 
  
 Glad to hear that your problem’s been solved. 
  
 Regards, 
 Edgar