SQLProvider icon indicating copy to clipboard operation
SQLProvider copied to clipboard

Server-side column values not retrieved when record inserted or updated

Open DunetsNM opened this issue 5 years ago • 2 comments

Description

(MS SQL SERVER) I have many tables with TIMESTAMP columns, computed columns, columns with default values. Most of the tables have auto-incremented (identity) primary key.

I expect that entity will contain those values after record is created or updated.

When I save (create or update) the entity it doesn't query values of such columns.

Expected behavior

All server-side values retrieved on INSERT and UPDATE, not just auto-increment primary key on INSERT. Should be easy to implement using "INSERT ... OUTPUT" or "UPDATE ... OUTPUT" synthax

Actual behavior

At the moment SQLProvider updates only auto-incremented primary key for new entities (generated SQL is "INSERT ... OUTPUT ..." )

Known workarounds

  • re-query entity after it is inserted or updated (ugly)
  • create a stored proc instead

Related information

  • Used database: MS SQL Server (14.0.2014.4)
  • Operating system: Windows 10
  • .NET Core 2.1

DunetsNM avatar Jun 05 '19 06:06 DunetsNM

We have the exact same problem. Sad to see no progress on this issue. @DunetsNM how did you work around this?

tskj avatar Jan 24 '20 09:01 tskj

@tskj I didn't find a workaround, ended up with different type provider (FSharp.Data.SqlClient) which is very different by design to make a fair comparison with this one, it embraces raw T-SQL instead of abstracting away from it. Worked alright for my use cases.

DunetsNM avatar Jan 26 '20 23:01 DunetsNM