igor-tkachev / bltoolkit

Business Logic Toolkit for .NET
MIT License
297 stars 112 forks source link

Building query fails when static method used in Select closure #336

Closed ili closed 9 years ago

ili commented 9 years ago

This test will fail:

        [Test]
        public void BuildQueryTest()
        {
            ForEachProvider(db =>
            {
                var query = db.Child.Select(_ => Model.Child.CreateInstance(_, _.Parent));

                var list1 = query.ToList();
                var list2 = query.Where(_ => _.ChildID > 0).ToList(); // will fail here with IOE

                AreEqual(list1, list2);
                AreEqual(list2, Child);
            }
                );
        }