Enterprise Architect version 13.5

download
purchase

enzh-CNcsnlfrdehiiditkoplptruskessv

My Profile

Social Media Channels

facebook google plus twitter youtube linkedin

Monday, 21 August 2017 06:00

LINQ to SQL to boost your Find, Verify & Metrics

Written by 
If you want to analyze your EA model with SQL, you should consider using LINQ to SQL. Write the query once for all your EA database types. Use the combination of SQL like syntax, modern .net languages like C#, VB, F# and the compiler to find your typos.
 
The main benefits are:
 
  • Combine SQL like query language with the power of C#, VB, or F#
  • Database independent
  • IntelliSense, AutoComplete
  • Let the compiler find your typos
Approaches
 
AddInSimple shows you:
  • How to leverage LINQ to SQL in your Add-In (Example SimpleAddIn of open source hoTools)
  • LINQPad, the off-the-shelf interactive Scratchpad
In both cases: Before you reap the power of LINQ to SQL, you have to invest some time learning.
 
 
 
Example with LINQPad:
 
The following example shows the result of a little query against the EAExample model to see the types of Requirements.

You find standard SQL somehow old, limited, difficult to learn and has a lot of dialects? You think a Compiler can find a lot of your typos, Then give LINQ to SQL a try. You have two possibilities:

  • LINQPad  as an interactive query and debugging tool, database independent, C#, F#, VB
  • Develop your Add-In with LINQ to SQL

The main advantages of LINQ for SQL are:

  • Database independent
  • Combines the benefits of SQL like and Code (C#, F#, VB)
  • IntelliSense, Autocomplete, let the Compiler find your typos
  • Powerful Debug as you know from C# & Co.
  • LINQ provides a rich Eco-System (SQL, XML to name a few)

The LINQPad:

Ready to use Scratchpad to run, debug and visualize your Find and Debug for all your EA Databases. Show the code for the above grid:



IntelliSense, Autocomplete:

Let the Compiler find your typos.



Export to Excel:

 

Steps with LINQPad:

  • Create a new connection to your EA Database
  • Assign the connection to the query at hand

 

Look inside:

  • Combine queries and Code
  • EA Databases supported
  • Arbitrary complex queries without the limitations of SQL
  • Edit, Debug, Visualize
  • C#, F#, VB, LINQ (XML, SQL,..)

Add-In with LINQ to SQL:

You find two examples to tinker with in AddInSimple (part of hoTools). In essence:

  • Determine Database and connection string
  • Run LINQ query to DataTable
  • Output DataTable to EA Model Search
  • Enjoy

The results:

Start with AddinSimple and EAExample.eap.

 

 

Control Code:

The Query:

Summary:

LINQ to SQL is the solution for complex queries:

  • Interactive query tool LINPad
  • In your Add-In to easily handle complex queries database independent
  • Database independent
  • IntelliSense and AutoComplete
  • Compiler verifies against EA Database (no typos, type safe)
  • Comprehensive debug features

From viewpoint EA user:

  • Find in EA - everything without SQL limitations
  • Verify your EA models
  • Make metrics of your EA models

Write it once and use it for all your EA databases - regardless of location or type. Just connect your query with the new Database.

References:

 

This and more you can see at https://github.com/Helmut-Ortmann/EnterpriseArchitect_hoTools/wiki/LinqToSql.

 

I appreciate your experiences and feedback!

 

Kind regards,

 

Helmut

 

 

Read 277 times Last modified on Tuesday, 22 August 2017 01:24
Rate this item
(0 votes)
Helmut Ortmann

Helmut Ortmann

Freelancer (Consultant)
 
I'm a German freelancer in the area of Enterprise Architects and software/system engineering. A large part is embedded and Functional Safety with EA. But not only...
 
According to Albert Einsteins aphorism "Make things as simple as possible, but not simpler” I like to smoothen work with Addins and an easy to use EA Tool integration in a complex development environment. Another step in my opinium are lively workshops to get an enjoyable and long lasting launch of the daily EA work.
 
Well, of course that’s not all and you have therefore good reasons to contact me. See you….
 
See my hoTools WiKi at GitHub.

Website: www.hoModeler.de
Login to post comments