如何从 Fluent Nhibernate 传递 sysdate 值
我这里有一种情况,我需要使用 Nhibernate 从 .net 代码将日期作为 db 的 sysdate 传递,这里是我的代码,
OfflineStatusChangeMonitor newstatusobj = new OfflineStatusChangeMonitor
{
NIK = demoFromDedup.NIK,
NIKStatus = new Status { Code = demoFromDedup.CurrentStatus.Code },
RegionId = Convert.ToInt16(demoFromDedup.RegionId),
LocalId = demoFromDedup.LocalId,
Updatedtime = DateTime.Now,
ServiceName = "XXXXX"
};
idmsRepository.Add<OfflineStatusChangeMonitor>(newstatusobj);
其中添加函数代码如下,
public void Add<ENTITY>(ENTITY entity) where ENTITY : EntityBase
{
this.UnitOfWork.CurrentSession.Save(entity);
}
现在在这种情况下,我如何将 updatetime 的值设置为 SYSDATE Oracle
我无法在数据库中执行此操作,因为我在许多位置都有数据库并且正在从 wcf 服务更新数据
i have a situation here where i need to pass the date as sysdate of db from the .net code using the Nhibernate here goes my code
OfflineStatusChangeMonitor newstatusobj = new OfflineStatusChangeMonitor
{
NIK = demoFromDedup.NIK,
NIKStatus = new Status { Code = demoFromDedup.CurrentStatus.Code },
RegionId = Convert.ToInt16(demoFromDedup.RegionId),
LocalId = demoFromDedup.LocalId,
Updatedtime = DateTime.Now,
ServiceName = "XXXXX"
};
idmsRepository.Add<OfflineStatusChangeMonitor>(newstatusobj);
where add functions code is as follows
public void Add<ENTITY>(ENTITY entity) where ENTITY : EntityBase
{
this.UnitOfWork.CurrentSession.Save(entity);
}
now in this situation how can i set the values of updatedtime to SYSDATE of Oracle
i can not do it in the data base as i have the db s in many locations and am updating the data from wcf service
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
然后调用此函数来获取数据库日期,然后将其用作函数中的日期时间
and then call this function to get the db date and then use this as the date time in your function
尝试使用触发器。那么当你更新记录时,oracle数据库会用SYSDATE更新该字段。
Try using trigger. Then oracle database will update the field with SYSDATE when you update the record.