Important alert: (current site time 7/15/2013 7:59:51 AM EDT)
 

winzip icon

DotNETGen

Email
Submitted on: 8/4/2002 8:44:52 AM
By: Hilton Giesenow  
Level: Intermediate
User Rating: By 5 Users
Compatibility: C#, VB.NET, ASP.NET, C++.NET
Views: 26903
 
     VB.NET Class Generator From Databases - In order to simplify the interaction with a database and decrease development time, many systems contain classes that represent database objects. For example, one could create a "Customer" class with "Name" and "Email" properties and "Update" and "Delete" methods. These actions and properties would be interacting with the database in the background, thus abstracting the user from the lower-level DB details. I have written a web service that receives an XML dataset as a parameter, and returns a string array representing the automatically generated classes and collections to achieve what is described above. This web service can be called from any application in virtually any language. The code provided here is one implementation written in VB.NET that takes a SQL Server connection string, builds the database structure in a dataset, and writes out the files to a supplied path. Restrictions: The current restrictions for this app are that the table can have only 1 primary key field, and this key field must be numeric. Also, the app automatically attempts to connect to certain stored procedures. The names of these stored procedures are taken from the table name. These names are (for e.g. with a table called tblCustomer) To view all records : spCustomersView To view 1 record : spCustomerView To add a record : spCustomerAdd To edit a record : spCustomerEdit To delete a record : spCustomerDelete To change the names of these Stored Procs, just locate them in the .vb text and change them. to not use Stored procs, change the s.p. name to SQL text, and change the StoredProcedure value of the database command / DataAdapter to CommandText. Also, a note on names. The app requires each table to have an initial capital letter. This is because I use naming conventions for my tables. Normal tables have a prefix of "tbl". Linking tables are prefixed "tlnk", and lookup tables (for genders, for example) are prefixed "tlk". For example, a customer table would be called tblCustomer. However, Customer would work ok too. This app forms part of an Honours course. As such, I would greatly appreciate feedback. You can contact me at shirna@mweb.co.za. Let me know any suggestions / comments, or at least briefly what you are using the app for. The service itself is at http://137.158.189.182/TempusFugit/wsclassgenerator.asmx Thanks, Hilton
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
10/2/2002 4:25:56 PM

Where is the web service code. You would have to be on glue to think that I would give you the keys to my database. You shouldn't have wasted my time with this submission if you were not willing to release the source code for the service. Tell ya what. Send me your connection string to your database and lets see how much fun I can have with your databases.
(If this comment was disrespectful, please report it.)

 
10/2/2002 7:59:21 PMHilton Giesenow

The connection string is to insert into the code for your convenience. If you don't want this, enter a blank value, and then change it in the files generated. Also, please take the time to figure out what a Web Service is before asking for the code?!??!? you might try visiting my site, or else the microsoft, sun, ibm, oracle, delphi, BEA, cape clear etc. etc. etc. websites.
(If this comment was disrespectful, please report it.)

 
11/6/2002 7:16:03 PMEnterprize VB SQL programer

I tried running your webservice, however your connection is not up and running. I would not mind seeing your project working.
(If this comment was disrespectful, please report it.)

 
10/24/2003 3:00:42 PMKeir Gordon

I concur with all the other posts. I am aware webservices are supposed to be a shared web function... but that idea has not come into fruition yet and we developers need the code. Also you can't expect people to give you access to their database. We are impressed by your code idea, but give us source! Thats the idea behind planet-source-code.
(If this comment was disrespectful, please report it.)

 
12/13/2005 6:01:24 PMRick Toner

Wow... I try to use this and find the web-service is not even running. How finally letting us have the real code... I would love to make something that does my own formats.
(If this comment was disrespectful, please report it.)

 
3/12/2006 10:55:48 AMthatsparesh

You could have generated a dll if at all you wished to hide your code rather than keeping it as on webservice.. atleast we could have taken SOME advantage of your code.. !!
(If this comment was disrespectful, please report it.)

 
12/14/2006 7:05:29 AMNaqushbandi

fine nice
(If this comment was disrespectful, please report it.)

 
6/19/2007 12:00:29 PMJim Miņano

try the Schema for multiple key
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.