Adventures of CLR Types in .Net Framework

Posted by on November 28th, 2014

Summary: This article describes the issue occurred with execution of the a polygon instance of the geography type and the possible solution for it.

Once I stumbled upon the following query:

SET @g1 = geography::Parse(‘POLYGON ((0 0, 1 0, -1 1, 2 2, 0 0))’);

The query seemed to be quite valid and SSMS executed it smoothly, but nevertheless dbForge Studio for SQL Server failed  to execute it.

In SQL server Management Studio 2014, the query after execution returns the following binary serialized instance of the Geography data type:


During deserialization of the aforesaid value, dbForge Studio threw an exception, and I was destined to get to the bottom of the issue. Making no question of the value validity, I decided to write a test .NET application to localize the problem.

Read the rest of this entry »

Estimating Coverage of Project’s Source Code with Code Review

Posted by on November 27th, 2014

Summary: This article describes how to estimate the code coverage with help of code review. The article also gives an outline of how to make the most from Review Assistant’s Code Coverage report.

As from version 2.6, Review Assistant, Devart’s code review tool, provides the new Code Coverage report. Developed in response to numerous requests from our customers, the report serves for a better quality control over the code review process. Within the context of this article, we would like to show how to effectively use the tool. In particular, we will elaborate on how to:

  • Exclude excessive data from a report with filtering
  • Group report data
  • Interpret report results

Read the rest of this entry »

String Enum Representation in Entity Developer

Posted by on November 17th, 2014

This article explains and demonstrates mapping a string representation of enum to string fields in a database in Entity Developer. The sample, demonstrated in this post, is included into our NHibernate Mapping Samples application, described in the corresponding NHibernate Mapping Samples blog article. It is named ‘Enum Type Property’; however, other samples from this application probably prove to become useful for NHibernate users both beginners and professionals, so we recommend downloading it for everyone who develop NHibernate applications.

The problem with mapping enum types in NHibernate is that NHibernate can map enum type values only to the numeric columns in database without additional manipulations. However, when enum values are stored in database as strings, NHibernate requires the user to perform some additional actions.
Read the rest of this entry »

ODAC Integration With dbForge Studio for Oracle

Posted by on November 6th, 2014

Database application development is usually divided into two stages: database design and application writing. Oracle Data Access Components for Delphi (ODAC) allow implementation of work with Oracle server, and dbForge Studio for Oracle – database design and administration. Now, for convenient development, integration with dbForge Studio for Oracle is implemented in ODAC.

To enable integration to dbForge Studio for Oracle, in the Delphi main menu select ODAC → Database Tools → dbForge Studio for Oracle Integration.

*In order for integration to be available, dbForge Studio for Oracle is required to be installed on the PC.

Due to integration, all the configured connections saved in dbForge Studio for Oracle are now available in the OraSession editor, and when selecting a needed connection – all the required OraSession parameters are filled in automatically.


Formerly, in ODAC, as well as in the other Data Access Components, editing of SQL queries, scripts, etc. was performed in the TMemo standard component. That complicated reading of code with large scripts. Now, ODAC has intellectual syntax highlighting, that makes query writing and analysis more convenient and obvious.

In addition, you can now switch from OraQuery, OraStoredProc, OraSQL, etc. editors directly to writing a query, a table, a procedure in dbForge Studio for Oracle – and get full stack of advantages of using the dbForge Studio editor: autocomplete, alignment, and others).

After SQL text is saved, all the changes will be automatically saved in an ODAC component. Also, in the integration mode, data edits are applied in dbForge Studio. One of the dbForge Studio for Oracle features – the visual query editor — is now available in ODAC: query text generated by the designer is automatically passed to ODAC.

To find an object binded with an ODAC component, it is enough to call the needed component context menu and select «dbForge Studio For Oracle → Find in Database Explorer».

Current table editing is available from the TOraTable component – the menu item «dbForge Studio For Oracle → Edit Object».

For convenient work with stored procedures, there are procedure compilation and editing capabilities in ODAC, including Debug info, and step-by-step procedure execution in dbForge Studio.

Devart Attended the Second Meeting of Lviv SQL Server User Group as a Sponsor

Posted by on October 28th, 2014

Devart gladly participated as a sponsor on the second meeting of the Lviv SQL Server User Group that took place on October 25, 2014.

About Lviv

Lviv is a cultural and economic center of West Ukraine. Rich history and a lot of old buildings make Lviv one of the most interesting and exciting places in Ukraine.

About Lviv SQL Server User Group Meeting

Lviv SQL Server User Group has a status of PASS Local Chapter (Professional Association for SQL Server) and is a part of PASS’s Global Growth for supporting of MS SQL Server professionals and connecting the community around the world. This meeting was devoted to such topics as Database Version Control and Microsoft Business Intelligence.

In the course of the event, Devart presented the product line of dbForge Tools for SQL Server.

Devart Raffle

We also held the raffle for the participants of the meeting. The winners were awarded with the exclusive prizes, including 1 FREE license of dbForge Studio for SQL Server and 1 FREE license of SQL Complete.

We would like to thank the organizers and the speakers of the conference for the highly informative and productive event. We do hope to attend it next time!

DSC06388 DSC06392 DSC06403 DSC06412 DSC06411

What is LINQ for Delphi in EntityDAC?

Posted by on October 15th, 2014

The main idea of EntityDAC, as well as any ORM for RAD Studio, is to free the programmer from having to implement a business-logic, and the logic of database interaction separately in the application source code. When writing code, programmer abstracts himself from specifics of a DBMS and operates the database entities using structures of his “native” programming language.

I.e., if in the classic approach a similar code is used for updating a database record:

Query1.SQL.Text := 'UPDATE Master ' +
                   'SET Name = ''New Name'' ' +
                   'WHERE MasterId = 10';

then when using EntityDAC, a similar operation is performed in a more “natural” way:

  Master: TMaster;
  // retrieve a TMaster instance
  Master.Name := 'New Name';

In the above sample, a code fragment is commented deliberately, that logically leads us to the following task: retrieving an entity (or entity collection) by required criteria in the context of ORM ideology.

In the classical approach, SQL is used:

Query1.SQL.Text := 'SELECT * FROM Master WHERE MasterId = 10';

And in EntityDAC, to retrieve entities or their collections, a special language is used— LINQ.

What is LINQ?

LINQ – is a language specialized on writing queries similar to SQL-queries serving for retrieving data from the database and mapping them to entities or entity collections.

What are the advantages of using LINQ?

Firstly: a programmer gets a universal syntax for writing queries, that doesn’t depend on the specifics of the used DBMS.

For instance: the task is to retrieve first 5 records from a table. In MySQL and InterBase the corresponding queries will look differently, that must be taken into account when writing an application:


FROM Master


FROM Master; 

When using LINQ, it will be enough to write one query in the application source code, that will be executed correctly not depending on the used DBMS:

Query := From(Master).Select.Take(5);

Secondly: using the “native” Delphi syntax when writing queries gives the programmer all the advantages of the built-in code editor:

Code Editor

And finally, syntax mistakes and typos are fully avoided when writing queries.


Query1.SQL.Text := 'SELECT Name FROM Master WHER MasterId = 10'; 


Query1.SQL.Text := 'SELECT Nam FROM Master WHERE MasterId = 10';

In the classical use of SQL such errors would appear only in application run time. Using LINQ minimizes probability of such situations, since LINQ is validated at the stage of application compilation.

LINQ architecture in EntityDAC

The LINQ syntax is built on the principle of “method chaining”, i.e. each subsequent query operator is a method of execution result of the previous operator. This approach eliminates the use of intermediate variables and makes the query code more readable. For example, compare the code:

Query := From(Master).Where(Master.Id = 10).Select;

with such a structure:

a := From(Master);
b := a.Where(Master.Id = 10)
c := b.Select;

Moreover, the principle of «method chaining» defines the overall structure of a LINQ query, that differs from the usual query structure in SQL. Building a LINQ query is based on the following two provisions:

  • each query operator returns a set of entities;
  • each subsequent operator applies a specific action to this set and returns the resulting subset.

Let’s consider an example query:

Query := From(Master).
         Where(Master.Id > 10).

The From(Master) operator returns the whole instance set of the Master entity. The following operator Where(Master.Id > 10) applies a filter by the Id field to this set and «passes» the resulting subset to the following operator. The OrderBy(Master.Name) operator sorts the resulting subset by the Master.Name field and passes it further. Finally, the Select(Master.Name) operator generates a new subset of entities, that contain the only field Master.Name. The generated query is saved to the Query variable for further execution and result materializing.

The detailed description of the LINQ syntax, implemented in EntityDAC, is available in the corresponding section of the EntityDAC documentation.

Query result materialization means retrieving query results as entities or entity collections using the GetEntity and GetEntities methods.

Query := From(Emp).
         Where(Emp.DeptNo = 10).

Emps := Context.GetEntities<TEmp>(Query);

Some peculiarities LINQ implementation in EntityDAC

In all the code samples in this article the generated LINQ query is assigned to the Query variable. A variable for storing the generated LINQ query must be declared in the following way:

  Query: ILinqQueryable;

This approach frees the programmer from having to monitor the destruction of the variable.

Any LINQ query begins from specifying the source of data, i.e. the “From” operator. There is a global function defined in the EntityDAC.Linq module of EntityDAC:

function From(const Source: TExpression): ILinqFrom;

that is the «starting point» for building a LINQ query.

Support for RAD Studio XE7 is added to all the Devart components for Delphi!

Posted by on October 2nd, 2014

Dear users,
DAC Team claims its products to be up-to-date and feature-rich solutions for Delphi developers. We are always trying our best to remain at the edge of programming technologies and cross-platform application development. Support for RAD Studiio XE7 was one of those high-priority tasks… And now we are happy to announce the new versions of already beloved products for Delphi programmers with support for the cutting-edge IDE:

Devart is grateful for your choice and won’t short-sell you.

Thank you for staying with us!

Best wishes!

DAC Team

Devart at SQLSaturday #290 – Kiev 2014

Posted by on September 24th, 2014

Devart sponsored SQLSaturday #290, that took place on September 20, 2014 in Kiev, Ukraine.

About Kiev

The Ukrainian capital is a city that is more than 15 centuries old, but yet stays remarkably young. Being one of the most historically and culturally significant centers of Eastern Europe, Kiev surprises by its ancient beauty and unforgettable atmosphere.

About SQLSaturday #290

With informative reports and attendance of about 200 participants, this edition of SQLSaturday turned into a perfect platform  for getting new knowledge about SQL Server and related technologies, meeting database experts and communicating with top SQL Server specialists from all over the world.

In the course of the event, Devart presented the updated product line of dbForge Tools for SQL Server.

Devart Raffle

We also held the raffle for the participants of SQLSaturday. The winners were awarded with the exclusive prizes, including 1 FREE license of dbForge Studio for SQL Server, 1 FREE license of SQL Complete and 2 T-shirts.

We would like to thank the organizers and the speakers of the conference for the highly informative and productive event. We do hope to attend it next time!

sql-saturday-290-kyiv-1 sql-saturday-290-kyiv-2 sql-saturday-290-kyiv-3 sql-saturday-290-kyiv-4

How To: Automatically Email Comparison Report

Posted by on September 9th, 2014

dbForge Studio for MySQL allows you to automate report creation process by using command line utility. There is a simple way to send comparison reports automatically via email.

To accomplish this task we will use the Collaboration Data Objects (CDO), previously known as OLE Messaging or Active Messaging. CDO is an application programming interface included with Microsoft Windows.

Below is the simple BAT file that automatically saves a comparison report in the HTML format on the “D:\\” drive and runs the send.vbs script file.

call “C:\Program Files\Devart\dbForge Studio for MySQL\” /datacompare /compfile:d:\project.dcomp /reportformat:HTML /report:d:\report.html
start send.vbs

Read the rest of this entry »

Special Aspects of Sphinx SE Support

Posted by on August 28th, 2014

At the moment, dbForge Studio for MySQL allows you to create a connection to Sphinx Search Engine. Due to technical restrictions, a warning message appears in some cases. The reason the message appears is because, there is no possibility to define that the connection happens to  Sphinx SE. We requested the Sphinx SE developers team to fix this problem.


When the warning message appears?

Case 1: When you create a connection to Sphinx Search Engine, the message appears for the first time.

Case 2: The same message appears when you create a new SQL document. It appears only once and doesn’t repeat for other new SQL documents.

Case 3: The message appears when you click a Sphinx SE connection in Database Explorer.

Warning message

Warning message

In any of these cases, just click OK, and continue your work.

Read the rest of this entry »

Devart Blog