diff --git a/Linq-to-Sql.md b/Linq-to-Sql.md index 5a74f64..2377207 100644 --- a/Linq-to-Sql.md +++ b/Linq-to-Sql.md @@ -1,37 +1,37 @@ [中文](LinqToSql) | **English** -原本不支持 IQueryable 主要出于使用习惯的考虑,编写代码的智能总会提示出现一堆你不想使用的方法(对不起,我有强迫症),IQueryable 自身提供了一堆没法实现的方法,还有外部入侵的扩展方法,严重影响编码体验。如下图: +Originally not supporting IQueryable is mainly due to the consideration of usage habits. The intelligence of writing code will always prompt a bunch of methods you don't want to use. IQueryable itself provides a bunch of methods that cannot be implemented, as well as external intrusion extension methods, which seriously affect Coding experience. As shown below: ![image](https://user-images.githubusercontent.com/16286519/57295126-5dd7bd00-70fc-11e9-99c0-d1c46423afa2.png) -v1.4.0+ 版本请使用以下命令安装(老版本不需要安装): +For FreeSql v1.4.0+ version, please use the following items to install with commands (old version does not need to be installed): > dotnet add package FreeSql.Extensions.Linq -## 特别说明 +## Special Note -* 请尽量不要在 ISelect 模式下的使用 Linq 方法:GroupJoin、Select、SelectMany、Join、DefaultIfEmpty; +* Please try not to use the following Linq methods in `ISelect` mode: `GroupJoin`, `Select`, `SelectMany`, `Join` and `DefaultIfEmpty`. -* 如果一定要在 ISelect 中使用 .Select() 方法,请务必在 .ToList() 之前调用它; +* If you must use the `.Select()` method in `ISelect`, be sure to call it before `.ToList()`. ## IQueryable -FreeSql 提供强大的数据查询对象 ISelect。 +FreeSql provides a powerful data query object: ISelect. -FreeSql.Extensions.Linq v1.4.0+ 实现了 IQueryable 查询对象常用功能,以便在各框架中交互使用。 +FreeSql.Extensions.Linq v1.4.0+ implements the common functions of IQueryable query objects for interactive use in various frameworks. ```csharp -//将 ISelect 转为 IQueryable +//Convert ISelect to IQueryable IQueryable queryable = fsql.Select().AsQueryable(); -//Linq 方法查询 +//Linq Query var t1 = queryable.Where(a => a.id == 1).FirstOrDefault(); -//将 IQueryable 还原为 ISelect +//Restore IQueryable to ISelect ISelect select = queryable.RestoreToSelect(); ``` -注意:IQueryable 的实现目前不支持 GroupBy,可以考虑使用 RestoreSelect 方法转回 ISelect 进行查询 +Note: The implementation of IQueryable does not currently support `GroupBy`. You can consider using the `RestoreSelect` method to switch back to `ISelect` for query. ## Where ```csharp