I'm working on a project in which instead of using primitive types like Int as Id, "Strongly Typed" are used, like CategoryId object. I want to use EntityFramework Core alongside with HiLo strategy, but it seems that entityframework just supports Hilo for Integer fields/properties. I need to know whether entityframework supports Hilo on strongly typed Ids or not. And if Yes, how I should configure it. Thanks in advance
Update: For the sake of clarifying what exactly I did, assuming there is a class named "Task" including a strongly-typed Id named "TaskId". I use Fluent API to configure this entity as below:
class TaskConfiguration : IEntityTypeConfiguration<Task>
{
public void Configure(EntityTypeBuilder<Task> builder)
{
builder.HasKey(e => e.TaskId);
builder.Property(e => e.TaskId).HasConversion(t => t.id, id => new TaskId(id));
}
}
Still every thing is well. But if I decide to use Hi-Lo strategy for entity "Task" the problem goes to begin. I use ForSqlServerUseSequenceHiLo() method after HasConversion() and get error by the time I'm adding migration, says that this method is only applicable to properties having integer type! I don't know whether it is practical or not, using Hi-Lo with Strongly-Typed Ids. And if it is possible what the solution is.