Error with Q1 2010

5 posts, 0 answers
  1. Neil Mercer
    Neil Mercer avatar
    18 posts
    Member since:
    Sep 2009

    Posted 06 Apr 2010 Link to this post

    Hi,

    I started playing with OA with the last 2009 build, but seeing the new features in Q1 2010 have attempted to set up a new project using Q1 build.

    I added a .rlinq to my project, mapped the database (nice and simple, only a single table - Projects), and have attempted to use it to populate a RadGrid in an ASP page.  Here's my code to databind the grid:

    Using Context as JobTrackerEntityDiagrams = New JobTrackerEntityDiagrams  
       Dim proj = From c In Context.Projects _  
                  Select c  
       grdProjectList.DataSource = proj  
       grdProjectList.DataBind()  
    End Using 

    Everything compiles OK, but when running and attempting to populate the grid I get the following error:
        Unable to cast object of type 'Telerik.OpenAccess.Query.ExtentQueryImpl'1[System.Collections.Generic.IList'1[JobTracker.Project]]' to type 'System.Collections.Generic.IList'1[JobTracker.Project]'.

    Where have I gone wrong? :)

    Thanks,
    Neil.

  2. Brian Shackelford
    Brian Shackelford avatar
    7 posts
    Member since:
    May 2008

    Posted 06 Apr 2010 Link to this post

    Try making one small change:

    Using Context as JobTrackerEntityDiagrams = New JobTrackerEntityDiagrams     
       Dim proj = From c In Context.Projects _     
                  Select c     
       grdProjectList.DataSource = proj.ToList()     
       grdProjectList.DataBind()     
    End Using    
     

    There are several other methods you can use to bind to the Datasource, this is just one of them.  Let me know if you need more assistance.
  3. DevCraft banner
  4. Neil Mercer
    Neil Mercer avatar
    18 posts
    Member since:
    Sep 2009

    Posted 06 Apr 2010 Link to this post

    Hi Brian,

    No luck.  I still get the same error message. 

    I forgot to mention where the code is tripping - it's in the OA generated EntityDiagrams class on the following code:

    Public ReadOnly Property Projects() as IList(Of Project)  
       Get 
          Return Me.GetAll(Of IList(Of Project))()  
       End Get 
    End Property 
  5. Brian Shackelford
    Brian Shackelford avatar
    7 posts
    Member since:
    May 2008

    Posted 07 Apr 2010 Link to this post

    Two things:

    The "Context" in your using statement (if this is an ASP.NET app) could also be interpreted as "System.Web.HttpContext".  That being said, this does not seem to be the problem.  I have duplicated your error by using the .ToList(), .ToArray(), context.(T).GetAll(Of T), etc...

    I suggest opening a ticket with Tech Support as it may be a problem in the implementation of the VB code generation.  I will try to dig at it later this evening.

    If you are comfortable with C#, all these functions appear to work properly with it.
  6. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 09 Apr 2010 Link to this post

    Hi Brian and Neil,

     The error actually happens because of some bugs we discovered in the VB .NET code generation. Those are now fixed and we will upload the fixed version on our website next week. Sorry for the inconvenience caused.

    Kind regards,
    Zoran
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
DevCraft banner