In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to understand IValueProvider in ASP.NET MVC Beta, which is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
The ASP.NET MVC Beta version was released in October 2008. The features of this beta version are very close to the full features of the official V1 version, although several features (including several VS tool enhancements, etc.) will be added before the final V1 release. But the development team decided to call this version the "beta" version because it was of higher quality and testing than the previous preview version (which included a lot of bug fixes and performance tuning work), and they felt that the core features were now "fired" well enough that there would be no major changes from this version to the final version.
In the ASP.NET MVC Beta version, an overload with the IValueProvider parameter is provided in the UpdataModel method. So what's the use of this IValueProvider?
Let's first look at a simple scenario. For example, our blog system has a Post object, and the Post object has a Tags property and a Categories property. Their types are:
Post.Tags: StateList
< string>(a List in BlogEngine.NET
< T>Extension type of)
Post.Categories: StateList
< Category>If we were to use the UpdataModel method to update our Post Form form data into our Post object, we might have the following code:
/ / /
< summary>/ / Save the submitted new essay form to the database /
< /summary>[AcceptVerbs ("POST"), ActionName ("NewPost")] public ActionResult SaveNewPost (FormCollection form) {Post post = new Post (); try {UpdateModel (post, new [] {"Title", "Content", "Slug", "Tags", "Categories"});} catch {return View (post);}. }
Obviously, in the above code, when we use UpdateModel to update the Tags and Categories properties, it is impossible to succeed, because the UpdateModel method does not know how to convert the "Tags" and "Categories" data submitted by Form into StateList
< string>Type and StateList
< Category>Type. At this point, we need to provide a ValueProvider to do this transformation.
The above is how to understand IValueProvider in ASP.NET MVC Beta. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.