嵌入式语句的流畅NHibernate错误

时间:2016-08-28 03:33:32

标签: nhibernate fluent-nhibernate

这是我的代码;

    public ActionResult Login(User user, string returnUrl)
    {
        using (ISession session = FluentNHibernateConnect.OpenSession())

        var users = session.QueryOver<User>()
        .Where(user.Nick == "asd")
        .And(user.Password == "1234")
        .List();

    }

问题是什么。 var和.where(user.nick ==“asd”)红线?

库;

  • MvcBlog.Mapping;
  • MvcBlog.Models;
  • NHibernate的;
  • NHibernate.Criterion;
  • System.Web.Mvc;
  • 的System.Web;
  • System.Web.Security;

1 个答案:

答案 0 :(得分:0)

where方法采用表达式:

var users = session.QueryOver<User>()
    .Where(user => user.Nick == "asd")
    .And(user => user.Password == "1234")
    .List();