作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这个问题是关于 "Rehydrating fluent nhibernate configured DateTime as Kind Utc rather than Unspecified" .
该问题的后来答案之一是:
Map(x => x.EntryDate).CustomType<UtcDateTimeType>();
最佳答案
NHibernate 流畅的方式是 Convention
Conventions
James Gregory 于 2012 年 4 月 3 日编辑了此页面 · 1 次修订
...
The conventions are built using a set of interfaces and base classes that each define a single method, Apply, with varying parameters based on the kind of convention you're creating; this method is where you make the changes to the mappings.
...
public class UtcConvention : IPropertyConvention
{
public void Apply(IPropertyInstance instance)
{
if (instance.Type.Name == "Date")
{
instance.CustomType<UtcDateTimeType>();
}
}
}
FluentMappings
.Conventions.Add(new UtcConvention())
关于datetime - Fluent Nhibernate - 配置所有日期以从 UTC 重新水化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28935400/
如果我运行类似于以下的查询: SELECT * FROM user u LEFT JOIN orders o ON o.user_id=u.id LEFT JOIN payments p ON p.o
我是一名优秀的程序员,十分优秀!