-
Notifications
You must be signed in to change notification settings - Fork 235
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
UseHilo For Not PK Property #2584
Comments
@muratyuceer sorry for not answering this sooner - this slipped under my radar. HiLo cannot be used with Guids; the point is that ID values are taken from a database sequence, and sequences only support numbers. As this question is a bit old I'll go ahead and close this issue, but I'll be happy to help further and explain if needed. |
Hello roji, actually AccountNo was integer, Id is Guid (PK) but AccountNo field is not the primary key. My question was about AccountNo field not Id field. |
@muratyuceer add builder.HasAlternateKey(q => q.AccountNo); to your entity configuration, it should fix the issue. |
Thank you for the response, but I won't be able to try it; it's been a long time since I submitted that project :) |
@CheRrik @muratyuceer you definitely shuoldn't need to define something as a key just in order to use HiLo with it. Can you please try (without HasAlternateKey) with the latest 8.0.0 preview (preview7 currently, rc1 comes out in around a week)? HiLo was intentionally limited to key-only properties previously, but this limitation has been lifted in EF Core 8.0 (dotnet/efcore#29758). |
I am trying generate AccountNumber with hilo but it is not working.
The text was updated successfully, but these errors were encountered: