News, examples, tips, ideas and plans.
Thoughts around ORM, .NET and SQL databases.

Friday, September 14, 2012

DataObjects.Net 4.6 Beta 3 is available

I'm glad to announce that DataObjects.Net 4.6 Beta 3 is made available. It includes important fixes and improvements:

Advanced version of LINQ query preprocessor

Instead of implementing IQueryPreprocessor interface you can inherit from QueryPreprocessor class. The only difference is Apply(Session, Expression) method which allows you to get current session and take it into account when processing Expression.

Fixed redundant query nesting under certain conditions

Less SELECT ... FROM (SELECT ...) clauses would be used from this version.
As the result, size of generated SQL for certain large queries with multiple joins significantly reduced (up to 50%). Generated SQL became less recursive that allowed certain queries to execute on SQLite while previously certain complex queries yielded "parser stack overflow" error.

Fixed redundant subqueries under certain conditions

Previous versions of DataObjects.Net might transform your subqueries into a non-optimal format.

For example the following query

  session.Query.All<Order>()
   .Select(o => new {
      Order = o,
      TotalPrice = o.Items.Sum(i =>  i.Price * i.Amount)
    })

might produce two subqueries for OrderItem instead one. Now such scalar subqueries will not be split.

Improved formatting of SQL when chains of AND/OR operators are used

Sequences of AND/OR operators are translated without additional braces now, so query is more readable.

Key.Create(Session) method has been renamed to Key.Generate(Session)

This method is used to generate new key. Since there are lots of other Key.Create() methods that create key from supplied values new name is more readable and reduces number of Key.Create() overloads. Old methods are kept for compatibility, but marked as obsolete.

Added Key.Create() overload that allows to specify TypeReferenceAccuracy

This is an advanced version of existing methods. It allows you to specify accuracy such as  TypeReferenceAccuracy.ExactType. All existing methods use TypeReferenceAccuracy.BaseType.

Added DirectSessionAccessor.GetChangedEntities() method

This is a long requested method that allows you to get entities (via thier EntityStates) which were changed in current session, but were not saved to the database yet.

Perform upgrade in single transaction when possible

This is a long requested feature too. Previous versions of DataObjects.Net use two transactions for Perform/PerformSafely upgrade modes. Since 4.6 Beta 3 single transaction is used for all upgrade modes.

Added support for using SQLite provider in 64-bit processes

Previous releases of DataObjects.Net 4.6 were compiled with 32-bit only SQLite provider.
This prevented them from using SQLite in 64-bit process. Now MSIL version is used.

As always new versions are available at download site and NuGet gallery.