Created
November 16, 2015 00:26
-
-
Save hyrmn/56a298475bf6f63bce42 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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