Dim*_*hev 6 .net c# linq nhibernate
我正在开发一个ASP.NET MVC 4项目,包含NHibernate 3.3.我有两个声明如下的类(简化为简洁):
public class LocationReading
{
public long Timestamp { get; set; }
public GeoLocation Location { get; set; }
}
public class GeoLocation
{
public double Latitude { get; set; }
public double Longitude { get; set; }
}
public class RoutePoint
{
public virtual int Id { get; set; }
public virtual string Username { get; set; }
public virtual LocationReading LocationReading { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
并映射如下:
<class name="RoutePoint">
<id name="Id" type="Int32" column="id" unsaved-value="0">
<generator class="hilo"/>
</id>
<property name="Username"/>
<component name="LocationReading" >
<property name="Timestamp"/>
<component name="Location">
<property name="Latitude"/>
<property name="Longitude"/>
</component>
</component>
Run Code Online (Sandbox Code Playgroud)
我明白了
NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type 'Antlr.Runtime.MismatchedTreeNodeException' was thrown.
Run Code Online (Sandbox Code Playgroud)
任何时候我尝试通过linq查询到nhibernate,例如:
int count = session.Query<RoutePoint>().Where(p => p.LocationReading != null).Count();
Run Code Online (Sandbox Code Playgroud)
我认为嵌套组件映射导致错误.有任何想法吗?
更新:我决定,我应该首先更新所有引用的组件,所以我做了,刚刚从NuGet获得了最新版本的NHibernate和Npgsql,我仍然有例外,但现在有些不同了.我现在有:
NHibernate.Hql.Ast.ANTLR.QuerySyntaxException
{"A recognition error occurred. [.Count[RoutePoint](.Where[RoutePoint](NHibernate.Linq.NhQueryable`1[RoutePoint], Quote((p, ) => (NotEqual(p.LocationReading, NULL))), ), )]"}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1332 次 |
| 最近记录: |