Code First - UML - Modeling of database - visual view possible? - visual-studio-2010

I love how model first gives a visual overview of the database.
But now the Ado.Net team pushes code first, i'd think it would be awesome to generate an UML overview of the database through your classes.
Does this already exists? As i can't seem to find it :(

Yes it exists as part of EF Power Tools CTP1 where you can generate read-only EDMX from your code first mapping. It is not UML but it is the same diagram you had with model first.

UML is representing an object approach while data modeling is business entities related. This is why datamodeling will never be UML modeling.
In Java the Red Hat group uses the hibernate project to add annotations directly on the java object represented as classes. The trick I use is to reverse engineer my java code into UML classes and also reverse engineer my hibernate annotation as stereotypes. It means that at the same time you can define your object approach and also create your persistence layer which is visible inside your UML class diagram.
Really cool !!

Related

Generating ODI Packages

I am currently working on a data warehousing project where I often need to load tables to layer 1 and layer 2 from the source. Layer 1 is a copy of the source data plus some technical fields and layer 2 handles foreign keys and does some minor transformations.
The process goes as follows:
Create the DDL scripts to create the tables in L1 and L2
Use ODI (Oracle data integrator) to define interfaces which define the transformations from one layer to another.
This is quite a repetitive task where the transformations stay roughly the same.
I was wondering if there was a way to generate ODI packages + interfaces + variables on th odi agent from a scripting language so that I can automate the largest part of this time consuming part.
ODI version: ODI_11.1.1.7.0_GENERIC
Platform: Windows 7
Thanks in advance
Using the ODI SDK, it is indeed possible to perform almost any tasks you can do in ODI Studio : http://docs.oracle.com/cd/E29542_01/apirefs.1111/e17060/toc.htm.
This Java API can also be used in Groovy scripts executed directly from ODI Studio (Tools -> Groovy -> New Script).
Groovy is a programming language for the JVM, it uses a syntax similar to the Java Syntax with some shortcuts and it's dynamically compiled. With a few exceptions, Java code can be used in Groovy.
Michael Rainey did a nice presentation to introduce the ODI SDK, Groovy and some use case. Here are the slides : https://s3.amazonaws.com/rmc_docs/biforum2013_slides/odi_mclass_6_sdk_groovy.pdf
I guess this complete example by the same author might be interesting for you as it adds a few columns to the tables of his Foundation layer (equivalent of your layer 1 in the Oracle Information Management Reference Architecture) :
http://www.rittmanmead.com/2012/05/oracle-data-integrator-11g-groovy-add-columns-to-a-datastore/
Once you understand the concepts, the Oracle Data Integrator team posted a nice script to automate the creation on their blog a few years back. I think it was tested on 11.1.1.5 so it might need some adapations but this is a nice starting point : https://blogs.oracle.com/dataintegration/entry/interface_builder_accelerator
One limitation with the SDK is that there is nothing to use the versioning capabilities of ODI.
Better to create package, interfaces using GUI instead of SDK. that is easy to implement, debug and time-saving.

CSLA: is many separate projects really needed?

I'm looking at the ProjectTracker CSLA example solution and it has projects for DAL, EF implementation of DAL, and a project for the business objects/rules/etc.
I understand it's good practice to split logical separations in to projects, buy my concern is is there really a problem putting the DAL and EF into the business assembly?
It seems that build time is most affected by the number of projects.
The app I'm working on would likely have 18 or more projects if i followed the examples layout.
I know i can make multiple solutions to help mitigate this, but I don't want to go down this path right off the start.
Thanks.
Multiple projects are recommended, and are necessary to get the full benefit of CSLA and its n-tier architecture.
If you know beyond the shadow of any doubt that you will never need n-tier deployment, never need advanced security, never need increased scalability, and generally aren't looking to build an enterprise level app, then you can use fewer projects.
In fact, if you are building an app that you know you'll deploy as a 2-tier app then you can put the business classes and data access classes directly into your UI project along with the UI code.
Is that a good idea? No.
Will it work? Yes.
To piggy-back on Rocky's answer, the company I work for uses CSLA, and we originally had all DAL code in our business classes. We were on Oracle 10g as our dbms at the time, but wanted to switch to SQL Azure (and we had a pretty big system upgrade and schema changes simultaneously). So, we did the following:
Implement the DAL interface as a project
Implement 2 DAL projects, one each for Oracle and SQL (actually 3 w/ a mock db, but that was more for proof of concept)
This let us test the conversion in both databases simultaneously. If we had started with the DAL project to begin with, this would have been a lot easier to accomplish.
Long story short, it may take more time, but unless you're positive of all of Rocky's points, it's worth it.

Any open source projects using to Linq2SQl?

Is there any open source projects or demo projects using Linq2Sql as primary data layer for accessing and updating all its data?
I am working in a project(asp.net webapp) which has Linq2Sql in DAL. We realized that half way through the project our design is not properly working out. I would like to see how Linq2Sql is being implemented in multilayered project. Any reference or guidance would would be good to.
I am already aware that Entity Framework is preferred way going forward but this project is mostly done in Linq2Sql, so we would like to finish it out.
a year ago, when I tried asp.net MVC I used nerd dinner to learn it, if I remember correctly, it's using linq2sql

Using LINQ to SQL in ASP.NET MVC2 project

Well I am new to this ORM stuff. We have to create a large project. I read about LINQ to SQL. will it be appropriate to use it in the project of high risk. i found no problem with it personally but the thing is that there will be no going back once started.So i need some feedback from the ORM gurus here at the MSDN. Will entity framework will be better? (I am in doubt about LINK to SQL because I have read and heard negative feedback here and there)
I will be using MVC2 as the framework. So please give the feedback about LINQ to SQL in this regard.
Q2) Also I am a fan of stored procedure as they are precomputed and fasten up the thing and I have never worked without them.I know that LINQ to SQL support stored procedures but will it be feasible to give up stored procedure seeing the beautiful data access layer generated with little effort as we are also in a need of rapid development.
Q3) If some changes to some fields required in the database in LINK to SQL how will the changes be accommodated in the data access layer.
When it comes to Linq-to-Sql vs Entity Framework, I strongly suggest to use Entity Framework. With the release of .NET 4.0 and VS2010, Microsoft added soooo much goodness in Entity Framework(EF) 4.0. Let me just mention a few points: POCO and NTier support (this means that you can have a separate library with your simple entity classes and of course EF will still be aware of them), Lazy Loading, Sql query optimizations...Also you can let EF to generate your entities (and you have the option modify the T4 generation template) or you can create them by hand if you need more control. Also, if you app will indeed be large, with EF 4, now you can separate your layers quite nicely(you can create your Mocks fo testing etc...). I'm not a web developer, so I cannot give you any hints on mvc2 on this matter.
q2-q3) - in EF you can have precompiled queries - IF you observer later on that query performance is not quite what you need. This will speed-up things quite a bit. If you plan to use EF and if you add a few changed to you database, you can easily update your model with a click.
I know I babbled too much on EF and not Linq to sql :), but hey...I believe this suits way better on your needs and you should definitely check it out for this project. Also, I don't know how much Microsoft will add features / invest in LinqToSql in the future.
Cheers,
ok precompiled queries that certainly is catching my attention.

Oracle Database to Class Diagram

We are using an oracle database in a project. Most of the tables represents classes or objects in the application. The application currently doesn't have a substantial amount of documentation. I am using StarUML to make up some class diagrams and such for other developers on the project to increase their understanding of the overall project. Using the database tables as a starting guide, and then making modifications to the diagrams as needed would be the absolute easiest and quickest way to get these set up. Is there any free applications that could assist me in pulling the schema out of the Oracle database and create class diagrams from them? Currently, there are 98 "objects" or classes closely modeled in the database and to create these all in a modeling application from scratch would be very time consuming.
You don't say what your target language is.
You can use Hibernate to generate schemas from an object model and mapping.
Middlegen is a tool that can create Java classes from schemas. Maybe those will help.
A 1:1 object-to-table mapping isn't always the best way to do things. It's hardly object-oriented. I'd view it as a starting point only.
I looked (briefly) through the StarUML documentation and don't see any way to import a database definition, so I'm not sure how you do this, sorry.
If you can find a way to get the data into StarURL, you could use Oracle's free SQL Developer tool to get the table definitions out as DDL or XML.
I know that Microsoft's Visio tool (Pro & Enterprise editions) can read selected tables from your Oracle database and generate models from that, but it ain't cheap. I really like Allround Automation's PL/SQL Developer as a reasonably-priced IDE targeted at programmers (vs DBAs) and I know that will generate diagrams locally. But I'm not sure it can save the metadata in a form you could use in StarUML.
Good luck,
-- Stew
It's a shame you didn't bother to respond to replies to your own question. Or am I misunderstanding the standard practice here that people just give points and move on?

Resources