Data is null on DbGenerated column

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Goransi
Posts: 10
Joined: Thu 23 Jan 2014 22:48

Data is null on DbGenerated column

Post by Goransi » Sun 20 Apr 2014 10:21

Our model features a column defined as:

<Column Name="XY" Type="System.String" AutoSync="Always" DbType="NVARCHAR(20)" IsDbGenerated="true" CanBeNull="true" UpdateCheck="Never" MaxLength="20" Unicode="true" ed:ValidateMaxLength="20" ed:ValidateRequired="False"/>

On insert the column is selected back. In some cases the value should be null. In these cases we get an exception:

at System.Data.SqlClient.SqlBuffer.get_String()
at System.Data.SqlClient.SqlDataReader.GetString(Int32 i)
at Devart.Data.Linq.DataProvider.ReadValue(IDataReader reader, Type type, Int32 fieldInd)
at Devart.Data.Linq.DataProvider.b(String A_0, IEnumerable`1 A_1, IEnumerable`1 A_2, Boolean A_3)
at Devart.Data.Linq.DataProvider.a(String A_0, IEnumerable`1 A_1, IEnumerable`1 A_2, Boolean A_3)
at Devart.Data.Linq.Engine.SubmitCommandBuilder.a(IObjectEntry A_0)
at Devart.Data.Linq.Engine.b5.a(IObjectEntry[] A_0, ConflictMode A_1, a A_2)
at Devart.Data.Linq.Engine.b5.a(ConflictMode A_0)
at Devart.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
at Devart.Data.Linq.DataContext.SubmitChanges()

Is this behavior by design? Is there something we can do to prevent this?

In short, on insert the generated field is and should be null, the query works fine, the exception is thrown as Linq data provider expects it not to be null.

We have upgraded to the lates version of linq and dotConnect.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Data is null on DbGenerated column

Post by MariiaI » Tue 22 Apr 2014 09:22

We have contacted you by e-mail.

Post Reply