Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Linq to Examine

Dave Greasley edited this page Aug 22, 2015 · 3 revisions

LINQ to Examine is a package that allows querying of Examine indexes using standard LINQ syntax.

It also allows you to retrieve data using your own strongly typed models. The models need to have attributes applied to the classes and their properties so it can match them with the property names in the index.

That's where Concrete comes in. With the LINQ to Examine add-on we automatically add the right attributes to our model classes and properties so we can use our Concrete models to nicely retrieve data from Examine.

[NodeTypeAlias("BlogComment")]
public partial class BlogComment : UmbracoContent
{
	[Field("fullName")]
	public string FullName { get; set; } 
    }

Concrete generates the classes with the NodeTypeAlias attribute and all properties in the classes with the Field attribute. We then use it like so:

var index = new Index<BlogComment>();
IEnumerable<BlogComment> results = index.Where(c => c.FullName.ContainsAny("bill", "ben")).ToList();

Installation

Currently if you want to use the LINQ to examine addon you'll need to pull the source down and build it yourself. I will produce a separate nuget package for the addon shortly.