SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Generate C# class code for table


Generate C# class code for table

Author
Message
nigel.
nigel.
SSCertifiable
SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)SSCertifiable (5.1K reputation)

Group: General Forum Members
Points: 5096 Visits: 2949
Even simpler with Auto-Implemented Properties in C# 3.0 and later you don't need the private variable.

See http://msdn.microsoft.com/en-us/library/bb384054.aspx

--
Nigel
Useful Links:
How to post data/code on a forum to get the best help
The "Numbers" or "Tally" Table - Jeff Moden

charles.byrne
charles.byrne
SSC-Enthusiastic
SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)SSC-Enthusiastic (108 reputation)

Group: General Forum Members
Points: 108 Visits: 172
Codesmith http://www.codesmithtools.com may be a little easier.

We use MyGeneration http://www.mygenerationsoftware.com.
It is a little dated, but the templates allow scripting in vbscript, VB.Net, or C#. You can also build forms to pick and choose options for your class as you need them.

"There is nothing so useless as doing efficiently that which should not be done at all." - Peter Drucker
cyplesma
cyplesma
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 25
nice bit of code, always like being able to have different ways to do stuff. I made my own c# program about a year ago and I use it regularly. It also creates the stored proc to go with the class. Everyone/anyone feel free to download and check it out here: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=8681&lngWId=10
ratxamala
ratxamala
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 5
Free tool in this link

Generates three tier classes and sql CRUD scripts

https://skydrive.live.com/#cid=ACCFC2483F700A04&id=ACCFC2483F700A04%2111751

or

http://rapidshare.com/files/2096091764/ClassCreator%201.0.zip
ratxamala
ratxamala
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 5
Test this free tool

Creates classes and SQL CRUD Scripts

http://rapidshare.com/files/2096091764/ClassCreator%201.0.zip

or

https://skydrive.live.com/#cid=ACCFC2483F700A04&id=ACCFC2483F700A04%2111751
Damian Widera-396333
Damian Widera-396333
Say Hey Kid
Say Hey Kid (678 reputation)Say Hey Kid (678 reputation)Say Hey Kid (678 reputation)Say Hey Kid (678 reputation)Say Hey Kid (678 reputation)Say Hey Kid (678 reputation)Say Hey Kid (678 reputation)Say Hey Kid (678 reputation)

Group: General Forum Members
Points: 678 Visits: 321
great topic. no chance to test the code right now (have only mobile phone now) but how does the script behave if we have to specify the schema? we could always have many Contact tables in many schemas Smile

Kindest Regards,

Damian Widera
SQL Server MVP,
MCT, MCSE Data Platform, MCSD.NET
crostenbach
crostenbach
SSC Rookie
SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)SSC Rookie (36 reputation)

Group: General Forum Members
Points: 36 Visits: 46
Is it just me, or does it have problems with multi-word fields like [Field Order]?
kbusch 90598
kbusch 90598
SSC Journeyman
SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)SSC Journeyman (98 reputation)

Group: General Forum Members
Points: 98 Visits: 49
I suppose one could write this in C# itself as well using the SMO classes. String operations are a bit more, uh, pleasant in C#.
Iwas Bornready
Iwas Bornready
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32052 Visits: 885
Thanks for the script.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search