Displaying items by tag: linq
LINQ to SQL to boost your Find, Verify & Metrics
- Combine SQL like query language with the power of C#, VB, or F#
- Database independent
- IntelliSense, AutoComplete
- Let the compiler find your typos
- How to leverage LINQ to SQL in your Add-In (Example SimpleAddIn of open source hoTools)
- LINQPad, the off-the-shelf interactive Scratchpad
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:
- AddInSimple to show the basics
- LINQPad for SQL
- LINQPad for command line, call from EA
- LINQPad predicate builder
- LINQPad Tips & Tricks by Dan Clarke
- LINQ to SQL driver
- Tips&Tricks
- Implementation
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