【发布时间】:2012-09-20 13:01:37
【问题描述】:
我正在尝试使用 NH CreateSQLQuery 方法获取一些数据,例如
IList<Logistic> LCollection = sess.CreateSQLQuery(@"select * from some_schema.logistic")
.SetResultTransformer(Transformers.AliasToBean(typeof(Logistic)))
.List<Logistic>();
物流类
public class Logistic
{
public virtual long? l_id { get; set; }
public virtual long? carrier_id { get; set; }
...
}
映射
public class LogisticMap : ClassMap<Logistic>
{
public LogisticMap()
{
Table("some_chema.logistic");
Id(x => x.l_id).GeneratedBy.Sequence("some_chema.logistic_sq");
Map(x => x.carrier_id);
...
}
}
但我有错误
The type System.Decimal can not be assigned to a property of type System.Nullable`1[System.Int64] setter of MyNamespase.Logistic.l_id
知道可能出了什么问题吗?
【问题讨论】:
-
检查数据库中的 l_id 列是否有十进制数据
标签: c# nhibernate