We have a few ArcGISDynamicMapServerLayers that are querying several hundred thousand lines. We can dynamically limit the results that the layer is querying by using the layerDefinitions, like this:
var layerDynamic = new ArcGISDynamicMapServiceLayer(myUrl);
var layerDefinitions = [];
layerDefinitions[0] = "City = 'MyCity'";
layerDynamic.setLayerDefinitions(layerDefinitions);
This works great and really improves performance. However, if I want to limit the layer by a given Extent, can I do that? For example, if a user zooms to a particular county, then I want to limit the ArcGISDynamicMapServiceLayer by that county's polygon shape extent.