Hello,
I have used SqlMetal to generate the Dlinq classes for my database
schema. I have created instances of those classes and then tried
binding them to a PropertyGrid object through it's SelectedObject
property. Whenever a Dlinq object is bound, and a particular EntityRef
object within that class cannot be obtained from a query, it throws a
EmptySequenceException.
This is really not an issue from a "get" perspective, i.e. when an
object is bound to the PropertyGrid object. However, this becomes a
problem when you attempt to modify a property on the Dlinq object
through the PropertyGrid object. For example, if I try to change the
Name parameter to something else, if an EntityRef property cannot be
found, the PropertyGrid object displays the "Invalid Property Value"
dialog box detailing the exception I mentioned above and I can't leave
focus until I cancel. This is a problem, because I'm changing the
value on a Name property which shouldn't have anything to do with the
EntityRef property.
I have tried creating my own PropertyDescriptor class that catches a
TargetInvocationException object who's inner exception is the
EmptySequenceException object in an override of the SetValue method.
This stops the "Invalid Property Value" dialog box from displaying.
However, the Name property reverts back to its original on leaving
focus.
So, it appears to me that a set of unrelated class members are
preventing a particular property on the class from being set when it
shouldn't be.
Hammad