Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add a switch of which value to return (Identity/Primary) during the push operations (Insert, InsertAll, Merge and MergeAll). #1086

Closed
mikependon opened this issue Sep 17, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request fixed The bug, issue, incident has been fixed.

Comments

@mikependon
Copy link
Owner

Describe the enhancement

In the past, RepoDB always return the Primary value but an issue has been reported that the scenario is not suited for some cases. At some point, the Identity column is not designed as Primary column and the library is failing to return the property values.

Recently, we have adjusted the behavior of the library (see #1027) where we give priority to the Identity column to return the value during the mentioned push operations. Unfortunately, this leaves the prior use-cases to fail if some code of the user has already been written to expect the Primary key as the return values.

With this, we would like to introduce a switch of what value to return during the mentioned push operations. Below are the options.

  • Identity - always return the value of Identity column.
  • Primary - always return the value of Primary column.
  • IdentityPrimary - always return the value of Identity column (if present), otherwise, the value of the Primary column (if present).
  • PrimaryIdentity - always return the value of Property column (if present), otherwise, the value of the Identity column (if present).

Below is the way on how to set the code. (This must only be introduced within #1085)

ApplicationContext.Set(ApplicationKeys.PushOperationReturnValue, PushOperationReturnValue.IdentityPrimary);

Or, during the initialization. (Within the #1086)

RepoDb.Application.Setup(new
{
     ConversionType = ConversionType.Automatic,
     DefaultBatchOperationSize = 30,
     EnumDefaultDatabaseType = EnumDefaultDatabaseType.String,
     PushOperationReturnValue = PushOperationReturnValue.IdentityPrimary,
     ...
});
@mikependon mikependon added the enhancement New feature or request label Sep 17, 2022
@mikependon mikependon self-assigned this Sep 17, 2022
@mikependon mikependon pinned this issue Sep 28, 2022
mikependon added a commit that referenced this issue Oct 10, 2022
@mikependon mikependon added the fixed The bug, issue, incident has been fixed. label Oct 21, 2022
@mikependon
Copy link
Owner Author

Will be available on the next release > RepoDB v1.13.0-alpha2.

@mikependon mikependon unpinned this issue Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed The bug, issue, incident has been fixed.
Projects
None yet
Development

No branches or pull requests

1 participant