ORA_ROWSCN and Rowversion using fluentmapping and POCO

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
esben
Posts: 43
Joined: Tue 05 Jul 2011 09:40

ORA_ROWSCN and Rowversion using fluentmapping and POCO

Post by esben » Mon 19 Sep 2011 14:44

Hi

I have a question regarding the use of the Oracle ORA_ROWSCN virtual column and the MSSQL rowversion column type.

What we have is a series of POCOs generated using the Entity Developer template, and then we have two separate dbcontext implementations that bascially takes care of dealing with the differences between Oracle and MSSQL.

Now in the POCOs (model) we have a column/field called something like "ConcurrenyField", in the fluent mapping of both context we mark these columns as the concurrency field (concurrencytoken and computed).
In the sql context that is all we need, in the oracle context we also override the columname to be "ORA_ROWSCN".

Here is the problem: the ORA_ROWSCN is mapped to a decimal (or an Int64) byt the dotConnect for Oracle provider (i assume) while the MSSQL Rowversion type is mapped to a byte[] array by the sqlclient provider. Is there any way to force the ORA_ROWSCN to also map to a byte[] array, or the other way around force the rowvversion be mapped as an int/decimal?

We have some sort of workaround where we defined two properties on the POCO one for Oracle and one for MSSQL, but that is rather ugly.

And before anyone suggests triggers, I know that is a viable working solution but I would rather just use the built-in features of the DBMS since that requires less maintenance on our part.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 22 Sep 2011 11:39

Generally in Oracle, concurrency checks cannot be made by the ORA_ROWSCN pseudo-column, since the values of these pseudo-columns are changed only after the transaction is saved (http://www.infoq.com/articles/multiple-databases).

esben
Posts: 43
Joined: Tue 05 Jul 2011 09:40

Post by esben » Thu 22 Sep 2011 13:15

Hmm too bad.

Guess i could use GUID then.

Post Reply