fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
572 stars 146 forks source link

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

Open DunetsNM opened 5 years ago

DunetsNM commented 5 years ago

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

Related information

tskj commented 4 years ago

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

DunetsNM commented 4 years ago

@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.