VB+ AnonymousType_4'2

2 posts, 0 answers
  1. Jaspreet
    Jaspreet avatar
    3 posts
    Member since:
    Oct 2007

    Posted 01 Feb 2011 Link to this post

    I am using multiple joins in a LINQ query to get the data out of multiple classes.

    Here is my Query,

    Dim AmPropertyAddress = (From AmericanPropAddress In scope.Extent(Of AmericanPropertyAddress)()
                                          Join PropertyAddressAssoc In scope.Extent(Of PropertyAddressAssociation)() On AmericanPropAddress.id Equals PropertyAddressAssoc.urbanPropertyAddress.id
                                            Where AmericanPropAddress.id = PlaceID
                                          Join GeographicLocationRelation In scope.Extent(Of GeographicLocationRelationship)() On PropertyAddressAssoc.propertyEntity.id Equals GeographicLocationRelation.toGeographicLocation.id
                                          Join ExchangeService In scope.Extent(Of ExchangeServiceArea)() On GeographicLocationRelation.fromGeographicLocation.id Equals ExchangeService.id
                                          Select New With {.StNumber = AmericanPropAddress.streetNrFirst,
                                                           .StNamePfix = AmericanPropAddress.streetNamePrefix,
                                                           .StName = AmericanPropAddress.streetName,
                                                           .StType = AmericanPropAddress.streetType,
                                                           .StSuffix = AmericanPropAddress.streetSuffix,
                                                           .StCity = AmericanPropAddress.locality,
                                                           .StState = AmericanPropAddress.stateOrProvince,
                                                           .StCountry = AmericanPropAddress.country,
                                                           .StZip = AmericanPropAddress.postcode,
                                                           .StNPANXX = ExchangeService.code}).ToList()
    Return AmPropertyAddress

    But i am getting this error:

    An exception occured during the execution of '
    Extent<Core180.AmericanPropertyAddress>.Join(Extent<Core180.PropertyAddressAssociation>, AmericanPropAddress => AmericanPropAddress.id, PropertyAddressAssoc => PropertyAddressAssoc.urbanPropertyAddress.id, (AmericanPropAddress, PropertyAddressAssoc) => new VB$AnonymousType_4`2(AmericanPropAddress = AmericanPropAddress, PropertyAddressAssoc = PropertyAddressAssoc)).Where($VB$It => ($VB$It.AmericanPropAddress.id == value(Core180BLL.PlaceBLL+_Closure$__7).$VB$Local_PlaceID)).Join(Extent<Core180.GeographicLocationRelationship>, $VB$It => $VB$It.PropertyAddressAssoc.propertyEntity.id, GeographicLocationRelation => GeographicLocationRelation.toGeographicLocation.id, ($VB$It1, GeographicLocationRelation) => new VB$AnonymousType_5`2($VB$It1 = $VB$It1, GeographicLocationRelation = GeographicLocationRelation)).Join(Extent<Core180.ExchangeServiceArea>, $VB$It => $VB$It.GeographicLocationRelation.fromGeographicLocation.id, ExchangeService => ExchangeService.id, ($VB$It1, ExchangeService) => new VB$AnonymousType_6`11(StNumber = $VB$It1.$VB$It1.AmericanPropAddress.streetNrFirst, StNamePfix = $VB$It1.$VB$It1.AmericanPropAddress.streetNamePrefix, StName = $VB$It1.$VB$It1.AmericanPropAddress.streetName, StType = $VB$It1.$VB$It1.AmericanPropAddress.streetType, StSuffix = $VB$It1.$VB$It1.AmericanPropAddress.streetSuffix, StLATA = $VB$It1.$VB$It1.AmericanPropAddress.locality, StCity = $VB$It1.$VB$It1.AmericanPropAddress.locality, StState = $VB$It1.$VB$It1.AmericanPropAddress.stateOrProvince, StCountry = $VB$It1.$VB$It1.AmericanPropAddress.country, StZip = $VB$It1.$VB$It1.AmericanPropAddress.postcode, StNPANXX = ExchangeService.code))'. See InnerException for more details.

    The Inner Exception is :

    {"Could not load type 'VB+AnonymousType_4`2' from assembly 'Telerik.OpenAccess.Runtime, Version=2010.3.1125.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342'.":"VB+AnonymousType_4`2"}

    I don't know how to resolve this, please help me.
    Thanks in advance.


  2. Petko_I
    Admin
    Petko_I avatar
    184 posts

    Posted 07 Feb 2011 Link to this post

    Hello Jaspreet,

    Please, accept our apologies. You have encountered an issue with our implementation for multiple joins in queries written in Visual Basic. We will be working on fixing this as soon as possible. For the time being, there may be a way to rewrite the query so that joins are simulated. If you have associations in your persistent classes and you can navigate from the AmericanPropAddress to ExchangeService in a similar way to this AmericanPropAddress.PropertyAddressAssoc.GeographicLocation.ExchangeService, then you can use that approach instead of the join. You may need to start the selection from the persistent type which is involved in the many side of an association so that you traverse the one-side navigation properties. To illustrate this point, suppose that we have orders, for every order there is one customer and we have many order details. Then an example query which mimics a join and starts the selection from the many side would be:
    Dim query = From orderDetail In Scope.OrderDetails _                       
             Select New With { _
               .Name = String.Concat(orderDetail.Order.Customer.ContactName, " ", orderDetail.Order.Customer.CompanyName) _
               }
    If you can give us the structure of your persistent model we can tell you whether there is a workaround query that accomplishes the same result.

    We do hope the provided information was helpful. Again, we apologize for the inconvenience caused.

    Regards,
    Petko_I
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
  3. DevCraft banner
Back to Top