Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Due to the async nature of the .NET RIA Services programming model, exceptions and errors during load and submits aren't thrown on the client. Instead, the errors are exposed through an Error property which can be found in the event args instances passed in to handlers for the Loaded and Submitted events.
So, the first thing I do whenever I create a new DomainContext instance on the client is add a simple handler for the Loaded event. If I am going to be doing submits, then I add a handler for the Submitted event.
For example,
myDomainContext.Loaded +=
delegate(object sender, LoadedDataEventArgs e)
{
if (e.Error != null)
{
throw e.Error;
}
};
myDomainContext.Submitted += delegate(object sender, SubmittedChangesEventArgs e)
{
if (e.Error != null)
{
throw e.Error;
}
};
Later on, I might to do more complex things on those event handlers, but at beginning using anonymous methods are just fine.
Comments
- Anonymous
March 19, 2009
PingBack from http://blog.a-foton.ru/index.php/2009/03/19/failures-in-net-ria-services-are-silent-by-default/