I have a trigger set on the "Timestamp" field as fallows:
CREATE OR REPLACE TRIGGER M_User_TRIG BEFORE INSERT OR UPDATE ON "M_User"
FOR EACH ROW
BEGIN
:new."Timestamp" := SYSTIMESTAMP;
END;
In Entity Framework 6 the "Timestamp" field has the following propertyies:
StoreGeneratedPattern: Computed
Concurrency Mode: Fixed
I can't get a DbUpdateConcurrencyException, instead I got a DbUpdateException as follows:
"A null store-generated value was returned for a non-nullable member 'Timestamp' of type 'EntityModel.M_User'."
--------------------------------------------------------------------------------
Here is the SQL generated by Entity Framework 6:
--------------------------------------------------------------------------------
declare
"Timestamp" timestamp;
begin
update "EF_DEV"."M_User"
set "ShowName" = :p0
where (("ID" = :p1) and ("Timestamp" = :p2))
returning
"Timestamp" into
"Timestamp";
open :p3 for select
"Timestamp" as "Timestamp" from dual;
end;
-- :p0: 'Benny' (Type = String, Size = 20)
-- :p1: '21' (Type = Int64)
-- :p2: '2016/06/07 10:20:35' (Type = DateTime)
-- :p3: 'null' (Type = Object, Direction = Output, IsNullable = false)
--------------------------------------------------------------------------------
But it works perfectly in MS SQL Server,
and here is the SQL generated by Entity Framework 6:
--------------------------------------------------------------------------------
UPDATE [dbo].[M_User]
SET [ShowName] = @0
WHERE (([ID] = @1) AND ([Timestamp] = @2))
SELECT [Timestamp]
FROM [dbo].[M_User]
WHERE @@ROWCOUNT > 0 AND [ID] = @1
-- @0: 'Benny2' (Type = String, Size = 20)
-- @1: '1020000002' (Type = Int64)
-- @2: 'System.Byte[]' (Type = Binary, Size = 8)
--------------------------------------------------------------------------------
Had any solution to get a DbUpdateConcurrencyException, not a DbUpdateException in Entity Framework 6,
because I need to check concurrency problem and reload the concurrency exception row.