In the old MVC version there is a ValueProviderFactory
, but in MVC6, I can't find that factory. How could I define custom valueProvider in MVC6?
How does model binding work in ASP.NET Core MVC. In an empty project, change Startup class to add services and middleware for MVC. Add the following code to HomeController, demonstrating binding of simple types. Add the following code to HomeController, demonstrating binding of complex types.
The Binding class is used to bind a property of a control with the property of an object. For creating a Binding object, the developer must specify the property of the control, the data source, and the table field to which the given property will be bound.
You can add the factory in the ConfigureServices
method on your Startup
class.
services.Configure<MvcOptions>(options => {
options.ValueProviderFactories.Add(new CustomValueProviderFactory());
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With