代码之家  ›  专栏  ›  技术社区  ›  Pete

重命名亚音速select语句中的字段

  •  0
  • Pete  · 技术社区  · 16 年前

    执行类型列表<MyClass> 方法填充我的 从MyTable中选择col1作为“FirstColumn”,col2作为“SecondColumn” ,有没有办法在亚音速下做类似的事情?

    2 回复  |  直到 16 年前
        1
  •  1
  •   Zapatta    16 年前

    我相信Alias只适用于聚合列。

    public class Songs
    

    private string _songTitle;
    public string SongTitle {
        get { return _songTitle; }
        set { _songTitle = value; }
    }
    
    public string SongName {
        get { return _songTitle; }
        set { _songTitle = value; }
    }
    

        2
  •  1
  •   Dave Neeley    16 年前

    前几天我也有同样的需求,并将功能添加到了我的本地亚音速副本中。我刚刚提交了一个补丁 this issue . 应用补丁程序可以编写如下查询

    new Select(Table1.IdColumn.AliasAs("table1ID"),
    Table2.IdColumn.AliasAs("table2ID"))
                    .From(Table1.Schema)
                    .InnerJoin(Table2.Table1IdColumn, Table1.IDColumn);
    
    推荐文章