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

Getting errors after upgrade to Q3

3 Answers 114 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Paul
Top achievements
Rank 1
Paul asked on 09 Nov 2009, 10:45 AM
Hi,
   I have just upgraded to Q3 and am now getting the following error.
Error 2 Cannot implicitly convert type 'System.Linq.IQueryable<CSENETORM.Assetassignment>' to 'Telerik.OpenAccess.Query.IObjectScopeQuery<CSENETORM.Assetassignment>'. An explicit conversion exists (are you missing a cast?) 

The area that causes this is.
       
            using (scope)  
            {  
                IObjectScopeQuery<Assetassignment> result = null;  
 
                result = from c in scope.Extent<Assetassignment>()  
                         where c.ID = 1  
                         select c;  
             } 

How can I resolve this?

3 Answers, 1 is accepted

Sort by
0
Damyan Bogoev
Telerik team
answered on 10 Nov 2009, 09:14 AM
Hello Paul,

In order to avoid this error you should use IQueryable instead of IObjectScopeQuery. There have been some changes in types and namespaces for the OpenAccess LINQ support in the Q3 release which results with this side-effect.
The IQueriable approach should solve your issue.

Kind regards,
Damyan Bogoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Devanand Chahal
Top achievements
Rank 2
answered on 24 Nov 2009, 09:02 AM
Hello Damyan,

I have same type of problem, and as per your suggestion to paul i did same thing but still problem is as it is. When i tested my code with 2009.2.701.5 trial versi0n it was working fine but with 2009.3.1104.2 version i m getting below mentioned error:

Error 1 'System.Linq.IQueryable<T>' does not contain a definition for 'BackendQuery' and no extension method 'BackendQuery' accepting a first argument of type 'System.Linq.IQueryable<T>' could be found (are you missing a using directive or an assembly reference?) C:\Appli.Net\Memotech 6.0 Projects\Memotech6\Cpa\Services\AuthorizationComponent\Model\Security\SecureQuery.cs 106 35 AuthorizationComponent

I am sending you my code snippet :

 

public class SecureQuery<T> : IObjectScopeQuery<T>, IOrderedQueryable<T>, IQueryable<T>, IEnumerable<T>, IOrderedQueryable, IQueryable, IEnumerable, IQueryProvider
{

 

 

private IObjectScopeQuery<T> _InternalQuery;

 

 

private IQueryProvider _InternalProvider;

 

 

public SecureQuery(IObjectScope scope)
{

 

_InternalQuery = scope.Extent<T>();

 

_InternalProvider = _InternalQuery

as IQueryProvider;

 

}


public

 

string BackendQuery
 {

 

 

    get { return _InternalQuery.BackendQuery; } // I am getting compile time error on this line

 

}


As per ur suggestion I changed IObjectScopeQuery to IQueryable  

 but getting same compile time error.

same is happening with debug, ForwardsOnly,IgnoreUncommitted and ParallelFetch

please suggest me any solution .... awaiting ur response


0
Alexander
Telerik team
answered on 24 Nov 2009, 12:37 PM
Hi Devanand Chahal,

The BackendQuery property has been substituted by the ToString() method. This is what you can use to obtain the SQL for particular query.
The rest of the query properties (Debug, ForwardsOnly, IgnoreUncommitted ,ParallelFetch) are now replaced with methods with the same names that are executed directly against the IQueryable instance returned by the scope.Extent<T>() method:
var result = from c in Scope.Extent<Company>().ForwardsOnly(true).ParallelFetch(true).IgnoreUncommitted(true).Debug(false)
            where c.Name == "Telerik" select c;

Kind regards,
Alexander
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Paul
Top achievements
Rank 1
Answers by
Damyan Bogoev
Telerik team
Devanand Chahal
Top achievements
Rank 2
Alexander
Telerik team
Share this question
or