I have a query for an MsSql2008FeatureLayer that returns a single point feature. A single point feature doesn't really have a valid bounding box and I get an error if I try to use the GetBoundingBox method for the layer. I have checked and the point location is valid. The error is as follows:
InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.] ThinkGeo.MapSuite.Core.MsSql2008FeatureSource.GetBoundingBoxCore() +242
The problem is that the HasBoundingBox method returns true for the layer. How can I test to see if there is a valid bounding box prior to running the GetBoundingBox method?
Is the same true of the Feature object or is the problem specific to the MsSql2008FeatureLayer (or the FeatureLayer in general)? Do I need a work around for the Feature.GetBoundingBox()?
This issue only exists in the MsSql2008FeatureLayer, it is expected to work fine when you use the ShapeFileFeatureLayer or feature object. So just give workaround to the MsSql2008FeatureLayer.