ServiceStack [IgnoreDataMember] conditionally on per request basis
I am aware of 3 ways to do it statically:
1. [DataContract]+[DataMember]
or
2. [IgnoreDataMember]
or
3. JsConfig<Poco>.ExcludePropertyNames
However, they are fixed. Meaning they are NOT dynamic, I can't make a
decision on run-time to ignore or not ignore that property.
I am thinking of hacking the [IgnoreDataMember] attribute and change it to
something like
[IgnoreDataMemberIf(objConditionSet)]
or
[IgnoreDataMemberIfNotAuthorized(UserAuth)]
Could you please suggest me if this is a good approach? Were there
something like that in SS already built-in that I am not aware of?
Please suggest.
No comments:
Post a Comment