I have published a service that serves a large number of polygon features. In my SL app, I add FeatureLayers to my map in code - four FeatureLayers all pointing to the same service URL but each of which has a separate Where clause. I use the four FeatureLayers with different renderers to display subsets of the polygons in different colors (the criteria for determining the colors is only known at runtime so I have to do it this way).The problem arises when one of the FeatureLayers contains a large number of polygons. I am adding each layer as "OnDemand" with an OnDemandCacheSize of 50 - this should result in the FeatureLayer retrieving ONLY polygons within the current map extent PLUS 50 addition polygons outside the current extent. Here's my code for adding the layers:
ESRI.ArcGIS.Client.FeatureLayer fLayer = new FeatureLayer();
fLayer.ID = "SitesThisPermitActive";
fLayer.Url = serviceUrl;
fLayer.Where = "pk_permit_id = " + currPermitId + " AND is_active = 1";
fLayer.Renderer = ThisPermitActiveRenderer;
fLayer.Mode = FeatureLayer.QueryMode.OnDemand;
fLayer.OnDemandCacheSize = 50;
fLayer.Visible = true;
OutFields outf = new OutFields();
outf.Add("permit_number");
outf.Add("site_number");
outf.Add("size");
outf.Add("size_units");
outf.Add("crop_list");
fLayer.OutFields = outf;
MyMap.Layers.Add(fLayer);
When the Where clause returns a large number (~3000) of polygons, I understand that the service will only return the first 1000 polygons found. However it is my understanding that with an OnDemand service this 1000 limit will be applied AFTER the polygons are intersected with the map extent.My code automatically turns off the layer when the zoom level gets out far enough that there might be > 1000 polygons within the map extent. So at all closer zoom levels I should always be able to see all of the polygons.When the layer first renders, only a few polygons show up in the map extent, although I know there should be around 200 within the extent. If I pan the map very slightly (a few pixels), when the map redraws a larger number of polygons appear. If I pan again, I get yet more polygons. What this tells me is that the map extent is not being used to filter the polygons PRIOR to the 1000 limit being applied.I have attached two screenshots - the first shows the map when I first turn on the layer with > 1000 polygons, the second after panning a few pixels.What gives?