петак, 6. јануар 2012.

C# Simple Search Class

Introduction

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.

Background

This 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 Code

The 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 : Searcher

View the Original article

Нема коментара:

Постави коментар