Open muratyuceer opened 1 year ago
@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.
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.
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.
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 (https://github.com/dotnet/efcore/issues/29758).
I am trying generate AccountNumber with hilo but it is not working.