I'm trying to make use of newly released NHibernate.Linq 1.0 provider
in my application, but my queries are crashing on some simple
conditions in where clause. I was trying to build the query in
different way, but didn't found any working form.
The failing query looks like this:
var x = (from ds in daySalesRepository.LinqContext
from dsItem in ds.Items
where ds.Customer ==
customer
select dsItem).ToList();
Exception:
NHibernate.QueryException: could not resolve property: ds of:
X.Model.Sales.DaySale
v NHibernate.Persister.Entity.AbstractPropertyMapping.ToType(String
propertyName)
v NHibernate.Persister.Entity.AbstractEntityPersister.ToType(String
propertyName)
v NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetPathEntityName
(String path)
v
NHibernate.Loader.Criteria.CriteriaQueryTranslator.CreateCriteriaEntityNameMap
()
v NHibernate.Loader.Criteria.CriteriaQueryTranslator..ctor
(ISessionFactoryImplementor factory, CriteriaImpl criteria, String
rootEntityName, String rootSQLAlias)
v NHibernate.Loader.Criteria.CriteriaLoader..ctor(IOuterJoinLoadable
persister, ISessionFactoryImplementor factory, CriteriaImpl
rootCriteria, String rootEntityName, IDictionary`2 enabledFilters)
v NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList
results)
v NHibernate.Impl.CriteriaImpl.List(IList results)
v NHibernate.Impl.CriteriaImpl.List()
v NHibernate.Linq.CriteriaResultReader`1.List()
v NHibernate.Linq.CriteriaResultReader`1.<GetEnumerator>d__0.MoveNext
()
v System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
v System.Linq.Enumerable.ToList<TSource>(IEnumerable`1 source)
...
I tried to reformulate the where clause like "where ds.Customer.Id ==
123" etc, but didn't succeeded. Interesting fact is that when I
compare only dsItem's properties in the where clause, the query is
working as expected:
var x = (from ds in daySalesRepository.LinqContext
from dsItem in ds.Items
where dsItem.Product ==
product
select dsItem).ToList();
What am I doing wrong? Or is this just not supported in current
version? I was trying to find some more complex sample NH.Linq
queries, but didn't find anything useful :(
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---