I'm using IFeatureLayerDefinition2.DefinitionExpression, and nothing else on that interface.
The layer i'm using it on is a polygon layer with 600,000 features. The layer's ITable has ONLY 2 FIELDS ... Shape and ObjectID
The problem is the IFeatureLayerDefinition interface does not allow for supplying a table of values to use for the DefinitionExpression. Instead it ONLY accepts a string, probably because ESRI incorrectly assumed that people would only need to use a short fancy simple text string in order to specify the expression.
Adding additional attribute fields to this layer's ITable is NOT an option, nor is joining the ITable to a Sql Table, because the performance is horrific (that's what I originally tried). You'll wait several minutes for an expression that results in only a handful of features, because of a bug in ArcEngine 10 that tries to send a billion sql queries to sql server in order to figure out what you're looking for. I already successfully identified a similar bug in ArcObjects in version 9.3 and it was accepted as a bug by ESRI. I have yet to submit this one, but will get around to it at some point.
So, I need to be able to specify 5,000+ ObjectID's in my expression, but since the DefinitionExpression is simply a string, it tops out at some unknown length. It will return all values up to that length, but after that, nothing.
I need to be able to do this with 5,000+ ObjectID's
IFeatureLayerDefinition.DefinitionExpression = "OBJECTID IN (100000, 100001, 100002, 100003, 100004... and so on)"
So how can I get around the string length limitation?