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

Wednesday, October 31, 2018

DataObjects.Net Core 0.1.0 Beta 1

We finally ported DataObjects.Net to .Net Standard.  This version is based on DataObjects.Net 5.0.17 Final so it includes all features released up to 5.0.17.

We decided to release only main library (MS SQL Server provider is included) and extensions as we had tested them. Other providers will be added as we test them. Unfortunately if RDBMS has no client library for .Net Standard we won't be able to port its provider, but there are only few of them.

Also PLEASE NOTE, that this is very first version and thought main functions work well there might be some issues in some particular cases. Also we have plans to rethink some of our public and internal APIs so there might be breaking changes. We started releasing from major number 0 intentionally to underline that. As long as it is 0 there might be breaking changes.

You can get the release from NuGet library

Thursday, February 15, 2018

DataObjects.Net 5.0.17 Beta 3

We have released a new version of DataObjects.Net

In the version following changes were performed:

[main] Fixed certain scenarios when In() or Contains() operations in query led to  NullReferenceExecption exception
[main] Persist operation no longer breaks enumeration of EntitySet items.

Detailed explanation of these changes is in the post.

As usual you can get it from our website or install from Nuget library.


Tuesday, January 16, 2018

Winter sale


This year we're starting our winter sale right on January 16. Just use the coupon code DO2018 on checkout and get 50% off all editions of DataObjects.Net. If you want to renew your subscription use DO2018RENEWAL to get 70% discount. 

This special on our products is valid until Wednesday 31 January 2018.

Should you have any questions, please email to sales@dataobjects.net.

Monday, January 15, 2018

DataObjects.Net 5.0.17 Beta 1 and 5.0.17 Beta 2

We've released two beta releases recently and here are the featured changes

5.0.17 Beta 1:

[main] Decreased amount of metadata extracted while building Domain or Storage node in DomainUpgradeMode.Skip mode.

5.0.17 Beta 2 :

[main] Added sharing of storage schema across Storage nodes


You can read details of the changes inside. And as always you can install the releases from Nuget library or download from our website.


Friday, December 01, 2017

DataObjects.Net 5.0.16

We've released a new version recently. Here are the changes we have made:

[main] Fixed null reference exception which might appear on constraints validation

As usual you can download it from our official website or install it from Nuget library

Friday, October 06, 2017

DataObjects.Net 5.0.16 Beta 1

We've released a new version recently. Here are the changes we have made:

[main] Added constraint option allowing to skip the constraint if the field isn't changed
[main] DifferentialTuple.Merge() operation no longer causes StackOverflow exception
[main] Fixed certain cases of foreign key absence for reference fields of structures
[main] Fixed translation of enum value as default field value
[sqlserver] Fixed extraction of information about indexes from database

As usual you can download it from our official website or install it from Nuget library

Complete changes description is below.

Monday, June 19, 2017

DataObjects.Net 5.0.14

We've released a new final version recently. Here are the changes we have made:

[main] Returned expected behavior of delayed queries which was changed in 5.0.11 by bug fix for IN() operation.

In 5.0.11 we had made some changes and fixed certain cases of IN() operation usage which supposed to create temporary table, but didn't. These changes brought unexpected behavior for delayed queries. In this release we kept the cases fixed and returned old behavior for delayed queries.

[main] Fixed bug when Server profile sessions allowed to query database without transaction.

IMPORTANT! This bug fix might be a breaking change for those users who already use it. Officially, SessonOptions.ServerProfile option does not allow queries outside of transaction. So we have returned this behavior. If you require such non-transactional queries, you should include an additional option to your session configuration - SessionsOptions.NonTransactionalReads.

[mysql] Corrected column types' extraction.


As usual you can download it from our official website or install it from Nuget library

Tuesday, January 31, 2017

DataObjects.Net 5.0.11

We've released a new final version recently.

We performed following changes:

[main] Constraints can be skipped on transaction commit
[main] Operations like EntitySet<T>.ToList() no longer lead to incorrect EntitySet<T>.Count value
[main] IN() operation now creates temporary tables when it supposes to
[main] Fixed translations of aggregates like IQueryable<T>.Sum() when selector parameter can be omitted
[main] Enum constants in IndexAttribute.Filter expression are translated correctly now
[main] Fixed certain scenarios when enum constants caused query translation error



As usual you can download it from our official website or install it from Nuget library

Monday, December 26, 2016

Winter sale



This year we're starting our winter sale right on December 27. Just use the coupon code DO2017 on checkout and get 50% off all editions of DataObjects.Net. If you want to renew your subscription use DO2017RENEWAL to get 70% discount. 

This special on our products is valid until Wednesday 15 January 2017.

Should you have any questions, please email to sales@x-tensive.com.

Friday, December 23, 2016

DataObjects.Net 5.0.11 RC2

We released DataObjects.Net 5.0.11 RC2 last Friday. The list of changes is below:

[main] Fixed build in Perform/PerformSafely modes when there is no Metadata tables in database/schema
[main] Added support for CONTAINSTABLE queries for SQL Server providers
[main] Optimized memory usage for storage nodes which are build in Skip mode
[main] Full-text indexes are now allowed for fields of structures
[main] Added highest ranked matches limitation support for free-text queries
[main] ReferenceFinder now excludes references which were locally removed
[main] Fixes certains scenarios when changes do not clear on after persist
[postgresql] Fixed extraction of columns associated with DateTimeOffset fields


As usual you can download it from our official website or install it from Nuget library

Thursday, September 22, 2016

Support for DateTimeOffset for PostgreSQL provider


We have introduced DateTimeOffset support for PostgreSQL provider in 5.0.11 RC. Here, we want to explain some restrictions of this RDBMS which affect our implementation of that type support.

We warn you that support for date/time with time zone is different from Oracle Database and Microsoft SQL Server implementations. The last two RDBMS has full support for all parts of date/time including time zone, but PostgreSQL doesn't.

If you want to use DateTimeOffset type in domain models on PostgreSQL storage we need to explain some things you may face with.

DataObjects.Net 5.0.11 RC


We released DataObjects.Net 5.0.11 RC this Wednesday. The list of changes is below:

[main] Full-text indexes no longer cause domain building error in DomainUpgradeMode.Skip mode
[main] Fixed temporary keys remap which showed up in previous version
[postgresql] Updated version of client library
[postgresql] Added support for DateTimeOffset


As usual you can download it from our official website or install it from Nuget library

Friday, August 05, 2016

DataObjects.Net 5.0.10

We've just released DataObjects.Net 5.0.10 Final. It contains several changes, such as:

  [main] Remap of temporary to real keys, no longer restore nulled references to an Entity
  [main] Fixed certain cases of session cache returning null for a valid key
  [main] Fixed certain cases when EntitySet could return nulls instead of removed Entities on enumeration

As usual, you may get it from our website or from Nuget library.

Also, we have several changes planned for the next version.We have scheduled to fix the following list of issues:

- Incorrect translation of IndexAttribute.Filter underlying expression when it contains enum values;
- Usage of our In() extension in queries does not create temporary table when it supposes to;
- Exception on translation of IQueryable<>.Sum() when selector can be easily omitted.

*Current list of changes planned for the next release is not final and may be appended by additional issues or improvements, up-to-date list is available on DataObjects.Net website

Thursday, June 30, 2016

DataObjects.Net 5.0.10 RC

We've just released DataObjects.Net 5.0.10 RC. It contains several changes, such as :

  [main] Cross-hierarchical persistent type movements are unsafe actions now
  [main] Added Support for Domain building on read-only database in UpgradeMode.Skip mode
  [main] Fixed incorrect translation of persistent interface queries occured in some scenarious
  [main] Fixed certain cases of storage node metadata corruption
  [main] Improved unsaved reference registration
  [sqlite] Added Support for DateTimeOffset fields and basic operations with them
  [oracle] Corrected extraction of DateTimeOffset columns
  [weaver] Fixed pdb-files handling created by Roslyn

  Note that:
    - DataObjects.Net does not currently control changes of entities when domain is built on read-only storage, it is managed by the storage side instead. DataObjects.Net layer entity changes control is among our current tasks.
    - Some operations with DateTimeOffset fields are not currently supported as they are not supported by SQLite.

As usual, you may get it from our website or from Nuget library.

Also, we have serveral changes planned for the next version. Currently the list contains such issues as:

- EntitySet is full of nulls after passing it as parameter to Session.Remove(IEnumerable);
- Unexpected prefetch behavior with Session cache in certain sittuations.

*Current list of changes planned for the next release is not final and may be appended by additional issues or improvements, up-to-date list is avaliable on DataObjects.Net website

Monday, February 15, 2016

DataObjects.Net 5.0.8

We've just released DataObjects.Net 5.0.8. It contains several changes, such as :

[main] Fixed translation of EnumerableExtensions.IsNullOrEmpty();
[main] Fixed Domain building on empty database/schema;
[main] Fixed incorrect translation of POCO constructors in some cases.


As usual, you may download it from download page on our website or from Nuget library.

Tuesday, September 16, 2014

DataObjects.Net 5.0.2

We've already released DataObjects.Net 5.0.2 which containst several fixes. All changes are described bellow.

Changes in DataObjects.Net 5.0.2:

     [main] Association between Key fields no longer creates an additional index
     [main] Fixed: DataObjects.Net puts type identifier into the wrong column
     [main] Fixed: incorrect left join behavior
     [main] Fixed: PhoneNumberConstraint validator cloning
     [mysql] Fixed: wrong SQL for multiple join statement.

Just as always you can get it from our site or NuGet gallery.

Tuesday, September 09, 2014

We are back to blogging

Hello everyone.  First of all, we apologize for the noticeable silence in our blog. We are back online now and want to share some exciting news with you.

Last 3-month period was full of significant events: we released two versions of DataObjects.Net 4.6 and two release candidates of DataObjects.Net 5.0. And finally, stable version of DataObjects.Net 5.0 is out. All the changes are described bellow.

DataObjects.Net 4.6

Changes in DataObjects.Net 4.6.7:

      [main] Added UpgradeHandler.TypesMovementsAutoDetection option
      [main] Fixed handling of bit operations for long type for a set of providers
      [main] Fixed handling of recycled and recycled nested types
      [main] Fixed handling of queries with multiple IN operations
      [main] Fixed column mapping name handling
      [sqlserver] Fixed dropping of default constraint issue.

Changes in DataObjects.Net 4.6.8:

      [main] Fixed handling of queries with multiple IN operations
      [main] Fixed handling of queries to EntitySet<T> associated with a struct field
      [main] Added map of type identifiers UpgradeContext.UserDefinedTypeMap
      [sqlserver] Fixed translation of OnUpdate and OnDelete actions for foreign keys.

DataObjects.Net 5.0

DataObjects.Net 5.0 RC:

      [main] Fixed incorrect sequence of delete or insert queries in certain scenarios
      [main] Extended DelayedQuery API
      [main] Added support for using dynamically defined fields in LINQ.

DataObjects.Net 5.0 RC2:

     [main] Fixed handling of queries with multiple IN operations
     [main] Fixed handling of queries to EntitySet<T> associated with a struct field
     [main] Added map of type identifiers UpgradeContext.UserDefinedTypeMap
     [sqlserver] Fixed translation of OnUpdate and OnDelete actions for foreign keys.

DataObjects.Net 5.0.0:

     [main] Delayed/Future queries no longer improperly cache closure variables values
     [main] Secondary indexes which includes inherited fields are no longer ignored.

Download

Just as always releases are available on our site and NuGet gallery.

Wednesday, May 28, 2014

DataObjects.Net 5.0.0 Beta 3

We've just released DataObjects.Net 5.0.0 Beta 3 which brings several improvements over previous Beta 2 release as well as important bug fixes.

New features and improvements

  • Added FieldAttribute.DefaultSqlExpression property
  • Added support for multi-node domains
  • Fully reworked client session profile
  • Added support for geospatial types for PostgreSQL

Fixed bugs

Tuesday, April 15, 2014

DataObjects.Net 4.6.6

Changes in DataObjects.Net 4.6.6:


[main] Added DomainConfiguration.MultidatabaseKeys setting
[main] Fixed incorrect EntitySet caching in ClientProfile
[main] Fixed construction of inherited partial indexes
[main] Fixed NRE when using partial indexes over abstract types
[main] Fixed incorrect type id upgrade when type is moved to another namespace
[oracle] Exclude many standard schemes during extraction

Download

Just as always releases are available at our site and NuGet gallery.

Thursday, March 20, 2014

NonTransactionalReads in DataObjects.Net 5.0

NonTransactionalReads is a specific Session option that allows to read once fetched entities right from Session cache without the requirement to have an open transaction. This mode might be useful for desktop application that have only one Session instance for the entire lifetime of application or for services like auditing, logging, etc. that need to read persistent fields without having any idea of sessions, transactions, etc.

To demonstrate the approach, let's start with a sample. Here is the persistent class with one lazy loading field:
[HierarchyRoot]
public class Country : Entity
{
    [Field, Key]
    public int Id { get; private set; }

    [Field(Length = 30)]
    public string Name { get; set; }

    [Field(Length = 3)]
    public string Code { get; set; }

    [Field(LazyLoad = true)]
    public string Description { get; set; }

    public Country(Session session)
        : base(session) {}
}
Say, we want to have a cache of countries in our application. We create some countries on Domain start, e.g.:

var domainConfiguration = DomainConfiguration.Load("Default");
var domain = Domain.Build(domainConfiguration);

using (var session = domain.OpenSession())
using (var tx = session.OpenTransaction()) {
    new Country(session) {
        Code = "AND",
        Name = "Andorra",
        Description = "A tiny country in the middle of Europe"
    };
    new Country(session) {
        Code = "ATA",
        Name = "Antarctica",
        Description = "Icy paradise for penguins"
    };
    // other countries...
    tx.Complete();
}

To implement some sort of cache in earlier version of DataObjects.Net you would load countries in every transaction or avoid frequent loading of persistent objects from database by converting them into some kind of POCO and cache them.

In DataObjects.Net 5.0 you can do this in a more comfortable way using the new NonTransactionalReads flag.
// Configuring session
var options = new SessionConfiguration(SessionOptions.Default | SessionOptions.NonTransactionalReads);

var session = domain.OpenSession(options);
Dictionary<string, Country> cache;

// Loading cache with data in one transaction
using (var tx = session.OpenTransaction()) {
    cache = session.Query.All<Country>().ToDictionary(i => i.Code);
    tx.Complete();
}

// accessing data from another transaction
using (var tx2 = session.OpenTransaction()) {

    // cached objects are not being reloaded from database. they are consumed as is
    var antarctica = cache["ATA"];
    Console.WriteLine(antarctica.Name);

    // accessing a lazy loading field. session loads it on demand
    Console.WriteLine(antarctica.Description);

    tx2.Complete();
}

// disposing session. Data is not accessible anymore
session.Dispose();

What is more interesting, the same behavior can be achieved without using any transactions at all. Let's re-write the sample:
// Configuring session
var options = new SessionConfiguration(SessionOptions.Default | SessionOptions.NonTransactionalReads);

var session = domain.OpenSession(options);
Dictionary<string, Country> cache;

// Loading cache with data without any transaction
cache = session.Query.All<Country>().ToDictionary(i => i.Code);

// accessing data 
var antarctica = cache["ATA"];
Console.WriteLine(antarctica.Name);

// accessing a lazy loading field. session loads it on demand
Console.WriteLine(antarctica.Description);

// disposing session. Data is not accessible anymore
session.Dispose();

So, the key points of the NonTransactionalReads mode:
  1. No matter how data is loaded from database (with the help of transaction or not), it is accessible from outside the boundaries of the transaction, if any.
  2. Data is cached on Session level. As long as the Session is alive (not disposed), the data will be available from its cache.
  3. In case of accessing LazyLoad fields, Entity references and EntitySets, data is automatically fetched from database on demand.