nhibernate记事

  • code mapping proc
  •     var result = session.CreateSQLQuery("exec GetMemberGameActivity :mToken, :StartDate, :EndDate")
                            .SetResultTransformer(Transformers.AliasToBean())
                            .SetParameter("mToken", token)
                            .SetParameter("StartDate", startDate)
                            .SetParameter("EndDate", endDate)
                            .List().ToList();
  • mysql  参数用 ? ,SetParameter可采用index方式赋值
  • 清除指定缓存
  • sessionFactory.Evict(typeof(Cat), catId); //evict a particular Cat
    sessionFactory.Evict(typeof(Cat)); //evict all Cats
    sessionFactory.EvictCollection("Eg.Cat.Kittens", catId); //evict a particular collection of kittens
    sessionFactory.EvictCollection("Eg.Cat.Kittens"); //evict all kitten collections

posted @ 2017-06-23 21:41  卖果子的小男孩  阅读(95)  评论(0编辑  收藏  举报