Register ModelBinders in Owin startup.cs

I created a custom binder for decimal places, but ran into a problem. I can not register it through Global.asax.cs, because I do not have it.

How to make this line work in startup.cs class?

ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder());
+4
source share
1 answer

It will work in the OWIN startup class only if it is System.Web.Mvcreferenced.

public void Configuration(IAppBuilder app)
{
    ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder());
    ...
}
+1
source

Source: https://habr.com/ru/post/1611302/


All Articles