Shortcut for Converting Table to Class

J

Jonathan Wood

Just out of curiosity, I don't suppose ASP.NET provides any tools to make it
easier to read a table from a database and convert it to a class object,
does it?

As it is, I need to create a class for each table type, manually type in all
the members, and then write code to read the database, and finally to copy
the database table to the class, checking nullable fields with IsDBNull().

Just wanted to make sure there isn't a better way.

Also, it would also be nice if there was a shortcut for exposing private
members. As it is, I declare all my private members, and then type in all
the public get/set statements of the public property. Like everything else
in .NET, seems like a lot of typing.

Thanks.
 
L

Liz

Jonathan Wood said:
Just out of curiosity, I don't suppose ASP.NET provides any tools to make
it easier to read a table from a database and convert it to a class
object, does it?

As it is, I need to create a class for each table type, manually type in
all the members, and then write code to read the database, and finally to
copy the database table to the class, checking nullable fields with
IsDBNull().

Just wanted to make sure there isn't a better way.

Also, it would also be nice if there was a shortcut for exposing private
members. As it is, I declare all my private members, and then type in all
the public get/set statements of the public property. Like everything else
in .NET, seems like a lot of typing.


it would be fairly easy to write a little code generator to do all of that
with SMO ... or look at the product at simego.com
 
J

Jonathan Wood

Thanks, although I've looked into LINQ a bit already and have trouble really
seeing why it is useful. I'll check out that link though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top