按固定字节数组进行的查询在Linq2NHibernate中不起作用
我在数据库中有如下表(SQL Server): 因此,SQL允许我通过7字节的二进制值进行搜索。我在我的实体上创建了如下属性:按固定字节数组进行的查询在Linq2NHibernate中不起作用,linq,nhibernate,linq-to-nhibernate,Linq,Nhibernate,Linq To Nhibernate,我在数据库中有如下表(SQL Server): 因此,SQL允许我通过7字节的二进制值进行搜索。我在我的实体上创建了如下属性: public virtual byte[] Field { get; protected set; } this.Map(x => x.Field) .Column("FIELD") .Not.Nullable() .Length(7) .UniqueKey("UQ_TESTING_FIELD&quo
public virtual byte[] Field { get; protected set; }
this.Map(x => x.Field)
.Column("FIELD")
.Not.Nullable()
.Length(7)
.UniqueKey("UQ_TESTING_FIELD");
我的FluentNHibernate映射如下所示:
public virtual byte[] Field { get; protected set; }
this.Map(x => x.Field)
.Column("FIELD")
.Not.Nullable()
.Length(7)
.UniqueKey("UQ_TESTING_FIELD");
插入和读回作品。但当我询问Linq2NHibernate时:
var result = repository.AllEntities
.SingleOrDefault(x => x.Field == field);
。。。我不会把实体拿回来的。我已经调试,并且“field”字节数组中的字节是正确的。我有针对SQLite的单元测试,但它不针对SQL Server(2014)数据库
我错了吗
编辑:我终于明白了。。。NHibernate配置是从缓存的.cfg文件加载的,它从程序的另一个版本加载的配置不正确。说来话长。但基本上,对该实体的所有查询都已中断,因为该实体在旧的(缓存的)二进制配置中不存在。此外,NHibernate根本没有抱怨。
此外,NHibernate根本没有抱怨。
它将在5.4中抱怨