I'm working with Npgsql provider and Entity Framework 5 with PostgreSQL 9.X, but we have so much problems with the System.Transaction support in this provider that we are in the process of evaluating dotConnect for PostgreSQL.
With Npgsql, I could include the hidden xmin column (of type XID) that is available on every table to enable Optimistic concurrency.
In my model, this column is set to be :
SSDL : <Property Name="xmin" Type="bigint" StoreGeneratedPattern="Computed" />
CSDL : <Property Name="xmin" Type="Int64" Nullable="false" p1:StoreGeneratedPattern="Computed" ConcurrencyMode="Fixed" p9:SetterAccess="Internal" xmlns:p9="http://schemas.microsoft.com/ado/2006/04/codegeneration" />
At runtime with dotConnect for PostgreSQL there is an exception while issuing a simple query on the entity :
Code: Select all
System.InvalidOperationException: The 'xmin' property on 'Person' could not be set to a 'String' value. You must set this property to a non-null value of type 'Int64'.
at System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal)
at System.Data.Common.Internal.Materialization.Shaper.GetPropertyValueWithErrorHandling[TProperty](Int32 ordinal, String propertyName, String typeName)
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
...
By the way, If by any chance this problem is overcomed, I may have propbably another issue. The provider must return computed column with statements like "INSERT ... RETURNING xmin,..." and "UPDATE ... RETURNING xmin,..." otherwise, this will not work as the transaction id will be incorrect.
Is it the case ?
Any help appreciated.
Thanks in advance.