Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Problem With Typed DataSet Schema

Reply
Thread Tools

Problem With Typed DataSet Schema

 
 
OhioGolfer
Guest
Posts: n/a
 
      11-08-2005
My app consists of a windows form client, a business logic layer, and a
web application that hosts a strongly typed dataset and a variety of
web services. The web services retrieve the data from the SQL Server
database, do whatever logical processing is required, and return the
results to the business logic layer, which holds the data in an
instance of the typed dataset.

In my typed dataset, I have added annotations to the xsd file to
provide nullValue values, and avoid the StrongTypingException issue
when nulls are present in the data store. However, when the app runs,
the StrongTypingException still is thrown. When I go into the
Reference.vb file, and check the xsd that the reference is hitting, the
annotations are not there. It is obviously generating its own schema,
while I want it to use the schema in the web application.

Any ideas on how to get around this? It is driving me crazy . . .

Jeff

 
Reply With Quote
 
 
 
 
Kevin Yu [MSFT]
Guest
Posts: n/a
 
      11-09-2005
Hi Jeff,

I would like to know how you set the nullValue for a certain column. Did
you modified the attribute in the xsd? Also are the business logic layer
and the webservice layer referencing to the same typed DataSet class?

Please take a look at the following KB article. It will be a good guide for
your to handle DBNull values in typed DataSet.

http://support.microsoft.com/default...b;en-us;318048

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

 
Reply With Quote
 
 
 
 
OhioGolfer
Guest
Posts: n/a
 
      11-09-2005
Kevin -- I modified the .xsd file by adding the
xmlns:codegen="urn:schemas-microsoft-comml-msprop" reference, and
adding codegen:nullValue="_empty" or "0" or "1980-01-01", depending
upon the field type involved. This works fine on the server side --
the .vb file for the typed dataset properly incorporates the
annotations, and no StrongTypingException is thrown.

The problem arises on the client side. The web reference to the web
service regenerates the schema as part of the reference, and drops the
annotations. Thus, the Reference.vb file throws the
StrongTypingException. I have tried modifying the .wsdl file to point
to the "original" xsd schema, but that doesn't work. I could modify
the Reference.vb file, but this is an unstable solution, as those
changes will be lost anytime the reference is updated.

There have been a few allusions to this as a known bug in the web
service treatment of typed datasets in other forums, but I have yet to
see a proposed solution. Hope you can shed some light on this.

Jeff

 
Reply With Quote
 
Kevin Yu [MSFT]
Guest
Posts: n/a
 
      11-10-2005
Hi Jeff,

With my further research, I found that it is a known issue in ADO .net.
When XmlSerializing the typed dataset, the extended properties will not be
persisted. So the nullValue attribute cannot be passed through a web
service.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

 
Reply With Quote
 
OhioGolfer
Guest
Posts: n/a
 
      11-10-2005
Kevin -- That's it? No workaround, no indication as to whether this is
fixed in 2.0? With the push of Smart Client architecture, I find it
hard to believe that MS is simply stating this can't be done. Are you
really implying that we either have to abandon typed datasets when
using web services or make all of our database fields not nullable, and
provide default values?

Very disappointing.

Jeff

 
Reply With Quote
 
Kevin Yu [MSFT]
Guest
Posts: n/a
 
      11-11-2005
Hi Jeff,

I'm sorry, but currently there is nothing we can do on this issue. I
suggest you try to contact Microsoft PSS for more information on this issue
to see if they can work out a fix for you. Here is their contact
information.

http://support.microsoft.com/default...;OfferProPhone

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

 
Reply With Quote
 
OhioGolfer
Guest
Posts: n/a
 
      11-12-2005
Kevin (and any others who may encounter this issue):

After much agonizing and trial and error, I have found a workaround
that enables the client to capture the nullValue attributes.

Assuming a typed datset named myData, generate the dataset. In the
myData.vb file, modify the Init_Class procedure for each datatable in
your dataset by including the following for any nullable fields. (Here
I am assuming fields called myString, myInt, myDate):
columnmyString.ExtendedProperties.Add("nullValue", "_empty")
columnmyInt.ExtendedProperties.Add("nullValue","0" )
columnmyDate.ExtendedProperties.Add("nullValue,"20 00-01-01")

Save the myData.vb file. Delete any existing web references that call
for the myData schema, and create a new web reference. If you check
the myData.xsd file generated, as well as the Reference.vb file, you
will see that the attributes are preserved, and the calls to the
StrongTypingException in the Reference.vb file no longer exist.

One caveat here is that this should be done after you have finalized
the structure of your typed dataset. Regenerating the .xsd file on the
server will regenerate the .vb file on the server, and you will have to
add the ExtendedProperties again.

Hope this helps others. Is Microsoft fixing this in 2.0?

Jeff






Kevin Yu [MSFT] wrote:
> Hi Jeff,
>
> I'm sorry, but currently there is nothing we can do on this issue. I
> suggest you try to contact Microsoft PSS for more information on this issue
> to see if they can work out a fix for you. Here is their contact
> information.
>
> http://support.microsoft.com/default...;OfferProPhone
>
> Kevin Yu
> =======
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."


 
Reply With Quote
 
Kevin Yu [MSFT]
Guest
Posts: n/a
 
      11-15-2005
Hi Jeff,

Thanks for your workaround. So far, I didn't see .NET 2.0 framework has
fixed this yet.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to modify an existing schema for a strongly typed dataset socamb ASP .Net 2 04-03-2008 09:14 PM
How to add schema information into xmldocument from typed dataset Whoever ASP .Net Web Services 6 11-18-2004 05:07 AM
Typed Dataset schema not showing in WSDL James E ASP .Net Web Services 0 07-15-2004 07:25 PM
copying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 2 10-31-2003 01:05 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 1 10-31-2003 02:39 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57