1
我的一些代码,我写了错误的作品困惑......功能NHibernate CustomType为SQL2008日期和时间类型
Map(x => x.StartTime)
.Access.Property()
.CustomType("time")
.Generated.Never()
.Column("StartTime")
.Default("(CONVERT([time],getdate(),(0)))")
.Nullable()
.Not.LazyLoad();
出于某种原因,它工作得很好,但是当我意识到我的意思是编写CustomSqlType而不是CustomType并更改它,它停止工作......另外,如果我只删除CustomType(“time”)行,它也会停止工作。使其工作的唯一方法是让它的方式是上面的,我不明白为什么:我不明白为什么:(
编辑:忘了提及,在SQL方面我的列是类型“时间”,并在上.NET方面属性的类型是DateTime?(可为空)。