Is it possible to add BindAttribute to parameter in action filter?
Each of my view models implements IViewModel { string Prefix { get; } } interface and I would like to set [Bind(Prefix = Model.Prefix)] for Action parameter automatically.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You cannot apply attributes at runtime, they are metadata and are baked into the assembly at compile-time, that’s the reason you cannot write
[Bind(Prefix = Model.Prefix)].Model.Prefixneeds to be constant and known at compile-time for this to work. Could you describe your scenario in more details, maybe there’s another way to achieve your goal.