Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit ce47406

Browse files
committed
prevent wrapping in API Overview
1 parent bbd7c1e commit ce47406

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

README.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -322,76 +322,83 @@ The API is minimal, providing basic shortcuts for the primitive SQL statements:
322322

323323
### Notes
324324

325-
Extension methods hang off the implementation agnostic ADO.NET `IDbConnection`.
325+
OrmLite Extension methods hang off ADO.NET's `IDbConnection`.
326326

327327
`CreateTable<T>` and `DropTable<T>` create and drop tables based on a classes type definition (only public properties used).
328328

329-
By default Selection methods use parameterized SQL whilst any selection methods ending with **Fmt** allow you to construct Sql using C# `string.Format()` syntax.
329+
By default the Select API's use parameterized SQL whilst any selection methods ending with **Fmt** allow you to construct Sql using C# `string.Format()` syntax.
330330

331331
If your SQL doesn't start with a **SELECT** statement, it is assumed a WHERE clause is being provided, e.g:
332332

333333
```csharp
334-
var tracks = db.SelectFmt<Track>("Artist = {0} AND Album = {1}", "Nirvana", "Heart Shaped Box");
334+
var tracks = db.SelectFmt<Track>("Artist = {0} AND Album = {1}",
335+
"Nirvana",
336+
"Heart Shaped Box");
335337
```
336338

337-
The same results could also be fetched with:
339+
Which is equivalent to:
338340

339341
```csharp
340-
var tracks = db.SelectFmt<Track>("select * from track WHERE Artist={0} AND Album={1}", "Nirvana", "Heart Shaped Box");
342+
var tracks = db.SelectFmt<Track>("SELECT * FROM track WHERE Artist={0} AND Album={1}",
343+
"Nirvana",
344+
"Heart Shaped Box");
341345
```
342346

343-
**Select** returns multiple records
347+
**Select** returns multiple records:
344348

345349
```csharp
346350
List<Track> tracks = db.Select<Track>()
347351
```
348352

349-
**Single** returns a single record. Alias: `First`
353+
**Single** returns a single record:
350354

351355
```csharp
352-
Track track = db.SingleFmt<Track>("RefId = {0}", refId)
356+
Track track = db.Single<Track>(q => q.RefId == refId)
353357
```
354358

355-
**Dictionary** returns a Dictionary made from the first two columns. Alias: `GetDictionary`
359+
**Dictionary** returns a Dictionary made from the first two columns:
356360

357361
```csharp
358-
Dictionary<int, string> trackIdNamesMap = db.Dictionary<int, string>("select Id, Name from Track")
362+
Dictionary<int, string> trackIdNamesMap = db.Dictionary<int, string>(
363+
"select Id, Name from Track")
359364
```
360365

361-
**Lookup** returns an `Dictionary<K, List<V>>` made from the first two columns. Alias: `GetLookup`
366+
**Lookup** returns an `Dictionary<K, List<V>>` made from the first two columns:
362367

363368
```csharp
364-
Dictionary<int, List<string>> albumTrackNames = db.Lookup<int, string>("select AlbumId, Name from Track")
369+
Dictionary<int, List<string>> albumTrackNames = db.Lookup<int, string>(
370+
"select AlbumId, Name from Track")
365371
```
366372

367-
**List** returns a List of first column values. Alias: `GetList`
373+
**Column** returns a List of first column values:
368374

369375
```csharp
370376
List<string> trackNames = db.Column<string>("select Name from Track")
371377
```
372378

373-
**HashSet** returns a HashSet of distinct first column values. Alias: `GetHashSet`
379+
**HashSet** returns a HashSet of distinct first column values:
374380

375381
```csharp
376382
HashSet<string> uniqueTrackNames = db.ColumnDistinct<string>("select Name from Track")
377383
```
378384

379-
**Scalar** returns a single scalar value. Alias: `GetScalar`
385+
**Scalar** returns a single scalar value:
380386

381387
```csharp
382388
var trackCount = db.Scalar<int>("select count(*) from Track")
383389
```
384390

385-
Anonymous types passed into **Where** are treated like an **AND** filter.
391+
Anonymous types passed into **Where** are treated like an **AND** filter:
386392

387393
```csharp
388394
var track3 = db.Where<Track>(new { AlbumName = "Throwing Copper", TrackNo = 3 })
389395
```
390396

391-
**Select** statements take in parameterized SQL using properties from the supplied anonymous type (if any)
397+
**Select** statements take in parameterized SQL using properties from the supplied anonymous type (if any):
392398

393399
```csharp
394-
var track3 = db.Select<Track>("select * from Track Where AlbumName = @album and TrackNo = @trackNo",
400+
var track3 = db.Select<Track>(
401+
"select * from Track Where AlbumName = @album and TrackNo = @trackNo",
395402
new { album = "Throwing Copper", trackNo = 3 })
396403
```
397404

@@ -404,7 +411,7 @@ var tracks = db.SelectByIds<Track>(new[]{ 1,2,3 });
404411

405412
### Other Notes
406413

407-
- All **Insert**, **Update**, and **Delete** methods take multiple params, while `Insert`, `UpdateAll` and `DeleteAll` take IEnumerables.
414+
- All **Insert**, **Update**, and **Delete** methods take multiple params, while `InsertAll`, `UpdateAll` and `DeleteAll` take IEnumerables.
408415
- `Save` and `SaveAll` will Insert if no record with **Id** exists, otherwise it Updates.
409416
- Methods containing the word **Each** return an IEnumerable<T> and are lazily loaded (i.e. non-buffered).
410417

0 commit comments

Comments
 (0)