jonpryor / dblinq2007

Automatically exported from code.google.com/p/dblinq2007
0 stars 0 forks source link

ArgumentException wrt MemberAccess when accessing a member. #260

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Reported as: 
http://groups.google.com/group/dblinq/browse_thread/thread/ea953ac40fb72bd5

The problem is that this fails:

    List<byte[]> document = (from d in db.DocumentBlobs
        where d.DocumentBlobID == Request.QueryString["id"]
        select d.Blob).ToList();

while this works:

    string qs = Request.QueryString["id"];

    List<byte[]> document = (from d in db.DocumentBlobs
        where d.DocumentBlobID == qs
        select d.Blob).ToList();

This happens because of SqlProvider.cs:GetLiteral(), which doesn't support 
ExpressionType.MemberAccess (it's commented out), and `Request.QueryString` is 
apparently compiled into a MemberAccess before there is a MemberAccess.Call() 
to the get_Item() method.

Original issue reported on code.google.com by jonmpr...@gmail.com on 22 Jun 2010 at 6:45

GoogleCodeExporter commented 9 years ago
SqlProvider.GetLiteral() also impacts:

http://groups.google.com/group/dblinq/browse_thread/thread/415a6c5b8f14cb12

Specifically, SqlProvider.GetLiteral() also needs to support ExpressionType.New 
(and probably every other ExpressionType that is currently commented out).  
Another example of valid-yet-fails code:

            Northwind db = CreateDB();
            var q = from p in db.Products
                    where p.ProductID > new Nullable<int>(5).Value
                    select new ProductWrapper3(
                        (int)p.ProductID, (int?)p.SupplierID);

In the above, the "error" is the 'new' within the 'where' expression.

Original comment by jonmpr...@gmail.com on 24 Jun 2010 at 2:23