RepoDB version 1.12.3 - Bug and Hot Fixes for version 1.12.0
Published:
When we announced the GA of RepoDB v1.12.0, many users were not able to pre-test the solutions even by having the 4 betas for the last 2 months. This has unfortunately led them to file the issues/bugs right after the releases.
The version RepoDB v1.12.3 is a version that contains the fixes for those issues/bugs.
Allow us to explain and enumerate those issues.
Possible Compiler Collision Problem
Only in the new compiler. In order for us to ensure that the collision will not happen during the caching of the AOT Compiled Expression, we need to consider the caching of the following.
- HashCode of the Type
- HashCode of the Name of each DbDataReader Fields
- HashCode of the Type of each DbDataReader Fields
- HashCode of the Ordinal of each DbDataReader Fields - this is not yet there
Without the ordinal caching, the collision may happen in various queries per entity model, resulting in multiple invalid casting exceptions (and/or data assignment issues). See below.
var people = connection.ExecuteQuery<Person>("SELECT Id, Name FROM Person;");
people = connection.ExecuteQuery<Person>("SELECT Name, Id FROM Person;");
This is critical; therefore, we issued the fix immediately.
Fetch Async Operations
Affected by the latest release and core compiler updates, the current fetch operations are using the DbDataReader.ToEnumerable() operations. Therefore, all the Async fetch operations (i.e.: BatchQueryAsync, QueryAsync and ExecuteQueryAsync) are not truly async methods.
As a fix, we again reverted the code to DbDataReader.ToEnumerableAsync() and made updates to the mentioned operations to have the proper chain of calls.
NullException on Empty WHERE Expressions
As reported by the user, a NullReferenceException is thrown if the Query Expression is being equated to a NULL value.
connection.Query<Person>(e => e.Name == null);
The issue happened because of the changes made in the latest compiler. In addition to that, we added the proper Integration Tests to cover this case.
Behavior change from Previous Versions
In the previous version, the code below was working for the table that has no Primary and Identity key.
var model = new { Id = 1, ColumnToUpdate = "Value" };
connection.Update("NonKeyedTable", model);
It was affected by the changes during the updates to the core compiler; therefore, we needed to issue an immediate hotfix for it.
Additional Requests
A shared POCO between different data providers is not working if the DB Specific provider attribute is defined.
Let us say, you would like to use the model below for both PostgreSQL and SQLite.
public class Person
{
public long Id { get; set; }
public string Name { get; set; }
[NpgsqlTypeMap(NpgsqlDbType.Json)]
public string ExtraInformation { get; set; }
}
As stated with the attribute NpgsqlTypeMap, such a model is catered for PostgreSQL; however, a user also would like to use such a model for SQLite, and there the exception is being thrown.
As an opportunity to further enhance the library, we have included the fixes for this. The fixes are not limited to the mentioned DB providers.
Closing Note
You can visit the actual release from our Github page
