Shortcut for Converting Table to Class

  • Thread starter Thread starter Jonathan Wood
  • Start date Start date
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.
 
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
 
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.
 
Back
Top