I'm trying to create a dynamic layer based on an existing layer ID (e.g. 20) in a map service. When I create the DynamicLayerInfo and set the minScale and maxScale, those values are ignored and the defaults for layer 20 are used. Similarly, when I set the layer definition for that dynamic layer, it appears to be appended to the existing definition for layer 20 rather than overriding it. Is there any way at all to completely override the scale and definition settings?
As an alternative, I registered the data source with the service and created a dynamic layer through that. Is that the only way to do it?