You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3) Create Firebird database:
3.1) one table, corresponding to the entity type;
3.2) the sequence to generate values for "Id" column and the trigger (before insert) to set values of "Id" column;
3.3) the sequence to generate values for "ObjectVersion" column and the trigger (before insert/update) to set values of "ObjectVersion" column;
4) Run test:
4.1) create first instance of the context, load any TestEntity entity from the database;
4.2) create second instance of the context, load [b]the same[/b] TestEntity entity from the database;
4.3) change "Name" property of entity, loaded via first instance of the context and save changes. "ObjectVersion" property will be incremented.
4.4) change "Name" property of entity, loaded via second instance of the context and save changes. "ObjectVersion" property will be set to null. No OptimisticConcurrencyException will be thrown, although it must be.
Remark: changing the type of "ObjectVersion" property to non-nullable Int64 brings to an exception, but this is materialization-related exception (trying to assign null to a non-nullable property). To throw OptimisticConcurrencyException, this query:
EXECUTE BLOCK (
p0 BLOB SUB_TYPE TEXT = @p0, p1 INT = @p1, p2 BIGINT = @p2)
RETURNS (
"ObjectVersion" BIGINT)
AS BEGIN
UPDATE "TestEntity"
SET "Name" = :p0
WHERE (("Id" = :p1) and ("ObjectVersion" = :p2))
RETURNING "ObjectVersion" INTO :"ObjectVersion";
SUSPEND;
END
must set correctly rows affected.
The text was updated successfully, but these errors were encountered:
Submitted by: Dennis (dennis.petrov)
Duplicates DNET738
How to reproduce the bug:
1) Create POCO entity class:
public class TestEntity
{
public int Id { get; private set; }
public string Name { get; set; }
public long? ObjectVersion { get; private set; }
}
2) Configure this class with code first.
2.1) "Id" must be an identity property:
2.2) "ObjectVersion" must be a computed concurrency token:
3) Create Firebird database:
3.1) one table, corresponding to the entity type;
3.2) the sequence to generate values for "Id" column and the trigger (before insert) to set values of "Id" column;
3.3) the sequence to generate values for "ObjectVersion" column and the trigger (before insert/update) to set values of "ObjectVersion" column;
4) Run test:
4.1) create first instance of the context, load any TestEntity entity from the database;
4.2) create second instance of the context, load [b]the same[/b] TestEntity entity from the database;
4.3) change "Name" property of entity, loaded via first instance of the context and save changes. "ObjectVersion" property will be incremented.
4.4) change "Name" property of entity, loaded via second instance of the context and save changes. "ObjectVersion" property will be set to null. No OptimisticConcurrencyException will be thrown, although it must be.
Remark: changing the type of "ObjectVersion" property to non-nullable Int64 brings to an exception, but this is materialization-related exception (trying to assign null to a non-nullable property). To throw OptimisticConcurrencyException, this query:
EXECUTE BLOCK (
p0 BLOB SUB_TYPE TEXT = @p0, p1 INT = @p1, p2 BIGINT = @p2)
RETURNS (
"ObjectVersion" BIGINT)
AS BEGIN
UPDATE "TestEntity"
SET "Name" = :p0
WHERE (("Id" = :p1) and ("ObjectVersion" = :p2))
RETURNING "ObjectVersion" INTO :"ObjectVersion";
SUSPEND;
END
must set correctly rows affected.
The text was updated successfully, but these errors were encountered: