public static void FilterTest() { var filter = new PersonView() { StartTime = DateTime.Now.AddDays(-30) }; var context = new TestContext(); //var test = context.People.Select(p => new //{ // x = String.Concat(p.Name, System.Data.Entity.SqlServer.SqlFunctions.StringConvert((double)p.ID).Trim()) //}).ToList(); var people = context.People.Map<Person, PersonView>(filter).Filter("Name.Length:>:20:or:(Name:=:Brice Lambson:and:Records-Count:Contains:11)"); foreach (var person in people) { Console.WriteLine(person.NameAndID); foreach (var record in person.GroupedRecords) { Console.WriteLine("Sum Counts For Group: " + record.Sum(r => (int)r.Value)); } } //Console.WriteLine("--No Filter--"); //people = context.People.Map<Person, PersonView>(); //foreach (var person in people) //{ // Console.WriteLine(person.Name); // foreach (var record in person.GroupedRecords) // { // Console.WriteLine("Sum Counts For Group: " + record.Sum(r => (int)r.Value)); // } //} Console.ReadLine(); }
public static void NonGenericMappingTest() { var context = new TestContext(); var people = (IEnumerable<PersonView>)context.People.Map(typeof(PersonView)); foreach (var person in people) Console.WriteLine(person.Name); }