Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnumListHandler should skip lists that have an ExistsIn attribute #150

Open
fsateler opened this issue Nov 8, 2016 · 1 comment
Open

Comments

@fsateler
Copy link
Contributor

fsateler commented Nov 8, 2016

This way one could have a form using an enum but limiting the usable values (useful for when one is creating multiple distinct forms for the same general operation), or replacing the enum text values.

public override bool CanHandle() => 
    GetUnderlyingType(FieldGenerator).IsEnum && !HasExistInAttibute();

private bool HasExistInAttibute() => 
    FieldGenerator.Metadata.AdditionalValues.ContainsKey(ExistsInAttribute.ExistsKey)
    && FieldGenerator.Metadata.AdditionalValues[ExistsInAttribute.ExistsKey] as bool? == true;
@robdmoore
Copy link
Member

Very reasonable. Feel free to raise a PR :)

On 9 Nov 2016, at 1:33 AM, Felipe Sateler [email protected] wrote:

This way one could have a form using an enum but limiting the usable values (useful for when one is creating multiple distinct forms for the same general operation), or replacing the enum text values.

public override bool CanHandle() =>
GetUnderlyingType(FieldGenerator).IsEnum && !HasExistInAttibute();

private bool HasExistInAttibute() =>
FieldGenerator.Metadata.AdditionalValues.ContainsKey(ExistsInAttribute.ExistsKey)
&& FieldGenerator.Metadata.AdditionalValues[ExistsInAttribute.ExistsKey] as bool? == true;

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants