mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
- 增加 ISelect`1 ToDictionary 方法查询返回字典;
This commit is contained in:
@ -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; }
|
||||
|
Reference in New Issue
Block a user