Monday, March 28, 2011

DataObjects.Net Entity Model Designer - Prologue (Part 1)

As i wrote earlier, i discovered best ORM framework - DataObjects.Net.
After some time working with this framework on small projects i want to jump to big old one project with approx. ~500 tables divided into ~10 schemas. Then i realized that it wil cost too much time for me to write business entities for these 500 tables (including huge inheritance tree, relationship, associations,...). My first idea was to found some existing tool/addin, something to help me generating such business classes from existing database. Result was, there isn't any tool which support DataObjects.Net as target framework.

If i need some tool/application and can't find it, i will try to write such application on my own (sure i don't write new Office or something like that :-)). My thoughts are that many developers do the same thing.

I know nothing about Visual Studio DSL designers, so i decided to create Windows application. I started to write application where i can enter connection details (only MS-SQL servers), select required tables/columns and finish button to generate business classes from existing database. Next feature of tool was to read relationships from db and generate association properties with [Association] attributes on it.

Firstly i think it is easy to do such feature, list of associations where i define source, target, properties of each (Multiplicity, On owner/target remove action, etc...). Again everything works like a charm, generated classes now contains reference properties, simple and advanced (multiplicity Many *, as Entity Sets) with required [Association] attribute(s).

Whats the problem here, you can ask, give us such tool, right now. Well No!
I figured out one big problem with such tool, when i import database with ~ 500 tables into tool, that list of generated associations (yes tool will automatically scan and detect relationships and create associations) was too big, for my db about 50 generated associations (where the tool cannot detect all kind of possible associations).
Now when i look at associations list i have about ~50 rows of associations with information's like Source Property, Target Property, Source Multiplicity, Target Multiplicity, Source On Owner Remove Action... 50 rows of flat view on associations. Starting to review all of this generated associations, i lost myself on about half.I cant imagine visually in my mind association tree on these associations - some kind of "Diagram" to see which entity is associated to other one, in nice visual form.

Here story of old "DO.Net Generator tool" ends, and new story of DataObjects.Net Entity Model Designer starts.

Next part 2: Model First

No comments:

Post a Comment