File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,33 +46,46 @@ var compiler = new SqlCompiler();
4646var db = new QueryFactory (connection , compiler );
4747```
4848
49- ### Get all records
49+ ### Retrieve all records
5050``` cs
5151var books = db .Query (" Books" ).Get ();
5252```
5353
54- ### Published books only
54+ ### Retrieve published books only
5555``` cs
5656var books = db .Query (" Books" ).WhereTrue (" IsPublished" ).Get ();
5757```
5858
59- ### Get one book by Id
59+ ### Retrieve one book
6060``` cs
6161var introToSql = db .Query (" Books" ).Where (" Id" , 145 ).Where (" Lang" , " en" ).First ();
6262```
6363
64- ### Recent books: last 10
64+ ### Retrieve recent books: last 10
6565``` cs
6666var recent = db .Query (" Books" ).OrderByDesc (" PublishedAt" ).Limit (10 ).Get ();
6767```
6868
6969### Include Author information
7070``` cs
7171var books = db .Query (" Books" )
72- .Incluce (db .Query (" Authors" )) // Assumes that the Books table have a `AuthorId` column
72+ .Include (db .Query (" Authors" )) // Assumes that the Books table have a `AuthorId` column
7373 .Get ();
7474```
7575
76+ This will include the property "Author" on each "Book"
77+ ``` json
78+ [{
79+ "Id" : 1 ,
80+ "PublishedAt" : " 2019-01-01" ,
81+ "AuthorId" : 2
82+ "Author" : { // <-- included property
83+ "Id" : 2 ,
84+ "..." : " "
85+ }
86+ }]
87+ ```
88+
7689### Join with authors table
7790
7891``` cs
You can’t perform that action at this time.
0 commit comments