public void Test_55() { //结果 var result = new String(); result.AppendLine("Select * "); result.Append("From "); result.AppendLine("(Select Count(*) "); result.AppendLine("From [Test2] "); result.AppendLine("Where [Name]=@_p_0) As [test] "); result.Append("Where [Age]=@_p_1"); //执行 var builder2 = _builder.New().Count().From("Test2").Where("Name", "a"); _builder.AppendFrom(builder2, "test").Where("Age", 1); _output.WriteLine(_builder.ToSql()); //验证 Assert.Equal(result.ToString(), _builder.ToSql()); Assert.Equal(2, _builder.GetParams().Count); Assert.Equal("a", _builder.GetParams()["@_p_0"]); Assert.Equal(1, _builder.GetParams()["@_p_1"]); }