views:

37

answers:

1

I have a MS Sql 2005 Database , and I want to generate Visual BAsic code of Data Entity Class, I search the web but I can find a tool that I want. If you any information or link please help me.

+2  A: 

I've heard that Enterprise Architect has an entity/ORM framework generator for VB6, but I can't say for sure. I suggest you start looking there. reference

I had to roll my own at work, but it's copyrighted by the company so I wouldn't be able to post it here. I can give you a brief synopsis if you want to try it yourself:

  • I created a "base class" for an entity (VB6 doesn't support inheritance, so this was actually a "wrapped" base class)
    • Has Methods like Insert, Update, LoadByPrimaryKey, etc.
  • I created a similar "base class" for a collection of entities.
    • Supports simple .Where and .OrderBy methods that build a query
  • I created a code generator that pulled a list of tables from the database
    • It generates a module for each table with an Enum listing each column name as an ID, and lookup tables to go from column enum to column name, and back
    • It generates an entity class for each table that wraps the base entity, and has property setters/getters corresponding to each column name
    • It generates an entity collection class for each table that wraps the base collection class
Scott Whitlock
With these instructions you may implement a code generator using the ABSE approach. Download the AtomWeaver IDE at http://www.atomweaver.com and give it a try. It cannot read from a DB at this time, but you can quickly create a model of your own DB and then generate it there.
Rui Curado