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

Support value conversion for keys (indexes) #12720

Closed
amoorthaemer opened this issue Jul 19, 2018 · 4 comments
Closed

Support value conversion for keys (indexes) #12720

amoorthaemer opened this issue Jul 19, 2018 · 4 comments

Comments

@amoorthaemer
Copy link

Hi guys,

EF Core currently supports value conversions on non key/index properties. I have a scenario in which i need to convert a key property also. Is this something that can be taken into account for the next/future version?

TIA
Bert

@smitpatel
Copy link
Contributor

Related #11597

@divega
Copy link
Contributor

divega commented Jul 20, 2018

This seems to be just a duplicate of #11597. We support keys and indexes as long as the values are not store generated.

@divega
Copy link
Contributor

divega commented Jul 20, 2018

@amoorthaemer feel free to post more details about the scenario that isn't working for you if you disagree that this is a duplicate of #11597.

@amoorthaemer
Copy link
Author

Hmmmm, I strongly disagree with the fact that you can’t use value conversions even if the value is store generated. As long as you have a scenario in which the value conversion is able to comply with the rules for store generated values (eg return default values when a value needs to be generated from by the store) also I can image a scenario in which the value processing is layered. Eg value conversion generates default value and default value gets a temporary value which in turn gets converted into a store generated value ...

For example

  1. Value converter => Guid to default long (eg 0)
  2. Temporary value generator => some random long
  3. Store = generates long based on identity column and returns it
  4. Value generator converts the new long into a Guid

Step 2 can be omitted if a temporary value generator isn’t used

This scenario is typically useful if you want to obfuscate the real ids to the world and also makes it much more workable if you have a long identity column instead of a Guid identity column in the database

Anyway that’s my point on view in this
Bert

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants