我正在尝试使用 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
知道可能出了什么问题吗?