In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to bind Action parameters to Model in NopCommerce. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Action parameters in asp.net MVC are not only basic types, but also support entity parameters. So how does the data from the client be mapped or transformed into entity objects? Is through the entity binding class ModelBinder. Before requesting to convert to the Action method of background Controller, this series of classes capture the passed data, parse and transform it, and finally become entity class objects.
Before the system starts, the method Application_Start method in Global.asax.cs calls the following code to define the parameter conversion rules.
/ / model binders ModelBinders.Binders.Add (typeof (BaseNopModel), new NopModelBinder ())
NopModelBinder inherits DefaultModelBinder's entity binding class from the system, but seems to leave an interface instead of using it. It mainly inherits the methods of the parent class, with a slight change: the method BindModel adds binding support for NopModel.
Public override object BindModel (ControllerContext controllerContext, ModelBindingContext bindingContext) {var model = base.BindModel (controllerContext, bindingContext); if (model is BaseNopModel) ((BaseNopModel) model) .BindModel (controllerContext, bindingContext); return model;}
Method GetModelProperties has added a filtering method, but this method has not been enabled.
The class BaseNopModel is the base class for all Model and supports the storage of custom attributes. And there is a method BindModel bound to the parser, but no subclasses have been found to implement this method.
This is the end of this article on "how to bind Action parameters in Model in NopCommerce". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.