Info
Version: | 2.0.0.1 |
Author(s): | Livewire-UK |
Last Update: | Thursday, July 25, 2013 |
.NET Fiddle: | Create the first Fiddle |
Project Url: | https://bitbucket.org/jonhoare/modelsearcher |
NuGet Url: | https://www.nuget.org/packages/LivewireUK.ModelSearcher |
Install
Install-Package LivewireUK.ModelSearcher
dotnet add package LivewireUK.ModelSearcher
paket add LivewireUK.ModelSearcher
LivewireUK.ModelSearcher Download (Unzip the "nupkg" after downloading)
Dependencies
- System.Linq.Dynamic(1.0.0)
I quickly realised that if I made it generic, this tool could be a great benefit to others. Then, after building a List of ISearchableModels you can call .Search(searchText) which will use Linq.Dynamic to build a search criteria based on all of the [Searchable] properties for that ISearchableModel and will perform the search, returning you the filtered List. You can also Target a particular Searchable Property on your model to search, by calling .Search(m => m.PropertyToSearch, searchText). This will then cause a search on the particular PropertyToSearch as long as it is attributed as Searchable.
Currently this only searches across Properties that are either string/int/long. Other types to come soon! Source code and Wiki available at https://bitbucket.org/jonhoare/modelsearcher!.