DLinq: IDENTITY and TIMESTAMP columns with INSERT stored procedures

Without an [InsertMethod] specified DLinq creates an INSERT statement that does the insertion and selects the IDENTITY field (and timestamp column, if specified).

With an [InsertMethod] returned values do not seem to be being read back into the object even if returned by the stored procedure. I've tried returning just Id and timestamp (as per DLinq-generated statements) and returning whole row.

Does DLinq try to read values returned from Insert/Update procedures?

Thanks.

[506 byte] By [FrankBuckley] at [2007-12-20]
# 1
You need to assign those fields manually back to the object after calling the stored procedure.
MattWarren at 2007-9-10 > top of Msdn Tech,Visual Studio Orcas,LINQ Project General...
# 2
Thanks. Is that likely to remain the behaviour?
FrankBuckley at 2007-9-10 > top of Msdn Tech,Visual Studio Orcas,LINQ Project General...
# 3

As far as I can tell, there is no way to get at the values returned by an INSERT procedure. If this is so, I cannot see how INSERT stored procedures can work with IDENTITY columns in DLinq. I also cannot see how the current implementation can support an optimistic concurrency implementation with stored procedures.

FrankBuckley at 2007-9-10 > top of Msdn Tech,Visual Studio Orcas,LINQ Project General...
# 4

You would need to do it the same way that DLINQ does it.

insert into table(a,b,c) values(1,2,3)
select @@Identity

This inserts the data and returns a rowset that contains the newly created identity.

MattWarren at 2007-9-10 > top of Msdn Tech,Visual Studio Orcas,LINQ Project General...
# 5

Any chance of adding a feature request to provide a mechanism for DLinq to do the reading back of values returned from [InsertMethod]s and [UpdateMethod]s? Without it, working with stored procedures will be nearly as onerous as writing your own Data Mappers.

One could even imagine a feature where as long as the stored procedures follow a @ColumnName naming convention and return AutoGen and IsVersion columns then all we would need to do is give DLinq the procedure name.

Wishful thinking, perhaps...

Thanks.

FrankBuckley at 2007-9-10 > top of Msdn Tech,Visual Studio Orcas,LINQ Project General...
# 6

omg, I certainly hope they'll support reading parameter values on the InsertMethod and UpdateMethods

You should submit a product feedback (if that's still going) re dlinq.

Ensoft at 2007-9-10 > top of Msdn Tech,Visual Studio Orcas,LINQ Project General...

Visual Studio Orcas

Site Classified