Skip to content

Instantly share code, notes, and snippets.

@hyrmn
Created November 16, 2015 00:26
Show Gist options
  • Select an option

  • Save hyrmn/56a298475bf6f63bce42 to your computer and use it in GitHub Desktop.

Select an option

Save hyrmn/56a298475bf6f63bce42 to your computer and use it in GitHub Desktop.
public class Office
{
public string Id { get; set; }
public string CompanyName { get; set; }
}
public class OfficeIndex : AbstractIndexCreationTask<Office>
{
public OfficeIndex()
{
Map = docs => from doc in docs
select new
{
Company = doc.CompanyName
};
Sort("Company", SortOptions.String);
}
public class Fields
{
public string Company { get; set; }
}
}
public class OfficeSummary
{
public string Company { get; set; }
}
public class luis : using_a_wired_environment
{
public luis()
{
var index = new OfficeIndex();
index.Execute(DocumentStore);
using (var bulkInsert = DocumentStore.BulkInsert())
{
bulkInsert.Store(new Office {Id = Id.New(), CompanyName = "House of Pain"});
}
}
public void basic_project()
{
RavenQueryStatistics stats;
var results = DocumentSession.Query<OfficeIndex.Fields, OfficeIndex>()
.Statistics(out stats)
.AsProjection<OfficeSummary>()
.ToList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment