The Devil is in the Details

I was having trouble with a SmartForm view recently — I couldn’t figure out why execution of this SmartObject method was taking so long! I could execute the SmartObject from within the SmartObject Services Tester and it would complete in less than a half-second; I even went down further and ran the procedure directly from SQL Management Studio… everything at the data layer looked “clean and green.”

THEN I looked at the view, starting with the general properties. And that’s where I found the problem. The SmartObject method associated with the view was List(), but the method I was actually using was Read(). I was calling the Read method in the rules, but I didn’t realize the view was calling List() on the load event. So the form was taking forever to initialize because it was calling List(), then calling Read().