亚音速系列前 1

标签 subsonic collections

有没有办法在下一段代码中只获得第一条记录?

Dal.TreeHtmlExportsCollection treeHtmlExportsCollection =
  new Dal.TreeHtmlExportsCollection().Where(Dal.TreeHtmlExports.Columns.TreeId, treeId).
  OrderByDesc(Dal.TreeHtmlExports.Columns.DateCreated).Load();

最佳答案

您可以使用查询工具执行此操作,如下所示:(需要 SubSonic 2.1)

var query = new Select()
     .Top("1")
     .From(TreeHtmlExports.Schema)
     .Where(TreeHtmlExports.Columns.TreeId).IsEqualTo(treeId)
     .OrderDesc(TreeHtmlExports.Columns.DateCreated);

treeHtmlExportCollection = query.ExecuteAsCollection<TreeHtmlExportsCollection>();

希望有帮助!

关于亚音速系列前 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/306051/

相关文章:

Java流转换要设置的 map 列表

subsonic - SimpleRepository 中的父对象和子对象

c# - 调用 .Save() 后亚音速日期发生变化

亚音速 3 : SimpleRepository. 如何将枚举映射到表列

哈希linkedHashSet的java意义

collections - Backbone .js:将元素添加到集合而不重新渲染所有集合

c# - 如何使用 SubSonic 和 MySQL 更新更改

.net - 亚音速vs NHibernate

c# - 如何在保存到数据库之前维护唯一列表? - C#

java - 如何指定集合文字的目标类型?