Back to
Latest changes:

This is an old revision of the document!


How to upgrade your project to version 3.0 of EasyQuery

Version 3.0 of EasyQuery introduces the most essential update of the library since its first release. You can find more information about the changes we made in this document. Here we introduce a step-by-step description what changes you need to do in your project to make it compatible with version 3.0 of EasyQuery.

1. Remove all old assemblies from your project's references

Such assemblies as Korzh.WebControls.CLR40, Korzh.EasyQuery.CLR40 and Korzh.EasyQuery.WebControls.CLR40 should be removed from your project. Here we have indicated only the assemblies for WebForms (ASP.NET) edition of EasyQuery and for .NET 4.0 but you need to do the same for any other edition and version of .NET framework as well. Version 3.0 assemblies have different names (see the next step for details).

2. Add new EasyQuery assemblies.

Again we suppose here that your project is for .NET 4.0 and WebForms edition of EasyQuery. Use similar assembly names for other editions and .NET versions. So you need to reference the following assemblies in your project:

  • Korzh.EasyQuery.NET40.dll
  • Korzh.EasyQuery.Db.NET40.dll
  • Korzh.EasyQuery.WebControls.NET40.dll

3. Add necessary namespaces

Since we have separated our core classes on two groups (the ones which represent the general query and data model objects and the classes which are designed to work with databases) you need to add Korzh.EasyQuery.Db namespace into the “using” section on the forms where EasyQuery controls are used:

using Korzh.EasyQuery.Db;

Additionally you may need to remove the deprecated namespace Korzh.WinControls.XControls (in case it was used in your code).

4. Change the types of the Query and DataModel objects.

Since Query and DataModel classes now represents some basic entities (not dealed to database) you need change the types of those object to DbQuery and DbModel correspondingly. Additionally you will need to do similar changes for all data model and query objects as well, since some basic classes (like SimpleCondition or EntityAttrExpr) have become abstract so you can't create an instance of these classes anymore and need to use some their Db* descendants. Moreover some classes which were the sub-classes before (like Query.Column or DataModel.EntityAttr) now become first-level classes (Column or EntityAttr correspondingly).

Here is the full map of necessary changes:

  • DataModel → DbModel
  • Query → DbQuery
  • DataModel.Table → Table
  • DataModel.Link → TableLink
  • DataModel.Entity → DbEntity
  • DataModel.EntityAttr → DbEntityAttr
  • Query.Column → DbColumn
  • Query.SimpleCondition → DbSimpleCondition
  • Query.Predicate → DbPredicate
  • EntityAttrExpr → DbEntityAttrExpr
  • AggrFuncExpr → DbAggrFuncExpr

5. Changes in SQL generation logic

Since all SQL generation functionality in version 3.0 was moved into the special SqlQueryBuilder class, you can't call BuildSQL() method of the Query object to build the SQL or read it's Result property to get the generated statement. Instead of that you need to create an instance of SqlQueryBulider class and call its BuildSQL() method.

Example:

Was in version 2.x:

    query.BuildSQL();
    SqlTextBox.Text = query.Result.SQL;

Become in version 3.0:

    SqlQueryBuilder builder = new SqlQueryBuilder(query);
    builder.BuildSQL();
    SqlTextBox.Text = builder.Result.SQL;

6. Change the types of other objects (conditions, expressions, attributes) if necessary

Here is the map of the changes you may need to do:

  • EntAttrProp → EntityAttrProp
  • EntAttrProp.SqlName → EntityAttrProp.Expression
  • Korzh.WinControls.XControls.XSortOrder → Korzh.EasyQuery.WinControls.XSortOrder

That's all. Now your project must work well with EasyQuery 3.0!

Discussion

, 2013/01/13 16:38
I use the WinForms edition of EasyQuery.

The VS2010 projects that I have are built to compile using the .NET 3.5 framework. In the installation program, there are three options for .NET frameworks that will be installed. I have left them all checked and complete the installation. When I go into my project(s), I do not see any .NET35 dll's.

A step by step for users with existing projects would be helpful
Enter your comment: