小编Gut*_*tek的帖子

如何将HQL与Group By转换为QueryOver?

我有一个HQL查询:

select max(l.Num) from SomeTable l group by l.Type, l.Iteration
Run Code Online (Sandbox Code Playgroud)

如何将其翻译/转换为QueryOver?

以下一个:

var grouped = session.QueryOver<SomeTable>()
    .SelectList(l => l
      .SelectGroup(x => x.Type)
      .SelectGroup(x => x.Iteration)
      .SelectMax(x => x.Num));
Run Code Online (Sandbox Code Playgroud)

将生成SQL:

SELECT
    MAX(l.Num),
    l.Type,
    l.Iteration
FROM
    SomeTable l
GROUP BY
    l.Type,
    l.Iteration
Run Code Online (Sandbox Code Playgroud)

这不是我所期望的 - 我不想在Select中使用Type和Iteration.

我正在使用该查询作为子查询select z from c where z IN (subquery).

nhibernate hql queryover

6
推荐指数
1
解决办法
2140
查看次数

MVC 3客户端验证间歇性地工作

更新:如果你在javascript中设置至少一个断点,验证开始工作,但没有它不起作用

更新:添加jquery标记,因为这可能连接到验证插件

我有MVC 3版本,System.Web.Mvc产品版本是:3.0.20105.0修改5th of Jan 2011- 我认为这是最新的.

我注意到客户端验证在我们正在创建的应用程序中假设不起作用,所以我做了一个快速测试.

我使用Internet Application模板创建了基本的MVC 3应用程序.

我添加了测试控制器:

using System.Web.Mvc;
using MvcApplication3.Models;

namespace MvcApplication3.Controllers
{
    public class TestController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Create()
        {
            Sample model = new Sample();

            return View(model);
        }

        [HttpPost]
        public ActionResult Create(Sample model)
        {
            if(!ModelState.IsValid)
            {
                return View();
            }

            return RedirectToAction("Display");
        }

        public ActionResult Display()
        {
            Sample model = new Sample();
            model.Age = …
Run Code Online (Sandbox Code Playgroud)

validation asp.net-mvc jquery asp.net-mvc-3

5
推荐指数
1
解决办法
2286
查看次数