Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles

Database News

Posted Jul 14, 2004

Retrieving Objects from SQL Server Using SQLXML and Serialization

By DatabaseJournal.com Staff

[From 15Seconds.com]

This article will describe how to design a data access layer for a set of entities. You'll learn how to write an XSD schema and design two simple helper classes -- one for reading an XML stream from SQL Server using SQLXML and another for deserializing the XML stream.

Technologies used:

  • SQL Server
  • .NET

SQLXML libraries are free from Microsoft (http://www.microsoft.com/downloads/results.aspx?productID=&freetext=SQLXML&DisplayLang=en)

A common problem for many developers is designing a reusable data access layer that can be easily modified and performs well.

This is just one of many systems I've developed for mapping database tables to objects in order to avoid hard coding classes that go through datareaders and setting properties of objects from results fields.

The idea comes from SQL Server 2000 and its support to return XML as a response to a query. Using XSD schemas I can define the exact structure of that XML (see MSDN: Creating XML Views by Using Annotated XSD Schemas).

I can also serialize/deserialize quite easily any type of object in .NET as XML, so I assume that if SQL Server gives me the right XML structure I can instantiate objects from that.

The article continues at http://www.15seconds.com/issue/040713.htm

Database News Archives

Latest Forum Threads
Database News Forum
Topic By Replies Updated
Efficient SQL Server Indexing by Design lcole 0 April 30th, 12:38 PM
Mine Oracle Database, SQL Server and Other Databases with Monarch Data Pump Pro V10.5 lcole 0 April 30th, 12:37 PM
Oracle Database and Oracle Fusion Middleware for Private Social Network Application lcole 0 April 30th, 12:31 PM
Oracle Database Maintains a Stronghold in the DBMS Market lcole 0 April 30th, 12:30 PM