Shortcut for Converting Table to Class
Shortcut for Converting Table to Class
am 11.01.2008 00:44:31 von 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
SoftCircuits Programming
http://www.softcircuits.com
Re: Shortcut for Converting Table to Class
am 11.01.2008 06:07:03 von Liz
"Jonathan Wood" wrote in message
news:ehhzDL%23UIHA.1208@TK2MSFTNGP05.phx.gbl...
> 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
Re: Shortcut for Converting Table to Class
am 11.01.2008 06:23:42 von Jonathan Wood
SMO?
I'll check out simego.com.
Thanks.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Liz" wrote in message
news:OlVBaABVIHA.3596@TK2MSFTNGP06.phx.gbl...
>
> "Jonathan Wood" wrote in message
> news:ehhzDL%23UIHA.1208@TK2MSFTNGP05.phx.gbl...
>> 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
>
>
>
>
>
Re: Shortcut for Converting Table to Class
am 11.01.2008 06:29:42 von mark
"Jonathan Wood" wrote in message
news:eOuOmIBVIHA.1208@TK2MSFTNGP05.phx.gbl...
> SMO?
http://msdn2.microsoft.com/en-us/library/ms162169.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
RE: Shortcut for Converting Table to Class
am 11.01.2008 17:42:42 von brucebarker
see typed datasets.
http://msdn2.microsoft.com/en-us/library/esbykkzb(vs.71).asp x
-- bruce (sqlwork.com)
"Jonathan Wood" wrote:
> 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
> SoftCircuits Programming
> http://www.softcircuits.com
>
>
Re: Shortcut for Converting Table to Class
am 11.01.2008 17:51:27 von Patrice
.... or you could also evaluate if LINQ would fit :
http://msdn2.microsoft.com/en-gb/library/bb397897.aspx
--
Patrice
"Jonathan Wood" a écrit dans le message de news:
ehhzDL%23UIHA.1208@TK2MSFTNGP05.phx.gbl...
> 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
> SoftCircuits Programming
> http://www.softcircuits.com
>
Re: Shortcut for Converting Table to Class
am 11.01.2008 18:36:38 von Jonathan Wood
Thanks!
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Mark Rae [MVP]" wrote in message
news:eZGH3LBVIHA.1208@TK2MSFTNGP05.phx.gbl...
> "Jonathan Wood" wrote in message
> news:eOuOmIBVIHA.1208@TK2MSFTNGP05.phx.gbl...
>
>> SMO?
>
> http://msdn2.microsoft.com/en-us/library/ms162169.aspx
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
Re: Shortcut for Converting Table to Class
am 11.01.2008 18:37:35 von 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.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Patrice" wrote in message
news:uVbC3IHVIHA.536@TK2MSFTNGP06.phx.gbl...
> ... or you could also evaluate if LINQ would fit :
> http://msdn2.microsoft.com/en-gb/library/bb397897.aspx
>
> --
> Patrice
>
> "Jonathan Wood" a écrit dans le message de news:
> ehhzDL%23UIHA.1208@TK2MSFTNGP05.phx.gbl...
>> 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
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>
>
Re: Shortcut for Converting Table to Class
am 11.01.2008 18:37:55 von Jonathan Wood
I'll check that out. Thanks.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"bruce barker" wrote in message
news:3D843BEB-4809-4F48-92CC-5F926FEFABC5@microsoft.com...
> see typed datasets.
>
> http://msdn2.microsoft.com/en-us/library/esbykkzb(vs.71).asp x
>
> -- bruce (sqlwork.com)
>
>
> "Jonathan Wood" wrote:
>
>> 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
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>>