This is a migrated thread and some comments may be shown as answers.

Error with Q1 2010

4 Answers 76 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Neil Mercer
Top achievements
Rank 1
Neil Mercer asked on 07 Apr 2010, 02:07 AM
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.

4 Answers, 1 is accepted

Sort by
0
Brian Shackelford
Top achievements
Rank 1
answered on 07 Apr 2010, 04:30 AM
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.
0
Neil Mercer
Top achievements
Rank 1
answered on 07 Apr 2010, 04:41 AM
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 
0
Brian Shackelford
Top achievements
Rank 1
answered on 07 Apr 2010, 03:22 PM
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.
0
Zoran
Telerik team
answered on 09 Apr 2010, 02:23 PM
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.
Tags
Getting Started
Asked by
Neil Mercer
Top achievements
Rank 1
Answers by
Brian Shackelford
Top achievements
Rank 1
Neil Mercer
Top achievements
Rank 1
Zoran
Telerik team
Share this question
or