gpt4 book ai didi

nhibernate - Linq 到 nhibernate 字符串比较

转载 作者:行者123 更新时间:2023-12-04 18:24:18 24 4
gpt4 key购买 nike

我有一个关于 linq to nhibernate 的问题。我需要创建一个可以在其中使用字符串比较的查询:

session.Linq<User>()
.Where(u => String.Compare(u.Name, givenName) < 0)
.ToList()

我的理解是否正确,这在 linq-to-nhibernate 中不受支持?有没有办法在 linq-to-nhibernate 中使用字符串比较?

最佳答案

NHibernate 3 中新的集成提供程序允许对其进行扩展以支持您想要的几乎任何结构。

检查 http://fabiomaulo.blogspot.com/2010/07/nhibernate-linq-provider-extension.html一个完整的例子。

当然,您需要考虑该表达式的合理 HQL 表示。

关于nhibernate - Linq 到 nhibernate 字符串比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4241162/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com