enterprise architect database abstraction - sql-server

Is there a data layer abstration avaliable for enterprise architect that doesn't reley on the add-in model?
I'm trying to intergrate EA into a build system, but would like to avoid going directly to the backing database.

Yes: EA's Object Model.
The Object Model is not dependent on the Add-In Model (but the reverse applies). The Object Model API is available in Java and .NET, and gives full access to the models and most other information in an EA repository.
In other words, you can write a stand-alone application which accesses an EA repository from outside EA (ie not an Add-In) using these API:s rather than SQL.
Indeed, the repository database schema is not publicly documented, is not guaranteed not to change between EA versions, and is not intended to be used for adaptation development. You can do it but it is, as you've noted, a bad idea.

Related

Unity of work used with more database

I am learning some patterns, Unity of work / repository... There are some examples on web, but no one connects to more than one database.
In my applications almost always I have the need to get some object from a database (for example users) and some other object from another, how can I use the patterns ? (Since I am a novice on this subject an explicit example is a must)
Thank you!
As a general reference I advise you and anyone interested to visit http://martinfowler.com/eaaCatalog/index.html
which has a collection of UML and explanation over the most common Design Pattern for enterprises software
In your specific case Unity of work is particularly suited to work along with Data Mapper and Identity Map. I guess to understand 100% unity of work one must master also the other 2 pattern.
To answer your question I think you can create a unity of work and save it in a registry, so it is available all over the application. The unity must be a singleton since you need to ensure a central gateway to communicate with the database. Inside your unity of work you will have an identity map which is a collection of valued Objects in memory representing your model which is responsible to maintain the object states during all the application's operations. The unity will be used by your service layer to perform CRUD operations over the model and commit these changes.
To work with more databases I guess you need to leverage some sort of namespaced access to the object stored in the Identity map. You have the choice where to namespace: unity of work or identity map. The decision is really up to your application and use cases. You might need to connect to different DBs for splitting responsibilities between read and write or trying to integrate heterogeneous data sources.
An alternative would be to inject the DB object into the unity of work methods, in this case the application has 100% control over which database is used.
The repository pattern as far as I understand helps you to abstract to the storage of you model and it is particularly useful when you are working with heterogeneous data sources of you must provide such a flexibility to your application. Therefore I guess it is quite different from unity of work and Data Mapper layer.

Prototyping web-application models

What tools/practices do you recommend for rapidly getting a working model of a database/MVC-model working? I could start hacking away at the framework of my choice and add tables as I go, but I prefer to get the structure fleshed out a little before I hit the keyboard.
I could just use pen-and-paper, but it can be a bit crude to rapidly do things. I'd like something 1 step above - perhaps a diagramming tool that allows me to model relationships. UML?
You can try and use the WebRatio tool. It's model driven and it's based on the WebML notation (soon to become an OMG standard under the name of IFML).
The tool is free for non commercial purposes and personal use, you can download it for free.
[Disclaimer: I'm with Politecnico di Milano and WebRatio, and among the inventors of WebML/IFML]
SQL Power Architect is free and open source, good for designing your database model. It can forward or reverse engineer to most databases.
http://www.sqlpower.ca/page/architect
Java Spring Roo is useful for quickly setting up a RESTful web service or server-generated HTML MVC system.
Gnome Dia is a good open source diagramming tool that can do UML, and has plugins to write Java or SQL for you:
https://live.gnome.org/Dia

Entity framework/WCF -- Safe/smart to send entityObjects to Silverlight client?

I'm a little confused here.
I have my POCO classes created with the entity framework modeled from the datbase.
Obviously, I'd like to use these classes in the client too (and any bookkeeping on them would be nice if I'd like to send them back and re-attach)
I looked through the classes generated for the WCF service reference and it seems a bit verbose to be sending over the internet, but it doesn't look like there's anything risky in there security-wise.
And yet, I can't find anything online about doing this. Am I going down a completely awful path?
Help?
EDIT : I suppose they're technically they're not POCO classes if i had them generated by the EntityFramework from the database; just to clear up any possible confusion.
This is a difficult question to answer without knowing more details about your system, but ultimately whether exposing your EF entities in the WCF service contract is the right path or not is influenced by the scope and requirements of the application you are developing.
Perhaps ask yourself the following questions which will hopefully guide your decision:
Is it likely your relational model and object model will need to diverge? This can be driven by a number of factors, but most commonly reporting requirements may enforce a certain design on your database schema (for performance) that you do not want to reflect in your application object model. Using the DB generated EF entities throughout the application layers can bind you to this database design
Are you concerned that changes to your database schema may require your clients to regenerate their service references? Again, using the EF entities throughout your application tiers means any changes implemented in your DB schema (whether of concern to the client or not) may bubble up to the service interface, potentially breaking client compatability with that interface
Is performance a concern? As you mentioned, the generated classes are verbose. You are likely to be transporting unnecessary baggage across the wire, which could be optimized.
Are you concerned about exposing the implementation details of your database schema and persistence mechanism on the wire and to your clients? Given you have generated the model from the database there are likely to be properties that expose information about your schema and persistence mechanism that are redundant from a client's perspective.
In summary there may be a limited number of cases where exposing the EF entities may be acceptable but typically I would design for change and implement some sort of pattern where you map your EF entities to light-weight "persistence-ignorant" POCOs at your repository layer. EF 4.0 does provide the ability to code up a context that returns POCOs, but on my current project we use the codegen'd context and then use automapper to map the EF entities to our data contracts. Outside of the repository layer nothing is aware of the EF entities and I feel this allows for a more maintainable and robust design.

What is A Domain Model class? How do you create one?

I have seen the ideas of domain models in UML, but I never got the chance to work with them in actual code. Now I see them in databases, particularly SQL coding, from this article
And there was a quote that mentions domain model classes:
I can design Domain Model classes
containing plain SQL as easily as I
can design classes that operate on the
database via an ORM layer. Keep in
mind that ActiveRecord is not a Domain
Model.
How do I create domain classes then? Does it differ when I'm in the "database context" when I'm in the "modeling context" or even the "programming context"?
A domain model has no notion of a database. It should be the logical representation of a problem domain. You've likely worked with domain models in every one of your projects to some degree.
To tie a domain model to a database, the Repository pattern makes for an excellent mediator.
Did you have a look at one of the Omondo UML examples which show how to use object approach and visualize your domain in an UML diagram ?
It seems to me that ORM modeling with UML is not a well established technology because only Omondo EclipseUML provides these ORM features ? The other UML tools can not generate Java annotation or reverse them. They generate code from a model but not ORM or JPA annotations because they directly generate a kind of database which is not for me an object approach. This is a non sense if UML tools generate database because database is not an object ? This is why the Omondo approach to generate ORM annotations and let the mapper do its job is what should be done. In my company we have created our model then let the database admin to add the UML stereotypes which are synchronized with the java annotation. finally we have passed all the project to the developer team. The code was very clean and easy to integrate later. It was a continuous integration from a model to the database using Eclipse and maven. It worked very well.
I have used UML and ORM in my last few projects. It is really very powerful !! I think that we will see more project in the future using ORM and UML modelling.

Maintaining backwards compatibility with my object database?

I am writing an application using an object database (db4o) and in agile fashion will be starting from a small, minimal implementation and iteratively adding features from there, while releasing new versions of the software as I go.
The main question I have is how to maintain backwards compatibility for the database, as new implementations of the model classes are developed, so that users will be able to use first edition saved data with 10th edition software.
Are there some standard ways to do this, especially using an object database?
db4o supports automatic object schema evolution for the basic class model changes (field name deletion/addition). More complex class model modifications, like field name change, field type change, hierarchy move are not automated out-of-the box, but can be automated by writing small utility update program.
See documentation here and here.

Resources