我刚刚在中添加了对该语法的支持
this commit
其中您的初始语法应按预期工作:
q.Select<WritingAssignment, WriterProfile, Blog>((wa, wp, b) => new
{
WritingAssignment = wa,
WriterProfile = wp,
SuggestedBlog = Sql.TableAlias(b, "b1"),
AcceptedBlog = Sql.TableAlias(b, "b2")
});
var values = Db.Select<Tuple<WritingAssignment, WriterProfile, Blog, Blog>>(q);
默认情况下,如果没有
EOT
如果设置了分隔符,则在元组中选择多个表将根据模型字段计数进行拆分,但只要所选字段列表与模型定义不匹配,就可以使用插入显式表分隔符
Sql.EOT
,例如:
q.Select<WritingAssignment, WriterProfile, Blog>((wa, wp, b) => new
{
Id = wa.Id,
Name = wa.Name,
t1 = Sql.EOT,
WriterProfile = wp,
t2 = Sql.EOT,
SuggestedBlog = Sql.TableAlias(b, "b1"),
t3 = Sql.EOT,
AcceptedBlog = Sql.TableAlias(b, "b2")
});
var values = Db.Select<Tuple<WritingAssignment, WriterProfile, Blog, Blog>>(q);
此更改可从v5.11.1开始使用,即现在
available on MyGet
.