This article introduces some simple code which allows easy addition of search functionality which can be used to search any object (files, .NET classes) and display the search results together in a single view.
BackgroundThis demo is presented in ASP.NET MVC so basic MVC knowledge would be useful, although this solution could be applied to other .NET environments.
Using the CodeThe main work is done in the implementations of the abstract base class Searcher. In this example, some dummy data is created in the constructor, this is then queried for matching items in the Search method and projected into a SearchResult. Note how RouteInformation is populated. The entries in the RouteInformation dictionary will be used to create an ActionLink in the MVC view.
public class ProductSearcher : SearcherView the Original article
Нема коментара:
Постави коментар