SteveDunn / Vogen

A semi-opinionated library which is a source generator and a code analyser. It Source generates Value Objects
Apache License 2.0
888 stars 46 forks source link

Fluent builder #678

Closed SteveDunn closed 3 weeks ago

SteveDunn commented 1 month ago

Describe the feature

I noticed this nice feature from a similar value object library named 'Typely'.

public class TypesSpecification : ITypelySpecification
{
    public void Create(ITypelyBuilder builder)
    {
        builder.OfInt().For("ContactId").GreaterThan(0);

        builder.OfString()
            .For("InsuranceCode")
            .NotEmpty()
            .Length(10)
            .Must(x => x.StartsWith("A91"))
            .Normalize(x => x.ToUpper());
xamir82 commented 1 month ago

Very much dislike this style personally.

SteveDunn commented 3 weeks ago

Thanks for the feedback. Looking at it again after a couple of months, it doesn't look as appealing as it did initially.