Getting errors after upgrade to Q3

4 posts, 0 answers
  1. Paul
    Paul avatar
    113 posts
    Member since:
    May 2009

    Posted 09 Nov 2009 Link to this post

    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?
  2. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 10 Nov 2009 Link to this post

    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.
  3. DevCraft banner
  4. Devanand Chahal
    Devanand Chahal avatar
    26 posts
    Member since:
    Mar 2009

    Posted 24 Nov 2009 Link to this post

    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


  5. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 24 Nov 2009 Link to this post

    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.
Back to Top