zoukankan      html  css  js  c++  java
  • NHibernate Query

    ICriterion 接口

    指查询表达式,通常通过Restrictions.Eq,Restrictions.In等条件产生.

    DetachedCriteria

    1. 独立的查询条件的组合, 拥有ICriteria接口的大部分方法,但是并不是通过实现ICriteria来做到的。

    2. 不可以直接Clone,需要 GetExecutableCriteria之后再做 Clone.

    ICriteria

    查询表达式的接口,可以直接执行

    通常通过: var criteria = Session.CreateCriteria<Lesson>(); 来创建

    Restrictions, Projections

    查询条件及投影

    查询的链接

    var query = Session.CreateCriteria<Lesson>("t");
    //.CreateAlias("DefaultCategory", "defaultCategory")
    //.CreateAlias("TagCategories", "tagCategory");

    1. 如果在查询时手动指定了子属性对应的连接方式,则优先使用指定的.

    2. 没有指定的情况下,则使用mapping file里面的.

    多对多自对象的查询

    image

  • 相关阅读:
    Seven Puzzle Aizu
    Cheese
    Curling 2.0
    Ball
    Property Distribution
    Red and Black
    Lake Counting
    Ants
    剑桥雅思写作高分范文ESSAY20
    剑桥雅思写作高分范文ESSAY19
  • 原文地址:https://www.cnblogs.com/feinian/p/4983818.html
Copyright © 2011-2022 走看看