Skip to content

Commit

Permalink
u
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahoo-Wang committed Sep 20, 2018
1 parent 635f36a commit 4c121f9
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 28 deletions.
54 changes: 28 additions & 26 deletions best-practice/aspnetcore.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,11 @@ Install-Package SmartSql.DIExtension
- 写库(Write)必选 唯一节点
- 读库(Read)可选 多节点配置

#### Postgresql

- Postgresql 客户端 *Npgsql*

``` powershell
Install-Package Npgsql
```

``` xml
<?xml version="1.0" encoding="utf-8" ?>
<SmartSqlMapConfig xmlns="http://SmartSql.net/schemas/SmartSqlMapConfig.xsd">
<Settings
IsWatchConfigFile="true"
/>
<Database>
<!--ParameterPrefix:[SqlServer:@ | MySQL:? |Oracle::|Postgresql:@] -->
<DbProvider Name="SqlClientFactory" ParameterPrefix="@" Type="Npgsql.NpgsqlFactory,Npgsql"/>
<Write Name="WriteDB" ConnectionString="Server=localhost;Port=5432;User Id=postgres;Password=Rocher2016; Database=SmartSqlDB;"/>
</Database>
<SmartSqlMaps>
<SmartSqlMap Path="Maps/" Type="Directory"></SmartSqlMap>
</SmartSqlMaps>
</SmartSqlMapConfig>
```
### 安装对应ADO.NET驱动

#### MYSQL
#### MySql

- 安装mysql 客户端 *Mysql.Data*
- 安装mysql 驱动 *Mysql.Data*

``` powershell
Install-Package Mysql.Data
Expand Down Expand Up @@ -93,6 +70,31 @@ Install-Package Mysql.Data
</SmartSqlMapConfig>
```

#### Postgresql

- Postgresql 驱动 *Npgsql*

``` powershell
Install-Package Npgsql
```

``` xml
<?xml version="1.0" encoding="utf-8" ?>
<SmartSqlMapConfig xmlns="http://SmartSql.net/schemas/SmartSqlMapConfig.xsd">
<Settings
IsWatchConfigFile="true"
/>
<Database>
<!--ParameterPrefix:[SqlServer:@ | MySQL:? |Oracle::|Postgresql:@] -->
<DbProvider Name="SqlClientFactory" ParameterPrefix="@" Type="Npgsql.NpgsqlFactory,Npgsql"/>
<Write Name="WriteDB" ConnectionString="Server=localhost;Port=5432;User Id=postgres;Password=Rocher2016; Database=SmartSqlDB;"/>
</Database>
<SmartSqlMaps>
<SmartSqlMap Path="Maps/" Type="Directory"></SmartSqlMap>
</SmartSqlMaps>
</SmartSqlMapConfig>
```

### 注入依赖

``` csharp
Expand Down
18 changes: 17 additions & 1 deletion guide/dy-repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@
/// 可选,当不使用 SmartSqlMap.Statement 时可直接定义 Sql
/// </summary>
public string Sql { get; set; }
/// <summary>
/// 命令类型
/// </summary>
public CommandType CommandType { get; set; } = CommandType.Text;
/// <summary>
/// 数据源
/// </summary>
public DataSourceChoice SourceChoice { get; set; } = DataSourceChoice.Unknow;
}
```

Expand Down Expand Up @@ -122,7 +130,15 @@
/// <summary>
/// 返回DataSet
/// </summary>
GetDataSet = 6
GetDataSet = 6
/// <summary>
/// 返回 ValueTuple
/// </summary>
FillMultiple = 7,
/// <summary>
/// 返回嵌套实体
/// </summary>
GetNested = 8
}
```

Expand Down
2 changes: 1 addition & 1 deletion introduction/common-problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SmartSql 希望 开发人员更多的接触 Sql ,获得绝对的控制权与安
> **Codefirst 一个美好,却不切实际的想法。**
## 对SmartSql很感兴趣,不只从何开始
## 对SmartSql很感兴趣,不知从何开始

请阅读示例项目:<https://github.com/Ahoo-Wang/SmartSql-Starter>

Expand Down

0 comments on commit 4c121f9

Please sign in to comment.