- 增加 ISelect`1 ToDictionary 方法查询返回字典;

This commit is contained in:
28810
2020-03-20 01:52:43 +08:00
parent a5e6573851
commit 22a2450e05
17 changed files with 246 additions and 1 deletions

View File

@ -268,6 +268,18 @@ namespace FreeSql.Tests.Odbc.PostgreSQL
var t11 = select.Where(a => a.Type.Name.Length > 0).ToList(true);
var t21 = select.Where(a => a.Type.Parent.Name.Length > 0).ToList(true);
}
[Fact]
public void ToDictionary()
{
var testDto1 = select.Limit(10).ToDictionary(a => a.Id);
var testDto2 = select.Limit(10).ToDictionary(a => a.Id, a => new { a.Id, a.Title });
var repo = g.pgsql.GetRepository<Topic>();
var dic = repo.Select.Limit(10).ToDictionary(a => a.Id);
var first = dic.First().Value;
first.Clicks++;
repo.Update(first);
}
class TestGuidIdToList
{
public Guid id { get; set; }