Beispiel #1
0
        /// <summary>
        /// Using a hack data source, simple query with no tricks
        /// </summary>
        static void TestUnit2()
        {
            var data = new TestData();

            var dataSource = new BlackBoxDataSource <Person>();

            dataSource.DataSource = data.Persons;

            dataSource.Where = @"Name == ""Bob"" and Id > 3";

            var result = dataSource.Select();

            Console.WriteLine(SerializeObject(result));
        }
Beispiel #2
0
        /// <summary>
        /// Using a hack data source, query with custom types
        /// </summary>
        static void TestUnit3()
        {
            var data = new TestData();

            var dataSource = new BlackBoxDataSource <Person>();

            dataSource.DataSource = data.Persons;

            dataSource.Where = @"Regex.IsMatch(Name,""^(?i)bob(by)?$"") and Id > 3";

            var config = new ParsingConfig {
                CustomTypeProvider = new DynamicLinqTypeProvider()
            };

            var result = dataSource.Select(config);

            Console.WriteLine(SerializeObject(result));
        }