ADO.NET provider for Kintone / LINQ Queries
In This Topic
    LINQ Queries
    In This Topic

    LINQ queries demonstrate how to operate and query the Kintone objects wrapped in an Entity Framework data model. Listed below are some examples of LINQ queries supported by the Entity framework.

    Select and Filter

     The following query searches for records that have a value "155" for the AccountId column.

    var records = from p in context.Accounts
     where p.AccountId == "155"
      select p;


    You can also search for strings within strings. The following example retrieves all the entities with a value that contains "A" in the Name column.

    var records = from p in context.Accounts
      where p.Name.Contains("A") //using Contains to display name have a in thier name 
        select p;



     The following example limits the results returned to 10. This helps to limit display of records.

    var records = (from p in context.Accounts
      select p).Take(10); //taking 10 records

    Order By

    The following example executes a multicolumn sort. The results are sorted by Title in descending order. This helps to arrange items in a particular order.

     var records = (from p in context.Accounts
       orderby p.Age descending//Implementing Order By
         select p).Take(10); //taking 10 records


    The following example counts all entities that match a given criterion. 

    var _count = (from p in context.Accounts
      select p).Count();//Count Query based on number of records selected


    The following example groups entities based on a given criterion.

    var queryCreatedBy =
     from b in context.Accounts
      group b by b.CreatedBy into newGroup //Linq Group Query based on city
       orderby newGroup.Key descending
        select newGroup;


    The provider supports standard LINQ joins. The following is an example of a cross join between Accounts and Products.

    var records = from b in context.Accounts
     from e in context.Products
       select new { b, e };//Defining Cross Join