SqlSugar源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

3 years ago
<p align="center">
<span>English</span> |
<a href="https://www.donet5.com/Home/Doc">中文</a>
</p>
3 years ago
3 years ago
## SqlSugar
3 years ago
SqlSugar ORM is a library providing Object/Relational Mapping (ORM) support to applications, libraries, and frameworks.
Using SqlSugar is very simple , And it's powerful.
3 years ago
- Support Support CodeFirst data migration.
- Support Join query 、 Union all 、 Subquery
- Support Configure the query
- Support DbFirst import entity class from database, or use Generation Tool.
- Support one-to-many and many-to-many navigation properties
- Support MySql、SqlServer、Sqlite、Oracle 、 postgresql 、达梦、人大金仓 、神通数据库
## Join query
Super simple query syntax
```cs
var query5 = db.Queryable<Order>()
.LeftJoin<Custom> ((o, cus) => o.CustomId == cus.Id)
.LeftJoin<OrderItem> ((o, cus, oritem ) => o.Id == oritem.OrderId)
.LeftJoin<OrderItem> ((o, cus, oritem , oritem2) => o.Id == oritem2.OrderId)
.Where(o => o.Id == 1)
.Select((o, cus) => new ViewOrder { Id = o.Id, CustomName = cus.Name })
.ToList();
```
```sql
SELECT
[o].[Id] AS [Id],
[cus].[Name] AS [CustomName]
FROM
[Order] o
Left JOIN [Custom] cus ON ([o].[CustomId] = [cus].[Id])
Left JOIN [OrderDetail] oritem ON ([o].[Id] = [oritem].[OrderId])
Left JOIN [OrderDetail] oritem2 ON ([o].[Id] = [oritem2].[OrderId])
WHERE
([o].[Id] = @Id0)
6 years ago
```
8 years ago
6 years ago