【发布时间】:2019-07-22 06:19:45
【问题描述】:
我有这个简单的对象
public class SomeObject
{
public virtual DateTime TimeStamp { get; }
}
我想知道如何使用 nhibernate 映射 DateTime 属性 sqlite,
试过这样的
mapping.Map(Reveal.Member<Something>("TimeStamp"))
.Default(DateTime.UtcNow.Second.ToString())
.Generated.Insert()
.Not.Nullable();
尝试插入时
session.Save(new SomeObject());
tran.Commit();
我明白了
输入字符串“29”的格式不正确。 InvalidCastException:从“Int32”到“DateTime”的无效转换。
【问题讨论】:
-
你为什么用“int”作为
CustomSqlType?
标签: c# sqlite nhibernate fluent-nhibernate