项目查询中,常常需要返回指定的字段,下面是三种Nhibernate的方法1.linq to Nhibernatepublic class NameID{ public int Id { get; set; } public string Name { get; set; }}var discontinuedProducts = session .Query<Product>() .Where(p => p.Discontinued) .Select(p => new NameID…
Linq to sql 使用group by 统计多个字段,然后返回多个字段的值,话不多说,直接上例子: where u.fy_no == fy_no orderby u.we_no group u by new { weno = u.we_no, wename = u.we_name } into g select new { g.Key.weno, g.Key.wename }; 结果就是根据we_no和we_name的统计结果,返回这两个字段的数据.…
public interface IOrderByExpression<TEntity> where TEntity : class { IOrderedQueryable<TEntity> ApplyOrderBy(IQueryable<TEntity> query); IOrderedQueryable<TEntity> ApplyThenBy(IOrderedQueryable<TEntity> query); } public class…