标签:
假如有AB两表,A为主,B为子:已知A表ID,查B表数据
ICriteria criteriaTotal = session.CreateCriteria<B>().CreateCriteria("A");
criteriaTotal.Add(Restrictions.Eq("ID", id));
给B排序后,在通过A的ID查询B表数据
ICriteria criteria = session.CreateCriteria<B>();
criteria.AddOrder(new Order("Rank", true));
var _criteria=criteria.CreateCriteria("A");
_criteria.Add(Restrictions.Eq("ID", id));
B表关联A表
References<A>(x => x.MapScheme, "MAPSCHEME_ID").LazyLoad().Not.LazyLoad();
标签:
原文地址:http://www.cnblogs.com/bobo-show/p/5132531.html