Skip to content

Commit fa0d589

Browse files
committed
Updated README
1 parent 276d489 commit fa0d589

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

README.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,40 @@
11
# DataAbstractions.Dapper
2-
2+
A light abstraction around Dapper and Dapper.Contrib that also maintains the behavior IDbConnection.
33
## Basic Usage
44

5-
Create a connection adapter
5+
Create a data accessor
66

77
```csharp
88

9-
var dataAccessor = new DataAccessor(new SqlConnection(connectionString));
9+
IDataAccessor dataAccessor = new DataAccessor(new SqlConnection(connectionString));
1010

1111
```
12-
Execute Dapper queries and sql commands normally
12+
Execute Dapper queries and sql commands normally.
1313

1414
```csharp
1515

1616
var person = await dataAccessor.QueryAsync<Person>(sql, new {Id});
1717

18-
```
18+
```
19+
20+
Note: You need to dispose of the dataAccessor as your would with IDbConnection.
21+
22+
## Dapper.Contrib methods
23+
24+
IDataAccessor includes Dapper.Contrib methods
25+
26+
```csharp
27+
28+
dataAccessor.Insert(new Person { Name = "John Doe" });
29+
30+
```
31+
32+
## IDbConnection methods
33+
34+
IDataAccessor implements IDbConnection, so you can access things like the ConnectionTimeout value.
35+
36+
```csharp
37+
38+
var timeout = dataAccessor.ConnectionTimeout;
39+
40+
```

0 commit comments

Comments
 (0)