-
Notifications
You must be signed in to change notification settings - Fork 965
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
Custom enum description attribute property names #277
Custom enum description attribute property names #277
Conversation
Thanks @mexx. That was quick!! The TC build is broken. Can you check that out please? |
@@ -98,5 +100,20 @@ public static IDateTimeHumanizeStrategy DateTimeHumanizeStrategy | |||
get { return _dateTimeHumanizeStrategy; } | |||
set { _dateTimeHumanizeStrategy = value; } | |||
} | |||
|
|||
private const string DefaultEnumDescriptionPropertyName = "Description"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about the implementation. It feels a bit complex. What if we just created a DescriptionPropertyLocator
predicate function? Let them keep the logic. This way they can be as flexible as they want!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to provide the possibility to have different property names per enum type.
But as already mentioned it a first attempt, so let discuss further the possibilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a second thought, it would be flexible enough since the PropertyInfo
has the reference to the DeclaringType
, so even my use case can be implemented with the predicate function.
I'll rewrite it now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if that level of granular control is necessary to be honest with you. Also remember PropertyInfo
is from the attribute not the target enum!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can just expose Func<PropertyInfo, bool>
? That way they won't be able to nominate different attributes for different enums but I call YAGNI on it for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. Func<PropertyInfo, bool>
is done.
…roperty-names Custom enum description attribute property names
Awesome. Thanks @mexx |
Thanks! I will give it a try and provide feedback ... |
Not deployed yet. I will let you know as soon as it hits NuGet. On Fri, May 23, 2014 at 6:50 PM, Miguel Moura [email protected]:
|
This is now released to NuGet as v1.27.0. Thanks for your contribution. |
Resolves #272
any feedback is welcome