Skip to content

Commit e8ec014

Browse files
committed
Add "Getting Started" links to main docs page.
1 parent 26149ed commit e8ec014

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

docs/content/home.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
lastmod: 2017-11-06
2+
lastmod: 2018-06-05
33
date: 2016-10-16
44
title: Home
55
weight: 10
@@ -21,6 +21,10 @@ needed to query and update databases from managed code. Its features include:
2121
* High Performance: code is stress tested for performance bottlenecks
2222
* Lightweight: Library only implements ADO.NET core
2323

24+
### Getting Started
25+
26+
Read [how to install](./overview/installing/) and a [basic example](./tutorials/basic-api/) of using the API.
27+
2428
### Why use MySql over Oracle’s Connector/NET?
2529

2630
MySqlConnector is a clean-room reimplementation of the [MySQL Protocol](https://dev.mysql.com/doc/internals/en/client-server-protocol.html)
@@ -37,7 +41,7 @@ and is not based on [Oracle’s Connector/NET](https://github.com/mysql/mysql-co
3741
<td><strong>Async</strong></td>
3842
<td><strong>Fully asynchronous</strong> I/O</td>
3943
<td>Async calls map to synchronous I/O</td>
40-
<td>Uses fewer thread pool threads</td>
44+
<td>Uses fewer thread pool threads; higher throughput</td>
4145
</tr>
4246
<tr>
4347
<td><strong>Development</strong></td>

docs/content/tutorials/basic-api.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
date: 2018-06-05
3+
menu:
4+
main:
5+
parent: tutorials
6+
title: Basic API
7+
weight: 5
8+
---
9+
10+
Basic API
11+
=========
12+
13+
MySqlConnector aims to be fully ADO.NET-compatible; its API should feel almost identical to other .NET database drivers.
14+
Here’s a basic code snippet to get you started.
15+
16+
```csharp
17+
var connString = "Server=myserver;User ID=mylogin;Password=mypass;Database=mydatabase";
18+
19+
using (var conn = new MySqlConnection(connString))
20+
{
21+
await conn.OpenAsync();
22+
23+
// Insert some data
24+
using (var cmd = new MySqlCommand())
25+
{
26+
cmd.Connection = conn;
27+
cmd.CommandText = "INSERT INTO data (some_field) VALUES (@p)";
28+
cmd.Parameters.AddWithValue("p", "Hello world");
29+
await cmd.ExecuteNonQueryAsync();
30+
}
31+
32+
// Retrieve all rows
33+
using (var cmd = new MySqlCommand("SELECT some_field FROM data", conn))
34+
using (var reader = await cmd.ExecuteReaderAsync())
35+
while (await reader.ReadAsync())
36+
Console.WriteLine(reader.GetString(0));
37+
}
38+
```
39+
40+
You can find more info about the ADO.NET API in the [MSDN documentation](https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/ado-net-overview) or in many tutorials on the Internet.
41+

0 commit comments

Comments
 (0)