Skip to content

Commit 107852e

Browse files
committed
1. 添加贡献者
2. 快速使用 3. 安装 4. sqlmap配置
1 parent 7be9834 commit 107852e

File tree

7 files changed

+436
-378
lines changed

7 files changed

+436
-378
lines changed

README.md

+25-153
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,17 @@ description : 拥抱 跨平台 DotNet Core,是时候了。高性能、高生
1010

1111
# 简介
1212

13-
[![Join the chat at https://gitter.im/SmartSql-DotNet/Lobby](https://badges.gitter.im/SmartSql-DotNet/Lobby.svg)](https://gitter.im/SmartSql-DotNet/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
14-
15-
>[SmartSql-Starter](https://github.com/Ahoo-Wang/SmartSql-Starter)
16-
17-
18-
19-
## Nuget Packages
20-
21-
| Package | NuGet Stable | Downloads |
22-
| ------- | -------- | ------- |
23-
| [SmartSql](https://www.nuget.org/packages/SmartSql/) | [![SmartSql](https://img.shields.io/nuget/v/SmartSql.svg)](https://www.nuget.org/packages/SmartSql/) | [![SmartSql](https://img.shields.io/nuget/dt/SmartSql.svg)](https://www.nuget.org/packages/SmartSql/) |
24-
| [SmartSql.TypeHandler](https://www.nuget.org/packages/SmartSql.TypeHandler/) | [![SmartSql.TypeHandler](https://img.shields.io/nuget/v/SmartSql.TypeHandler.svg)](https://www.nuget.org/packages/SmartSql.TypeHandler/) | [![SmartSql.TypeHandler](https://img.shields.io/nuget/dt/SmartSql.TypeHandler.svg)](https://www.nuget.org/packages/SmartSql.TypeHandler/) |
25-
| [SmartSql.DyRepository](https://www.nuget.org/packages/SmartSql.DyRepository/) | [![SmartSql.DyRepository](https://img.shields.io/nuget/v/SmartSql.DyRepository.svg)](https://www.nuget.org/packages/SmartSql.DyRepository/) | [![SmartSql.DyRepository](https://img.shields.io/nuget/dt/SmartSql.DyRepository.svg)](https://www.nuget.org/packages/SmartSql.DyRepository/) |
26-
| [SmartSql.DIExtension](https://www.nuget.org/packages/SmartSql.DIExtension/) | [![SmartSql.DIExtension](https://img.shields.io/nuget/v/SmartSql.DIExtension.svg)](https://www.nuget.org/packages/SmartSql.DIExtension/) | [![SmartSql.DIExtension](https://img.shields.io/nuget/dt/SmartSql.DIExtension.svg)](https://www.nuget.org/packages/SmartSql.DIExtension/) |
27-
| [SmartSql.Cache.Redis](https://www.nuget.org/packages/SmartSql.Cache.Redis/) | [![SmartSql.Cache.Redis](https://img.shields.io/nuget/v/SmartSql.Cache.Redis.svg)](https://www.nuget.org/packages/SmartSql.Cache.Redis/) | [![SmartSql.Cache.Redis](https://img.shields.io/nuget/dt/SmartSql.Cache.Redis.svg)](https://www.nuget.org/packages/SmartSql.Cache.Redis/) |
28-
| [SmartSql.ZooKeeperConfig](https://www.nuget.org/packages/SmartSql.ZooKeeperConfig/) | [![SmartSql.ZooKeeperConfig](https://img.shields.io/nuget/v/SmartSql.ZooKeeperConfig.svg)](https://www.nuget.org/packages/SmartSql.ZooKeeperConfig/) | [![SmartSql.ZooKeeperConfig](https://img.shields.io/nuget/dt/SmartSql.ZooKeeperConfig.svg)](https://www.nuget.org/packages/SmartSql.ZooKeeperConfig/) |
29-
30-
## 0. Why
13+
## Why
3114

3215
- 拥抱 跨平台 DotNet Core,是时候了。
33-
- 高性能、高生产力,超轻量级的ORM。**107kb**
16+
- 高性能、高生产力,超轻量级的ORM。**156kb** (Dapper:**168kb**)
3417

35-
---
36-
37-
## 1. So SmartSql
18+
## So SmartSql
3819

3920
- TargetFrameworks: .NETFramework 4.6 & .NETStandard 2.0
4021
- SmartSql = SmartSql = MyBatis + Cache(Memory | Redis) + ZooKeeper + R/W Splitting +Dynamic Repository + ......
4122

42-
---
43-
44-
## 2. 主要特性
23+
## 主要特性
4524

4625
- 1 ORM
4726
- 1.1 Sync
@@ -69,9 +48,7 @@ description : 拥抱 跨平台 DotNet Core,是时候了。高性能、高生
6948
- 7.3.1 Load SmartSqlMapSource Directory
7049
- 7.3 SmartSql.ZooKeeperConfig (ZooKeeper 分布式配置文件加载器)
7150

72-
---
73-
74-
## 3. 性能评测
51+
## 性能评测
7552

7653
``` ini
7754

@@ -98,140 +75,35 @@ Intel Core i7-6700K CPU 4.00GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
9875

9976
---
10077

101-
## 4. 安装 (NuGet)
102-
103-
``` csharp
104-
Install-Package SmartSql
105-
```
106-
107-
## 5. 常规代码
108-
109-
### 查询
110-
111-
``` csharp
112-
ISmartSqlMapper SqlMapper = MapperContainer.Instance.GetSqlMapper();
113-
SqlMapper.Query<T_Test>(new RequestContext
114-
{
115-
Scope = "T_Test",
116-
SqlId = "GetList",
117-
Request = new { Ids = new long[] { 1, 2, 3, 4 } }
118-
});
119-
```
120-
121-
### 事务
122-
123-
``` csharp
124-
try
125-
{
126-
ISmartSqlMapper SqlMapper = MapperContainer.Instance.GetSqlMapper();
127-
SqlMapper.BeginTransaction();
128-
//BizCode
129-
SqlMapper.CommitTransaction();
130-
}
131-
catch (Exception ex)
132-
{
133-
SqlMapper.RollbackTransaction();
134-
throw ex;
135-
}
136-
```
137-
138-
## 6. 最佳实践
139-
140-
### 6.1 安装 SmartSql.DIExtension
141-
142-
``` chsarp
143-
Install-Package SmartSql.DIExtension
144-
```
145-
146-
### 6.2 注入依赖
78+
## Nuget Packages
14779

148-
``` csharp
149-
services.AddSmartSql();
150-
services.AddRepositoryFactory();
151-
services.AddRepositoryFromAssembly((options) =>
152-
{
153-
options.AssemblyString = "SmartSql.Starter.Repository";//仓储接口项目
154-
});
155-
```
80+
| Package | NuGet Stable | Downloads |
81+
| ------- | -------- | ------- |
82+
| [SmartSql](https://www.nuget.org/packages/SmartSql/) | [![SmartSql](https://img.shields.io/nuget/v/SmartSql.svg)](https://www.nuget.org/packages/SmartSql/) | [![SmartSql](https://img.shields.io/nuget/dt/SmartSql.svg)](https://www.nuget.org/packages/SmartSql/) |
83+
| [SmartSql.TypeHandler](https://www.nuget.org/packages/SmartSql.TypeHandler/) | [![SmartSql.TypeHandler](https://img.shields.io/nuget/v/SmartSql.TypeHandler.svg)](https://www.nuget.org/packages/SmartSql.TypeHandler/) | [![SmartSql.TypeHandler](https://img.shields.io/nuget/dt/SmartSql.TypeHandler.svg)](https://www.nuget.org/packages/SmartSql.TypeHandler/) |
84+
| [SmartSql.DyRepository](https://www.nuget.org/packages/SmartSql.DyRepository/) | [![SmartSql.DyRepository](https://img.shields.io/nuget/v/SmartSql.DyRepository.svg)](https://www.nuget.org/packages/SmartSql.DyRepository/) | [![SmartSql.DyRepository](https://img.shields.io/nuget/dt/SmartSql.DyRepository.svg)](https://www.nuget.org/packages/SmartSql.DyRepository/) |
85+
| [SmartSql.DIExtension](https://www.nuget.org/packages/SmartSql.DIExtension/) | [![SmartSql.DIExtension](https://img.shields.io/nuget/v/SmartSql.DIExtension.svg)](https://www.nuget.org/packages/SmartSql.DIExtension/) | [![SmartSql.DIExtension](https://img.shields.io/nuget/dt/SmartSql.DIExtension.svg)](https://www.nuget.org/packages/SmartSql.DIExtension/) |
86+
| [SmartSql.Cache.Redis](https://www.nuget.org/packages/SmartSql.Cache.Redis/) | [![SmartSql.Cache.Redis](https://img.shields.io/nuget/v/SmartSql.Cache.Redis.svg)](https://www.nuget.org/packages/SmartSql.Cache.Redis/) | [![SmartSql.Cache.Redis](https://img.shields.io/nuget/dt/SmartSql.Cache.Redis.svg)](https://www.nuget.org/packages/SmartSql.Cache.Redis/) |
87+
| [SmartSql.ZooKeeperConfig](https://www.nuget.org/packages/SmartSql.ZooKeeperConfig/) | [![SmartSql.ZooKeeperConfig](https://img.shields.io/nuget/v/SmartSql.ZooKeeperConfig.svg)](https://www.nuget.org/packages/SmartSql.ZooKeeperConfig/) | [![SmartSql.ZooKeeperConfig](https://img.shields.io/nuget/dt/SmartSql.ZooKeeperConfig.svg)](https://www.nuget.org/packages/SmartSql.ZooKeeperConfig/) |
88+
| [SmartSql.Options](https://www.nuget.org/packages/SmartSql.Options/) | [![SmartSql.Options](https://img.shields.io/nuget/v/SmartSql.Options.svg)](https://www.nuget.org/packages/SmartSql.Options/) | [![SmartSql.Options](https://img.shields.io/nuget/dt/SmartSql.ZooKeeperConfig.svg)](https://www.nuget.org/packages/SmartSql.Options/) |
15689

157-
### 6.3 定义仓储接口
158-
159-
``` csharp
160-
/// <summary>
161-
/// 属性可选: [SqlMap(Scope = "User")] ,不设置 则默认 Scope 模板:I{Scope}Repository
162-
/// 可传入自定义模板
163-
/// RepositoryBuilder builder=new RepositoryBuilder("I{Scope}DAL");
164-
/// </summary>
165-
public interface IUserRepository : IRepository<User, string>
166-
{
167-
/// <summary>
168-
/// 属性可选 [Statement(Execute = ExecuteBehavior.Auto,Id = "Query")]
169-
/// 默认 Execute:Auto ,自动判断 执行类型
170-
/// 默认 Id : 方法名
171-
/// </summary>
172-
/// <param name="reqParams"></param>
173-
/// <returns></returns>
174-
[Statement(Sql = "Select Top(@taken) T.* From User T With(NoLock);")]
175-
IEnumerable<User> QueryBySql(int taken);
176-
}
177-
```
90+
## 示例项目
17891

179-
### 6.4 尽情享用
180-
181-
``` csharp
182-
public class UserService
183-
{
184-
private readonly ITransaction _transaction;
185-
private readonly IUserRepository _userRepository;
186-
187-
public UserService(
188-
ITransaction transaction
189-
, IUserRepository userRepository)
190-
{
191-
_transaction = transaction;
192-
_userRepository = userRepository;
193-
}
194-
195-
public long Add(AddRequest request)
196-
{
197-
int existsNum = _userRepository.Exists(new { request.UserName });
198-
if (existsNum > 0)
199-
{
200-
throw new ArgumentException($"{nameof(request.UserName)} has already existed!");
201-
}
202-
return _userRepository.Insert(new Entitiy.User
203-
{
204-
UserName = request.UserName,
205-
Password = request.Password,
206-
Status = Entitiy.UserStatus.Ok,
207-
CreationTime = DateTime.Now,
208-
});
209-
}
210-
211-
public void UseTransaction()
212-
{
213-
try
214-
{
215-
_transaction.BeginTransaction();
216-
//Biz();
217-
_transaction.CommitTransaction();
218-
}
219-
catch (Exception ex)
220-
{
221-
_transaction.RollbackTransaction();
222-
throw ex;
223-
}
224-
}
225-
}
226-
```
92+
>[SmartSql-Starter](https://github.com/Ahoo-Wang/SmartSql-Starter)
22793
228-
## 7. 文档地址
94+
## 文档地址
22995

23096
- [在线阅读地址](https://doc.smartsql.net/)
23197
- [PDF](https://www.gitbook.com/download/pdf/book/ahoo-wang/smartsql-doc-cn)
23298
- [Mobi](https://www.gitbook.com/download/mobi/book/ahoo-wang/smartsql-doc-cn)
23399
- [ePub](https://www.gitbook.com/download/epub/book/ahoo-wang/smartsql-doc-cn)
234100

235-
## 8. 技术交流
101+
## 文档贡献者
102+
103+
- [Ahoo-Wang](https://github.com/Ahoo-Wang)
104+
- [RocherKong](https://github.com/RocherKong)
105+
- [ElderJames](https://github.com/ElderJames)
106+
107+
## 技术交流
236108

237109
点击链接加入QQ群【SmartSql 官方交流群】:[604762592](https://jq.qq.com/?_wv=1027&k=5Sy8Ahw)

SUMMARY.md

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
* [SmartSqlMapConfig](config/sqlmap-config.md)
1515
* [SmartSqlMap](config/sqlmap.md)
16-
* [Cache](config/cache-tag.md)
1716

1817
## 动态仓储
1918

config/cache-tag.md

-53
This file was deleted.

config/sqlmap-config.md

-4
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@
1616
<Read Name="ReadDB-0" ConnectionString="Data Source=.;database=TestDB;uid=sa;pwd=SmartSql.net" Weight="80"/>
1717
<Read Name="ReadDB-1" ConnectionString="Data Source=.;database=TestDB;uid=sa;pwd=SmartSql.net" Weight="20"/>
1818
</Database>
19-
20-
<!--
2119
<TypeHandlers>
2220
<TypeHandler Name="Json" Type="SmartSql.TypeHandler.JsonTypeHandler,SmartSql.TypeHandler"/>
2321
<TypeHandler Name="Xml" Type="SmartSql.TypeHandler.XmlTypeHandler,SmartSql.TypeHandler"/>
2422
</TypeHandlers>
25-
-->
2623
<SmartSqlMaps>
2724
<SmartSqlMap Path="Maps" Type="Directory"></SmartSqlMap>
2825
<!--<SmartSqlMap Path="Maps/T_Table.xml"></SmartSqlMap>-->
29-
3026
</SmartSqlMaps>
3127
</SmartSqlMapConfig>
3228

0 commit comments

Comments
 (0)