https://github.com/dotnetnext/sqlsugar.ioc
.NET5 .NETCore3.1 IOC简化 封装类库
https://github.com/dotnetnext/sqlsugar.ioc
Last synced: 9 months ago
JSON representation
.NET5 .NETCore3.1 IOC简化 封装类库
- Host: GitHub
- URL: https://github.com/dotnetnext/sqlsugar.ioc
- Owner: DotNetNext
- Created: 2021-02-10T08:17:38.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-10T08:25:02.000Z (almost 3 years ago)
- Last Synced: 2025-02-28T15:18:06.442Z (10 months ago)
- Language: C#
- Homepage:
- Size: 13.9 MB
- Stars: 20
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 1、简介
SqlSugar.IOC 是SqlSugar官方IOC框架,简单好用 10秒包会
## 版本支持:
.NET CORE 3.1
.NET5
SqlSugarCore 5.0.2.6 +
# 2、功能
1、SqlSugar注入
2、类注入
3、接口注入
# 3、安装
Nuget: SqlSugar.IOC
用到 DbScoped.Sugar 的类库就需要引用 SqlSugarCore,否则不需要安装
# 4、用法
```cs
//注入SqlSugar对象
services.AddSqlSugar(new IocConfig()
{
ConnectionString = "server=.;uid=sa;pwd=haosql;database=qq1",
DbType = IocDbType.SqlServer,
IsAutoCloseConnection = true
});
```
### 使用注入后SqlSugar对象
```cs
public List GetMapping()
{
List result=DbScoped.Sugar.Queryable()
.Mapper(it => it.OrgInfo, it => it.OrgId)
.Mapper(it => it.UserInfo, it => it.UserId)
.ToList();
DbScoped.Sugar.Deleteable().In(1).ExecuteCommand();
return result;
}
```
# 5.更多用法
http://www.donet5.com/Doc/10/2253