The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Exception selecting all columns from a joined query

Last post 03-27-2008, 4:15 PM by David.Parsons. 5 replies.
Sort Posts: Previous Next
  •  03-27-2008, 2:57 PM 8590

    Exception selecting all columns from a joined query

    Hi,

     I'm getting an exception executing the following code (I need a couple of columns from the orders table and all columns from the details table) This is ES 2007.1.1210.0:

    Code:
                OrdersQuery oQuery = new OrdersQuery("o");
                OrderDetailsQuery dQuery = new OrderDetailsQuery("d");
                oQuery.InnerJoin(dQuery).On(dQuery.OrderID == oQuery.OrderID);
                oQuery.Select(oQuery.OrderID, dQuery);
                OrdersCollection orders = new OrdersCollection();
                orders.Load(oQuery);
    The exception is:

    at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)

    at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)

    at System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)

    at EntitySpaces.Interfaces.esColumnMetadataCollection.get_Item(String columnName) in C:\source\depot\ThirdParty\EntitySpaces\2007.1.1210.0\Source\EntitySpaces.Interfaces\esColumnMetadataCollection.cs:line 234

    at EntitySpaces.Interfaces.esDynamicQuery.Load() in C:\source\depot\ThirdParty\EntitySpaces\2007.1.1210.0\Source\EntitySpaces.Interfaces\DynamicQuery\esDynamicQuery.cs:line 361

    at BusinessObjects.OrdersCollection.Load(OrdersQuery query) in C:\source\depot\ThirdParty\EntitySpaces\2007.1.1210.0\EntitySpacesDemo\EntitySpacesDemo\Generated\Orders.cs:line 1568

    at EntitySpacesDemo.Demo.DemoBasicsLoadAll() in C:\source\depot\ThirdParty\EntitySpaces\2007.1.1210.0\EntitySpacesDemo\EntitySpacesDemo\SampleCode.cs:line 94

    at EntitySpacesDemo.Demo.buttonRun_Click(Object sender, EventArgs e) in C:\source\depot\ThirdParty\EntitySpaces\2007.1.1210.0\EntitySpacesDemo\EntitySpacesDemo\Demo.cs:line 860

     
    Thanks,
    Leonid
     
     
  •  03-27-2008, 3:16 PM 8593 in reply to 8590

    Re: Exception selecting all columns from a joined query

    I don't know if this is it or not but move your "Select" above the "InnerJoin". The error reporting is so much better in ES2008 and that will help alot. Try that and see if it fixes it.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  03-27-2008, 3:28 PM 8594 in reply to 8590

    Re: Exception selecting all columns from a joined query

    dQuery already contains a column named "OrderID". I would drop oQuery.OrderID from the Select(), or give it an alias.
    David Neal Parsons
    www.entityspaces.net
  •  03-27-2008, 3:30 PM 8595 in reply to 8593

    Re: Exception selecting all columns from a joined query

    No luck, the same error. Do you plan any patches in version 2007 or everything is pushed to 2008?

     Thanks

  •  03-27-2008, 3:46 PM 8596 in reply to 8595

    Re: Exception selecting all columns from a joined query

    My previous reply was actually a response to Mike.

    David: I replaced OrderId with OrderDate, the result is the same. This sample is based on Northwind database, so it should be easy to reproduce.

     Leonid

  •  03-27-2008, 4:15 PM 8597 in reply to 8596

    Re: Exception selecting all columns from a joined query

    Yes, I was able to reproduce it in ES2007. You can do this:

    oQuery.Select(oQuery);

    But, not this:

    oQuery.Select(dQuery);

    That has been fixed in ES2008.


    David Neal Parsons
    www.entityspaces.net
View as RSS news feed in XML