Skip to content

Change value generation defaults for numeric keys when using TPC#28529

Merged
ajcvickers merged 1 commit into
mainfrom
RideTheWorm0726
Jul 28, 2022
Merged

Change value generation defaults for numeric keys when using TPC#28529
ajcvickers merged 1 commit into
mainfrom
RideTheWorm0726

Conversation

@ajcvickers
Copy link
Copy Markdown
Contributor

Fixes #28096

  • Default for relational providers is Never
  • Warning is generated by default for relational providers if OnAdd is set
  • SQL Server sets the default to OnAdd with the Sequence strategy

Fixes #28096

Default for relational providers is `Never`
Warning is generated by default for relational providers if `OnAdd` is set
SQL Server sets the default to `OnAdd` with the `Sequence` strategy
@ajcvickers ajcvickers requested a review from a team July 27, 2022 22:52
@ajcvickers
Copy link
Copy Markdown
Contributor Author

/cc @roji @lauxjpn

Comment thread src/EFCore.SqlServer/Extensions/SqlServerModelBuilderExtensions.cs
@ajcvickers
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@ajcvickers ajcvickers merged commit 62509f8 into main Jul 28, 2022
@ajcvickers ajcvickers deleted the RideTheWorm0726 branch July 28, 2022 18:10
Comment thread src/EFCore.SqlServer/Extensions/SqlServerPropertyExtensions.cs
roji added a commit to roji/efcore.pg that referenced this pull request Jul 29, 2022
roji added a commit to roji/efcore.pg that referenced this pull request Jul 29, 2022
@roji
Copy link
Copy Markdown
Member

roji commented Jul 29, 2022

PG implementation: npgsql/efcore.pg#2456

roji added a commit to npgsql/efcore.pg that referenced this pull request Jul 29, 2022
@ilmax
Copy link
Copy Markdown
Contributor

ilmax commented Aug 16, 2023

Hey @ajcvickers, @roji does this one also take into account primary key that use value converters to unwrap an numeric value? (i.e. when you have a EntityId class that only wraps an int)

It doesn't seems to be working for me and I have to manually opt-in. Not a big deal but it would be nice if that can be either called out on the docs or done by default.
If you want I can open a tracking issue (I wasn't able to find an existing one)

@ajcvickers
Copy link
Copy Markdown
Contributor Author

@ilmax Properties of types that wrap a primary key value of some other type are never marked as generated by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support sequence key generation on SQL Server, which is useful for Table-per-concrete-type (TPC) mappings

4 participants