0
class Example
{
    public OwnId Id { get; set; }

    public string SomeData { get; set; }
}

class AnotherExample
{
    public OwnId Id { get; set; }

    public string SomeData { get; set; }
}

class OwnId
{
    public long Value { get; set; }
}

I have this code, I want to generate an id using HiLo but I get an error:

builder.HasKey(e => e.Id);
builder.Property(e => e.Id).UseHiLo();

System.ArgumentException: PostgreSQL sequences cannot be used to generate values for the property 'Id' on ent ity type 'Example' because the property type is 'OwnId'. Sequences can only be used with integer propert ies.

Is it possible to use my structure?

  • 1
    Since the error message specifically spells out that it can only be used with integer properties, I'm guessing no. EF has the concept of [value converters](https://learn.microsoft.com/en-us/ef/core/modeling/value-conversions?tabs=data-annotations) which may still work but I don't think so. – Jesper Jan 26 '22 at 13:02
  • thanks, value converters still working – Andrew Mooweek Jan 26 '22 at 14:22

0 Answers0