简体   繁体   English

nHibernate设置实体更改时的列值?

[英]nHibernate set column value when entity is changed?

每当使用nHibernate更新了相关实体或表时,我都需要将日期列设置为当前日期时间?

You can use Interceptors as described here http://nhibernate.info/doc/nh/en/index.html#objectstate-interceptors 您可以按照此处所述使用拦截器http://nhibernate.info/doc/nh/en/index.html#objectstate-interceptors

The example given on this page will solve your problem if you use the event "OnFlushDirty" 如果使用事件“ OnFlushDirty”,此页面上的示例将解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 嵌套集合 - 当实体名称空间已更改时发出问题 - Nested collections - issue,when namespace of entity has been changed 流利的Nhibernate储蓄子实体 - Fluent Nhibernate saving child entity jQuery,用于在另一个下拉列表的值更改时将下拉列表设置为默认值 - JQuery for setting a dropdown to default value when value of another dropdown changed 实体框架代码首先为 id 列添加 null 值 - Entity Framework Code First Adding a null value for a id column 需要帮助来构建敏捷的Nhibernate实体 - Need help constructing the agile nhibernate entity 在nhibernate中排序整数或十进制列 - sorting integer or decimal column in nhibernate EF代码优先:当IDENTITY_INSERT设置为OFF时,无法在表'myTable'中为标识列插入显式值 - EF Code first : Cannot insert explicit value for identity column in table 'myTable' when IDENTITY_INSERT is set to OFF 错误“值不能是 null。 参数名称:entity”删除实体时object - Error “Value cannot be null. Parameter name: entity” when deleting entity object 当在SQL中将格式更改为bigint时,Int SQL变量在.Net中的值为1 - Int SQL variable takes value 1 in .Net when format changed to bigint in SQL 将 nhibernate 实体序列化为 json 错误:连接时无法序列化 Session - Serialize nhibernate entity to json error: Cannot serialize a Session while connected
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM