左联接在NHibernate LINQ中对实体无效

时间:2019-04-29 05:51:48

标签: c# linq nhibernate fluent-nhibernate linq-to-nhibernate

我正在尝试使用LINQ进行NHibernate left-join

我有以下代码:

var query = from formdat in _formDatRepository.Table
            join proddat in _prodDatRepository.Table 
            on formdat.prodcode equals proddat.prodcode into proddats
            select new Model
            {
                   Brand = formdat.brand,
                   Generic = string.Empty
            }
result = query.ToList();

这引发了异常:

  

该方法或操作未实现。

堆栈跟踪:

  

在NHibernate.Linq.CacheableExpressionNode.Resolve(ParameterExpression inputParameter,表达式expressionToBeResolved,ClauseGenerationContext子句GenerationContext)      在Remotion.Linq.Parsing.Structure.IntermediateModel.ExpressionResolver.GetResolvedExpression(Expression unresolvedExpression,ParameterExpression parameterToBeResolved,ClauseGenerationContext子句GenerationContext)      在Remotion.Linq.Parsing.Structure.IntermediateModel.JoinExpressionNode。<> c__DisplayClass1.b__0(ExpressionResolver r)      在Remotion.Linq.Parsing.Structure.IntermediateModel.ResolvedExpressionCache 1.GetOrCreate(Func 2生成器处)      在Remotion.Linq.Parsing.Structure.IntermediateModel.JoinExpressionNode.CreateJoinClause(ClauseGenerationContext子句GenerationContext)中      在Remotion.Linq.Parsing.Structure.IntermediateModel.GroupJoinExpressionNode.ApplyNodeSpecificSemantics(QueryModel queryModel,ClauseGenerationContext子句GenerationContext)      在Remotion.Linq.Parsing.Structure.IntermediateModel.MethodCallExpressionNodeBase.Apply(QueryModel queryModel,ClauseGenerationContext子句GenerationContext)      在Remotion.Linq.Parsing.Structure.QueryParser.GetParsedQuery(Expression expressionTreeRoot)      在NHibernate.Linq.NhLinqExpression.Translate(ISessionFactoryImplementor sessionFactory,布尔过滤器)      在NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators处(IQueryExpression queryExpression,字符串collectionRole,布尔值浅,IDictionary 2 filters, ISessionFactoryImplementor factory) at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow, IDictionary 2 enabledFilters)      在NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression queryExpression,布尔浅)      在NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression queryExpression)      在NHibernate.Linq.DefaultQueryProvider.PrepareQuery(Expression expression,IQuery&query,NhLinqExpression&nhQuery)      在NHibernate.Linq.DefaultQueryProvider.Execute(表达式表达式)      在NHibernate.Linq.DefaultQueryProvider.Execute [TResult](表达式表达式)      在Remotion.Linq.QueryableBase 1.GetEnumerator() at System.Collections.Generic.List 1..ctor(IEnumerable 1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable 1源)处      在MasterCare.MIMS.Australia.Services.MIMSService.Search(字符串键)

注意:

由于表之间没有外键关系,因此没有导航属性。

0 个答案:

没有答案