而使用LINQ to NHibernate的方法或操作未实现

编程入门 行业动态 更新时间:2024-10-25 21:32:01
本文介绍了而使用LINQ to NHibernate的方法或操作未实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试使用LINQ NHibernate的3和我进行了如下的LINQ查询

i m trying to use linq to nhibernate 3 and i have made following linq query

var a = (from c in Session.Query<ChoiceValue>() join Specific in ( (from choicevaluelocale in Session.Query<ChoiceValueLocale>() where choicevaluelocale.UICulture == "en-GB" select new { choicevaluelocale.ChoiceValue.ChoiceGroup.ChoiceGroupName, choicevaluelocale.ChoiceValue.ChoiceValueId, choicevaluelocale.DisplayName, choicevaluelocale.Description })) on new { c.ChoiceGroup.ChoiceGroupName, c.ChoiceValueId } equals new { Specific.ChoiceGroupName, ChoiceValueId = (Int32)Specific.ChoiceValueId } into Specific_join from Specific in Specific_join.DefaultIfEmpty() select new { c.ChoiceGroup.ChoiceGroupName, ChoiceValueId = (Int32?)c.ChoiceValueId, SpecificValueDisplayName = Specific.DisplayName, SpecificValueDescription = Specific.Description, }).ToList();

但在执行它在C#正冬眠我得到了以下错误

but while executing it on n-hibernate in c# i got following error

The method or operation is not implemented

堆栈跟踪是

at NHibernate.Linq.Visitors.QueryModelVisitor.VisitGroupJoinClause(GroupJoinClause groupJoinClause, QueryModel queryModel, Int32 index) at Remotion.Data.Linq.Clauses.GroupJoinClause.Accept(IQueryModelVisitor visitor, QueryModel queryModel, Int32 index) at Remotion.Data.Linq.QueryModelVisitorBase.VisitBodyClauses(ObservableCollection`1 bodyClauses, QueryModel queryModel) at Remotion.Data.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel) at NHibernate.Linq.Visitors.QueryModelVisitor.GenerateHqlQuery(QueryModel queryModel, VisitorParameters parameters, Boolean root) at NHibernate.Linq.NhLinqExpression.Translate(ISessionFactoryImplementor sessionFactory)

任何一个可以请帮我解决这个问题?

can any one please help me to overcome this problem?

推荐答案

在我看来,该LINQ到您在使用Hibernate库是不完整的。某处 NotImplementedException 被抛出。您是否使用了稳定的版本?

It seems to me that the Linq to Hibernate library you're using is incomplete. Somewhere a NotImplementedException is being thrown. Are you using a stable release?

在互联网快速捅说,组加入和选择子查询不被支持。您正在使用您的示例中的组加入,因此例外。具体来说,以下博文:

A quick poke around the internet says that group joins and subqueries in selects are not supported. You're using a group join in your example, hence the exception. Specifically, the following post(s):

  • 的 ayende/blog/4083/nhibernate-linq-1-0-released
  • guildsocial.web703.discountasp/dasblogce/2009 /07/29/LinqToNHibernateJoins.aspx
  • ayende/blog/4083/nhibernate-linq-1-0-released
  • guildsocial.web703.discountasp/dasblogce/2009/07/29/LinqToNHibernateJoins.aspx
  • 在NHibernate的3.1源代码,即抛出您的异常神色的方法正是这样的:

    In the NHibernate 3.1 source code, the method that is throwing your exception looks exactly like this:

    public override void VisitGroupJoinClause(GroupJoinClause groupJoinClause, QueryModel queryModel, int index) { throw new NotImplementedException(); }

    一些解决方案建议编写自己的HQL(如原始的SQL),而不是LINQ的语法。

    Some solutions suggest writing your own HQL (like raw SQL) instead of the Linq syntax.

    更多推荐

    而使用LINQ to NHibernate的方法或操作未实现

    本文发布于:2023-11-14 19:10:30,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1588290.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:操作   方法   LINQ   NHibernate

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!