- 修复 GroupBy 类型转换错误;#186

- 修复 .ToList(a => new DTO(a.id)) 报 未将对象引用设置到对象的实例 问题; #187
- 修复 update语句,二元运算解析出错; #184
This commit is contained in:
28810
2020-01-19 23:53:06 +08:00
parent 774511e7ec
commit c64deb3d20
33 changed files with 428 additions and 9 deletions

View File

@ -155,6 +155,19 @@ namespace FreeSql.Tests.MySqlConnector
public string name { get; set; } //这是join表的属性
public int ParentId { get; set; } //这是join表的属性
}
class TestDto2
{
public int id { get; set; }
public string name { get; set; } //这是join表的属性
public int ParentId { get; set; } //这是join表的属性
public TestDto2() { }
public TestDto2(int id, string name)
{
this.id = id;
this.name = name;
}
}
[Fact]
public void ToList()
{
@ -171,6 +184,18 @@ namespace FreeSql.Tests.MySqlConnector
var testDto44 = select.LeftJoin(a => a.Type.Guid == a.TypeGuid).Limit(10).ToList(a => new TestDto() { });
var testDto55 = select.LeftJoin(a => a.Type.Guid == a.TypeGuid).Limit(10).ToList<TestDto>();
var testDto211 = select.Limit(10).ToList(a => new TestDto2(a.Id, a.Title));
var testDto212 = select.Limit(10).ToList(a => new TestDto2());
var testDto213 = select.Limit(10).ToList(a => new TestDto2 { });
var testDto214 = select.Limit(10).ToList(a => new TestDto2() { });
var testDto215 = select.Limit(10).ToList<TestDto2>();
var testDto2211 = select.LeftJoin(a => a.Type.Guid == a.TypeGuid).Limit(10).ToList(a => new TestDto2(a.Id, a.Title));
var testDto2222 = select.LeftJoin(a => a.Type.Guid == a.TypeGuid).Limit(10).ToList(a => new TestDto2());
var testDto2233 = select.LeftJoin(a => a.Type.Guid == a.TypeGuid).Limit(10).ToList(a => new TestDto2 { });
var testDto2244 = select.LeftJoin(a => a.Type.Guid == a.TypeGuid).Limit(10).ToList(a => new TestDto2() { });
var testDto2255 = select.LeftJoin(a => a.Type.Guid == a.TypeGuid).Limit(10).ToList<TestDto2>();
var t0 = select.Limit(50).ToList();
var sql1 = select.LeftJoin(a => a.Type.Guid == a.TypeGuid).ToSql();
@ -735,6 +760,9 @@ namespace FreeSql.Tests.MySqlConnector
var testpid1 = g.mysql.Insert<TestTypeInfo>().AppendData(new TestTypeInfo { Name = "Name" + DateTime.Now.ToString("yyyyMMddHHmmss") }).ExecuteIdentity();
var fkfjfj = select.GroupBy(a => a.Title)
.ToList(a => a.Sum(a.Value.TypeGuid));
var aggsql1 = select
.GroupBy(a => a.Title)
.ToSql(b => new