SteveDunn / Vogen

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

Instance with 1 parameter #562

Closed arteny closed 4 months ago

arteny commented 6 months ago

Describe the feature

For the underlying type string, I often use a set of strings that need to be strongly typed. For example:

    [ValueObject(typeof(string))]
    [Instance("Users", "Users")]
    public struct TabName {}

means name and value are same, can you allow to add it specifying only one parameter for such cases like [Instance("Users")]?

SteveDunn commented 6 months ago

Hi @arteny - an interesting proposal. This looks like it might be better as an enum though. I spawned off 'Intellenum' due to the similarities between Vogen 'insances' and enums.

arteny commented 6 months ago

Hi @arteny - an interesting proposal. This looks like it might be better as an enum though. I spawned off 'Intellenum' due to the similarities between Vogen 'insances' and enums.

ahh, ok, Inetllenum looks good for this, then just a same purposal for it (to allow 1 parameter for string instances)

SteveDunn commented 4 months ago

@arteny - how are you getting on with Intellenum? I've closed this one, but let me know if you need any help.

fbestfriends commented 4 months ago

@arteny - how are you getting on with Intellenum? I've closed this one, but let me know if you need any help.

Intellenum is good enough, but it miss same feature to create instances where value=name using 1 parameter. It looks more perfect and it is more misprint-resistance.

SteveDunn commented 4 months ago

@arteny @fbestfriends - I've created a feature request in Intellenum: https://github.com/SteveDunn/Intellenum/issues/127