Author Topic: SQL Api for EA  (Read 5293 times)

stao

  • EA User
  • **
  • Posts: 137
  • Karma: +0/-0
    • View Profile
SQL Api for EA
« on: November 26, 2011, 09:11:44 am »
What is this?
  • This is a representation of the EA Automation Interface which uses SQL statements to read the database directly to increase the speed of the slow AI.
Who should use this?
  • If youre developing EA Addins and stepped over the (sometimes really annoying) slow API and dont want to use ugly SQL Statements to increase the speed of your Code you can use our SQLRepository. It has 2 different modi. One which reads the whole database in the memory which will take some time and one which uses sql statements for every necessary data.
Which modus should i use?
  • If the reading of the whole database takes more time than the using of the normal AI you should use the second mode which will be created as follows:
    Code: [Select]
    SQLRepository sqlRepository = new SQLRepository(Repository, false);
  • otherwise you can use the fulldatabaseCheckout modus

the creation works like:
Code: [Select]
SQLRepository sqlRepository = new SQLRepository(Repository, true);[/list]



Advantages:
  • The SQL Api can be used exactly like the normal automation interface so your code mustn be changed (only the lines which will create the object).

Disadvantages:
  • It can only be used to read from the model. Writing or updating is currently not supported (perhaps will be in future)
  • Not all functions are implemented. We only did what we need. But the implementation is quite simple and can be "learned" from the current implementation.



you can check it out from:
project link
http://code.google.com/p/ea-sqlapi/
svn repository link
http://ea-sqlapi.googlecode.com/svn/trunk/
« Last Edit: November 28, 2011, 09:00:47 am by stao »

stao

  • EA User
  • **
  • Posts: 137
  • Karma: +0/-0
    • View Profile
Re: SQL Api for EA
« Reply #1 on: November 28, 2011, 08:45:50 am »
added another modus for sql repository.
you can switch between full database checkout which is really fast if you want to do a LOT of model iterations and the new modus which makes sense to use if you want to speed up some iterations which are a bit slow with the standard automation interface.
the speed up rate is not that high (e.g 1.03s to 0.22s or 0.92s to 0.61s for 2 different model searches. the rate depends on your code)  
but although better than the automation interface. (maybe there are cases in which the sql repository is slower than automation interface).

to switch between these 2 modi you only have to create the sqlRepository class with a boolean parameter.
True for the fulldatabase Checkout modus and false for the new modus.


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: SQL Api for EA
« Reply #2 on: November 28, 2011, 05:30:09 pm »
Wow,

Looks promising. I'm definitely going to check this out.
It could be a nice addition to my own open source UML tooling framework https://github.com/GeertBellekens

Geert

PS. Ever thought of changing to GIT iso SVN?

stao

  • EA User
  • **
  • Posts: 137
  • Karma: +0/-0
    • View Profile
Re: SQL Api for EA
« Reply #3 on: November 29, 2011, 07:19:26 am »
Would be nice if you can post a statement with your experiences and of course the problems you stepped over.
Well the only reason i used SVN is that its the only tool im familiar with :).
If you find it useful i would be proud if you add it to your UML Tooling framework ;)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: SQL Api for EA
« Reply #4 on: November 29, 2011, 05:20:15 pm »
Hi,

This morning I downloaded the code (I had to install SVN to be able to do that, isn't there an easier way? Github automaticallly offers zip/tar files containing the full source)
After resetting the path of the Interop.EA.dll it compiled without issues (using SharpDevelop 4.1)

I'll be trying out the code in the next few days.
Have you ever thought about calling the original EA.Repository for operations that you can't do with SQL?
That would make it a fully functional replacement for the original EA.Repository. If I were to replace EA.Repository by your analog right now that would yield quite a lot of NotImplementedExceptions.

Geert

stao

  • EA User
  • **
  • Posts: 137
  • Karma: +0/-0
    • View Profile
Re: SQL Api for EA
« Reply #5 on: November 29, 2011, 09:37:38 pm »
Quote
(I had to install SVN to be able to do that, isn't there an easier way? Github automaticallly offers zip/tar files containing the full source)
sadly it seems there isnt :/ i can switch to git but i dont know if there will be a zipped file to download.

Quote
Have you ever thought about calling the original EA.Repository for operations that you can't do with SQL?
That would make it a fully functional replacement for the original EA.Repository. If I were to replace EA.Repository by your analog right now that would yield quite a lot of NotImplementedExceptions.

i thought about that and for some methods its already done. but because for our purposes we only need a few repository methods i havent done it yet. there are still many unimplemented exceptions for the Class Properties e.g EAElement and so on. there is some work to do to complete every single property.

stao

  • EA User
  • **
  • Posts: 137
  • Karma: +0/-0
    • View Profile
Re: SQL Api for EA
« Reply #6 on: December 01, 2011, 08:21:25 am »
Update:

Implemented all Unimplemented Methods of the SQLRepository Class. If there is no SQL way to do it the common repository method is called.