或标准中的陈述
我有一个订单列表,它连接到用户表。每个订单可以包含多个用户。
然后,我有一个搜索区域,管理员可以通过搜索例如姓氏来搜索所有订单。
如果搜索例如 Smith,则应显示名为 smith 的用户的所有订单,但是使用 NHibernate 和 Criterion 是如何完成此操作的呢?
我第一次尝试(用户是用户列表):
crit.CreateCriteria("Users").Add(Restrictions.Like("LastName", Users))
但没有成功。
I have a list of orders, which are connected to a user-table. Each order can contain multiple users.
I then have a search area where an admin can search through all orders by searching for e.g. a last name.
If there is done a search for e.g. Smith, all orders where a user named smith should be shown, but how is this done with NHibernate and Criterion?
I first tried (users is a list of users):
crit.CreateCriteria("Users").Add(Restrictions.Like("LastName", Users))
but with no success.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用查询结束
use Query Over
在变量 mySession 中获取会话
get session in a variable say mySession