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

Open
#620 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
fsharp, sql
Domain
database

Research direction

Start by locating SQLProvider's SQL generation and entity-save entry points for MS SQL Server INSERT and UPDATE operations. Review the existing INSERT OUTPUT handling, then determine how server-side values such as identity, timestamp, computed, and default columns should be returned on both operations; done means those values are present after create and update without a re-query.

Written by the indexing model from the issue text.

Description

enhancement
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
Dominant language
F#
Stars
627
Forks
147
Avg merge
2h 2m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fsprojects/SQLProvider

All issues in fsprojects/SQLProvider

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.