I'm not sure if this is even the right forum for this question. Using the tools provided with Visual Studio.Net, is there a way to create a class file from a database table where the SET and GET method accessors are automatically generated?
Here is what I'm trying to do. I have a third party rule engine that I'm using for data validation of our client's data that we import into our database. Since each rule needs to operate on one row of data, I'm creating a class for each table and accessor methods for each column within that table. Therefore, when the business users create their rules, they can refer to the lastname column in the employee table as Employee.LastName. I've got about 30 tables and a little over 300 columns. I prefer not to have to code every function by hand. It seems like an easy enough process to generate this type of class so I think somebody should have had this requirement before. Does anyone know of a way to automatically generate these classes, properties, and methods?
I am not sure any of the VS.NET wizard directly does that. how ever you can create a form and put a datagrid
by that again you have to assign sqlcommand, datasource, databinding anyways...
another thing which reminds me ,
check out ,
1) other projects in Project creation in VS.NET IDE
2) take DataBase Project
check out and let me know if it works for u
Thanks for the reply. I looked at the Database Project and unfortunately, it won't work. I have seen, in some other forums, where people have created some utilities to do this. However, I have been unable to contact any of them. I could write this myself but, I was hoping to not have to do that. I'm on a tight deadline as is. Has anyone here written a similar utility in C# because apparently there is no way to do this with the tools provided in VS.Net.
why don't you search for VS.NET Wizards that can be installed and does the simillar purpose. I remember I had downloaded some wizards (.viz or something) file and just invoking it helps and navigates the project creation. i think you need that..
Had the same problem, it's a pain to make 300+ classes or interfaces. So i made my own program to generate the code, this program is made for MS Access my you can prb modify it to suit you.
Thanks, WarWolf.
I just finished my own version of this utility yesterday. I have yet to test it though. I converted what someone else did in VB.Net and then cleaned it up for C#. However, the utility is only a command line program. I may yet use your utility as a model to add a user interface to my utility. I really appreciate your help. I'll try to upload my version to this thread when I've finished testing it.
Attached is the zip file of the utility. I've tested it to generate "*.cs" files. However, I haven't tested yet to see how those classes work yet. As I do some more testing, I may post some enhancements here. If anyone else enhances this, I'd appreciate seeing them.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.