Oops sorry I was doing it the wrong way. Now it works fine.

On 13 янв, 21:31, Steve Strong <[email protected]> wrote:
> That doesn't look so good!  What was the exact query you were trying?
>
> On 13/01/2010 15:48, ulu wrote:
>
> > Does it work for you? It gives me
> > System.IndexOutOfRangeException: Index was outside the bounds of the
> > array.
> >     at NHibernate.Linq.Functions.FunctionRegistry.GetMethodGenerator
> > (MethodInfo method)
> >     at
> > NHibernate.Linq.Visitors.HqlGeneratorExpressionTreeVisitor.VisitMethodCallExpression
> > (MethodCallExpression expression)
> >     at
> > NHibernate.Linq.Visitors.HqlGeneratorExpressionTreeVisitor.VisitExpression
> > (Expression expression)
> >     at NHibernate.Linq.Visitors.HqlGeneratorExpressionTreeVisitor.Visit
> > (Expression expression)
> >     at NHibernate.Linq.Visitors.QueryModelVisitor.VisitWhereClause
> > (WhereClause whereClause, QueryModel queryModel, Int32 index)
> >     at Remotion.Data.Linq.Clauses.WhereClause.Accept(IQueryModelVisitor
> > visitor, QueryModel queryModel, Int32 index)
> >     at Remotion.Data.Linq.QueryModelVisitorBase.VisitBodyClauses
> > (ObservableCollection`1 bodyClauses, QueryModel queryModel)
> >     at NHibernate.Linq.Visitors.QueryModelVisitor.VisitQueryModel
> > (QueryModel queryModel)
> >     at NHibernate.Linq.Visitors.QueryModelVisitor.GenerateHqlQuery
> > (QueryModel queryModel, IDictionary`2 parameters, IList`1
> > requiredHqlParameters)
> >     at NHibernate.Linq.NhLinqExpression.Translate(ISessionFactory
> > sessionFactory)
> >     at
> > NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators
> > (String queryIdentifier, IQueryExpression queryExpression, String
> > collectionRole, Boolean shallow, IDictionary`2 filters,
> > ISessionFactoryImplementor factory)
> >     at NHibernate.Engine.Query.HQLExpressionQueryPlan.CreateTranslators
> > (String expressionStr, IQueryExpression queryExpression, String
> > collectionRole, Boolean shallow, IDictionary`2 enabledFilters,
> > ISessionFactoryImplementor factory)
> >     at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan
> > (IQueryExpression queryExpression, Boolean shallow, IDictionary`2
> > enabledFilters)
> >     at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan
> > (IQueryExpression queryExpression, Boolean shallow)
> >     at NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression
> > queryExpression)
> >     at NHibernate.Linq.NhQueryProvider.Execute(Expression expression)
> >     at NHibernate.Linq.NhQueryProvider.Execute[TResult](Expression
> > expression)
> >     at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
> >     at UnitTests.CheckLinq.Test()
>
> > On 12 янв, 03:29, Mohamed Meligy<[email protected]>  wrote:
>
> >>   .Where (p =>  p.Category == session.Load<Category>(
> >> categoryId)
>
> >> Regards,
>
> >> --
> >> Mohamed Meligy
> >> Senior Developer, Team Lead Backup (.Net Technologies - TDG - Applications)
> >> Injazat Data Systems
> >> P.O. Box: 8230 Abu Dhabi, UAE.
>
> >> Phone:  +971 2 6992700
> >> Direct:   +971 2 4045385
> >> Mobile:  +971 50 2623624, +971 55 2017 621
>
> >> E-mail: [email protected]
> >> Weblog:http://weblogs.asp.net/meligy
>
> >> On Tue, Jan 12, 2010 at 12:34 AM, ulu<[email protected]>  wrote:
>
> >>> Hi,
>
> >>> What is the recommended way of using the new Linq provider? I'm using
> >>> the trunk version and trying to do a simple thing: fetch entities by a
> >>> foreign key.
>
> >>> So, I've got the Product class and it has the Category property. How
> >>> do I fetch all products given a categoryId?
> >>> .Where (p =>  p.Category.Id == categoryId)
> >>> or
> >>> .Where (p =>  p.Category == session.Load<Category>(categoryId)
> >>> ?
>
> >>> Thanks
>
> >>> ulu
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "nhusers" group.
> >>> To post to this group, send email to [email protected].
> >>> To unsubscribe from this group, send email to
> >>> [email protected]<nhusers%[email protected]>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/nhusers?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.


Reply via email to