Forum Moderators: open

Message Too Old, No Replies

DataSet usage with a pre-defined schema

I might be trying to force the unrealistic.

         

SethCall

4:57 am on Feb 7, 2004 (gmt 0)

10+ Year Member



Ok, so, I am about to enter the world of databases for the first time in .NET, and I obviously am strongly attracted to the DataSet class, but need some guidance on a particular point:

I want to create a client-server communication using XmlSerializer to serialize and deserialize the data on a schema (and the generated class using xsd) that has been hand-written by myself: This top-down approach seems optimal to me for a starting point in designing the type and structure of data being sent back and forth.

So, at the server, I would like to populate the generated class created from the schema with data from the database: but, am missing how I would make use of the DataSet's ability to read schemas (my handwritten one, in this case) in aiding this process of populating the class with data.

What I imagine to be the first step is using .ReadXmlSchema to get my DataSet in the form I want. But, how then does the DataSet know what data from the dataAdapter goes where in the DataTables created by the ReadXmlSchema method?

....

I suppose the other way is to create a SQL query giving me just the data I want (the same data defined by my shema earlier). Then, use WriteXmlSchema to write the schema to disk, xsd the schema to a class, and then Im good to go. For some reason, this seems obtuse to me. Everytime the SQL query changes, I am going to have to save the schema, xsd the class, and make any adjustments to the code using that class. I am a very c# centric person in comparison to SQL, so maybe its my unfamiliarity and reluctance to fiddle with SQL that makes me desire the first method more.

So, which one is the "right" way to go?

Hope my question is clear :)

wardbekker

4:17 pm on Feb 8, 2004 (gmt 0)

10+ Year Member



Hi Seth,

Why not use a simple webservice on the server to talk to? I think that's just what you need.