Book a Demo

Author Topic: convert data model to class diagrams?  (Read 9337 times)

chacha

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
convert data model to class diagrams?
« on: May 05, 2004, 04:43:26 pm »
Hi,

I am an absolute newbie to EA, I started evaluating today.  My big hope was that this product would be able to take a complex data model and allow me to convert the tables into classes, then visually create an inheritance heirarchy in uml from a multi-table inheritance ddl model.  Then generate the c# code to implement the class skeletons.

So, I have created a data model by importing our ddl code.  I would like to now create a class diagram from that relational model.  Then I can go in and manually create the proper inheritance model.  Can this be done in EA?

The reason I ask this is that it seems that a table stereotype can't be used to generate c# code, nor does it support the use of inheritance.  

BTW, I am very impressed with the feature set EA has in it's offering.
« Last Edit: May 05, 2004, 04:50:51 pm by chacha »

MichaelHanson

  • EA User
  • **
  • Posts: 31
  • Karma: +0/-0
  • EA is the best
    • View Profile
Re: convert data model to class diagrams?
« Reply #1 on: May 06, 2004, 02:39:32 am »
There may well be an easier way, but it is possible to copy and paste your data model, convert the tables to classes, modify them then generate code.

It is a bit long winded but works.

Having imported your data model to create a diagram.

For each table, open the property sheet and remove the stereotype.

Once you have done them all Save the diagram (until the diagram is saved EA still thinks you are working with a table stereotyped class, autosave may change this)

Now you can open the property sheet for each class, set the language to C#, C++ or whatever you want to use for code generation.

All you have to do now, is modify the attributes to remove the column stereotype, change the data type and remove any operations that have been imported for PK, FK and other indexes and constraints.

Now you have a basic class diagram and can begin setting up the associations etc to complete it.

You can of course always import your data model to another diagram to re-create that later.

Regards
Mike Hanson
Mike Hanson
Microsoft Technology Specialist

chacha

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: convert data model to class diagrams?
« Reply #2 on: May 06, 2004, 11:21:38 pm »
>> Once you have done them all Save the diagram (until the diagram is saved EA still thinks you are working with a table stereotyped class, autosave may change this)

This is what was throwing me off.  I thought that it would regenerate the layout when you change the stereotype.  No problem.  I guess I am glad it doesn't do that.

chacha

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: convert data model to class diagrams?
« Reply #3 on: May 12, 2004, 05:23:20 pm »
Would there be a way to automate this process, by setting up a map between sql types and c# types.  I could then iterate through all tables and automatically remove their stereotypes and modify the attribute types.  I have nearly 100 tables and almost 750 attributes total.  This would take a long time.  Plus, with the naming convention I use I could use the script to mask out tables that don't map directly to domain objects.  The rest I could add as needed.

Bruno.Cossi

  • EA User
  • **
  • Posts: 803
  • Karma: +0/-0
    • View Profile
Re: convert data model to class diagrams?
« Reply #4 on: May 12, 2004, 06:39:33 pm »
Hi,

you certainly can do that using the Automation Interface or directly in the database (if you use .EAP file, just open it using MS Access and look up tables t_object and t_attribute).

Bruno