LINQ TO SQL

8 posts, 0 answers
  1. Sathish
    Sathish avatar
    25 posts
    Member since:
    Dec 2008

    Posted 02 Mar 2009 Link to this post

    Hi,

    How do I write LINQ to SQL queries in OpenAccess? Is it supported?

    query = From row in scope.Extent(of Products)

    Is this linq to entities or linq to sql? I dont want to download all the products from the database.

    I want to write linq to sql queries, how do I do that?
  2. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 03 Mar 2009 Link to this post

    Hello Sathish,
    LINQ to SQL is speciffic LINQ dialect implemented by ty the L2S runtime. What we provide is LINQ to OpenAccess - you can run LINQ queries against the OpenAccess runtime. The only speciffic thing is that you use the scope instead of L2S datacontext, and the Extent extension method to get the entity sets, example:
    L2S: context.GetCustomers() returns all customer entities

    OpenAccess: context.Extent<Customer>() returns all customer entities.

    The differences are very small as in both cases it is LINQ notation.



    Sincerely yours,
    Dimitar Kapitanov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Sathish
    Sathish avatar
    25 posts
    Member since:
    Dec 2008

    Posted 03 Mar 2009 Link to this post

    Hi,

    Thank you for the response. I understand that aspect of it, my question is more data related. So, If I have a linq statement such as

    query = from row in scope.extent<customers> _
                 where row.id > 100

    does this download the whole table data and then run the where condition against it? or does it generate "SELECT * FROM customers where row.id > 100"

    I dont want all the data to be download. I want it to convert my conditions to sql and exract only those data. does ORM support that?
  5. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 03 Mar 2009 Link to this post

    Hi Sathish,
    We try to push as much as possible of your query to the server. In your case SELECT * FROM customers where row.id > 100 will be generated. If that is not possible we inform you during compilation or runtime about the non-optimal query execution.

    Regards,
    Jan Blessenohl
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Sathish
    Sathish avatar
    25 posts
    Member since:
    Dec 2008

    Posted 03 Mar 2009 Link to this post

    Thank you very much for the reply. I just wanted to confirm that, because I will be quering a table with more than 100,000 records and I certainly do not want to download the whole table.

    I have another question,

    Where can I find a step by step tutorial about fetch plans, from the basics to advanced.

    Also, there are few bugs that I have come across in OA. Can I report them in forum here?
  7. Peter Brunner
    Admin
    Peter Brunner avatar
    89 posts

    Posted 03 Mar 2009 Link to this post

    Hi Sathish,

    Thank you for your continuous feedback.

    Please review the following resources for more information about Fetch Plans

    Please see also the documentation for Fetch Groups and related

    Last not least, you can also check an example project from our code library using Fetch Plans.

    Concerning bug reports, please download the most current trial version of OpenAccess and create a bug report ticket.

    Thanks for your contributions.

    All the best,
    Peter Brunner
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. Sathish
    Sathish avatar
    25 posts
    Member since:
    Dec 2008

    Posted 11 Mar 2009 Link to this post

    Hi,

    When I am writing a LINQ To OpenAccess query, what is the type of the object I am writing to? Is it Iqueryable.

    If I write

    Dim myQuery as IQuery (<-- IS THIS CORRECT? Should I use IQuery or Iqueryable?)

    myQuery = From row in os.Extent(Of Customer) WHERE ID > 100

    Does it translate into SQL query of "SELECT * FROM Customers WHERE ID > 100"
    or does it download the whole of customers table into memory and do a LINQ to Entities (i.e. loop through the data and return the result)

    I do not see as much performance as I should. Could you please confirm.

    Thank you.
  9. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 12 Mar 2009 Link to this post

    Hello Sathish,

    The type of result an OpenAccess Linq query is returning is IObjectScopeQuery<T>, which implements IQueriable<T> so you can use both of them.

    When a query like the one you asked for in your previous ticket executes, an SQL similar to "SELECT * FROM Customers WHERE ID > 100" is generated and only the desired result are returned. Not all objects are loaded in memory.

    If you require any other information regarding OpenAccess please do not hesitate to contact us again.

    Kind regards,
    Zoran
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
DevCraft banner