Freigeben über


I got the SqlXml managed provider blues.

prefix = o ns = "urn:schemas-microsoft-com:office:office"
/>I
am really tired of writing the following code every time I use the SqlXml managed
provider:

try

{

     
XmlReader reader = command.ExecuteXmlReader();

}

catch (SqlXmlException
exception)

{  

     
exception.ErrorStream.Position = 0; 

throw new ApplicationException(new StreamReader(exception.ErrorStream).ReadToEnd(),
exception);

}

The
problem is that all the interesting information for a SqlXml error is contained in
the ErrorStream and not in the exception description. This
and a few other reasons have finally driven me to write my own SqlXml managed provider. It
will probably be more like an adapter (in the Gang of Four sense) which aggregates
the existing provider because I’m going to tweak the interface quite a bit to my own
taste. But hopefully it will enable me
to reuse the 100 lines of code or so that I have to include every time I use the SqlXml
managed provider. I will post the new
provider when I finish developing it.

Ironically
it probably suggests that we should ship a new version of the managed provider some
time. "urn:schemas-microsoft-com:office:smarttags" />As
part of our port of the SqlXml code to managed code for Whidbey/

Yukon

, we have taken the opportunity to completely rewrite the object model and programming
API. For some of the new features (like
XQuery) we had to do this, but in general it gave us a one time chance to fix “everything”.