I've written a couple of custom model binders now, and have realised that I've fallen into the trap of relying on magic strings, e.g.:
if (bindingContext.ValueProvider.ContainsPrefix("PaymentKey"))
{
paymentKey = bindingContext.ValueProvider.GetValue("PaymentKey").AttemptedValue;
}
I'd like to be able to use an expression to strongly-type the prefix names, but can't figure out how, and would be grateful for some assistance.
Thanks.