Describe the feature
I'd love to be able to have value generators generated by Vogen for my Guid-based primary keys in EF. The wiki clearly shows how you could (unsafely) create value generators for an int type, but Guid types can be generated safely, and it save a lot of boilerplate of Vogen could do this for me.
I'd propose that when the underlying type is a Guid AND the author has enabled the EfCoreConverter, then a value generator is constructed as follows:
// this is the triggering struct
[ValueObject<Guid>(Conversions.Default | Conversions.EfCoreValueConverter)]
public partial struct MyId;
// this is the generated class
public class MyIdValueGenerator : ValueGenerator<MyId>
{
public override bool GeneratesTemporaryValues => false;
public override MyId Next(EntityEntry entry) => MyId.From(Guid.NewGuid());
}
I'm happy to try to build it, if it's an idea you would accept into the project. I'm open to other triggers, that's just the most logical one that comes to mind.
Describe the feature
I'd love to be able to have value generators generated by Vogen for my
Guid-based primary keys in EF. The wiki clearly shows how you could (unsafely) create value generators for aninttype, butGuidtypes can be generated safely, and it save a lot of boilerplate of Vogen could do this for me.I'd propose that when the underlying type is a
GuidAND the author has enabled theEfCoreConverter, then a value generator is constructed as follows:I'm happy to try to build it, if it's an idea you would accept into the project. I'm open to other triggers, that's just the most logical one that comes to mind.