3

I am trying to do left-join using LINQ to NHibernate.

I have the following code:

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();

This is throwing the exception:

The method or operation is not implemented.

Stack trace:

at NHibernate.Linq.CacheableExpressionNode.Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext) at Remotion.Linq.Parsing.Structure.IntermediateModel.ExpressionResolver.GetResolvedExpression(Expression unresolvedExpression, ParameterExpression parameterToBeResolved, ClauseGenerationContext clauseGenerationContext) at Remotion.Linq.Parsing.Structure.IntermediateModel.JoinExpressionNode.<>c__DisplayClass1.b__0(ExpressionResolver r) at Remotion.Linq.Parsing.Structure.IntermediateModel.ResolvedExpressionCache1.GetOrCreate(Func2 generator) at Remotion.Linq.Parsing.Structure.IntermediateModel.JoinExpressionNode.CreateJoinClause(ClauseGenerationContext clauseGenerationContext) at Remotion.Linq.Parsing.Structure.IntermediateModel.GroupJoinExpressionNode.ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) at Remotion.Linq.Parsing.Structure.IntermediateModel.MethodCallExpressionNodeBase.Apply(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) at Remotion.Linq.Parsing.Structure.QueryParser.GetParsedQuery(Expression expressionTreeRoot) at NHibernate.Linq.NhLinqExpression.Translate(ISessionFactoryImplementor sessionFactory, Boolean filter) at NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary2 filters, ISessionFactoryImplementor factory) at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow, IDictionary2 enabledFilters) at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow) at NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression queryExpression) at NHibernate.Linq.DefaultQueryProvider.PrepareQuery(Expression expression, IQuery& query, NhLinqExpression& nhQuery) at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression) at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression expression) at Remotion.Linq.QueryableBase1.GetEnumerator() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at MasterCare.MIMS.Australia.Services.MIMSService.Search(String key)

Note:

There are no navigation properties since there are no foreign key relationships between the tables.

Jose Francis
  • 950
  • 13
  • 28
Nimish David Mathew
  • 2,958
  • 6
  • 29
  • 45

0 Answers0