Problem
Currently different types of Guid are supported, such as
Guid.NewGuid()
MassTransit.NewId
GuidComb
There's also this open issue to support Ulid.
At some point UUID v7 and v8 specs will likely need to be included.
Solution
I think it might be great if we could have a more relaxed approach to generating ids.
Something like this:
// Id type
[Strongly(newIdGenerator: typeof(MyCustomIdGenerator))]
public readonly partial struct SomeId;
// Id generator
public static class MyCustomIdGenerator
{
public static Guid New() => NewId.NextSequentialGuid();
}
Th generated code can use the fully qualified name of MyCustomIdGenerator to call the static method New().
public static TYPENAME New() => new TYPENAME(MyProject.MyCustomIdGenerator.New());
This way the id can be generated in whatever way it's needed, no need to create a new Id type for each possible case.
Problem
Currently different types of Guid are supported, such as
Guid.NewGuid()MassTransit.NewIdGuidCombThere's also this open issue to support Ulid.
At some point UUID v7 and v8 specs will likely need to be included.
Solution
I think it might be great if we could have a more relaxed approach to generating ids.
Something like this:
Th generated code can use the fully qualified name of
MyCustomIdGeneratorto call the static methodNew().This way the id can be generated in whatever way it's needed, no need to create a new Id type for each possible case.