【发布时间】:2017-04-03 22:35:49
【问题描述】:
有没有办法自动编写审核日志?
我创建了一个DbSet(Of Protocols)
这是我的协议类:
Public Class Protocol
Inherits ModelBase
Implements ILogicalTimestamp
<Key>
Public Property ProtocolId As Integer
<Required>
Public Property ProtocolText As String
Public Property CreatedByUserId As Integer?
<Required>
Public Property CreatedByUser As User
<Required>
<DefaultValue(0)>
Public Property Type As ProtocolType
Public Property LinkedToUserId As Integer?
Public Property LinkedToUser As User
Public Property LinkedToBusinessPartnerId As Integer?
Public Property LinkedToBusinessPartner As BusinessPartner
Public Property LinkedToClientId As Integer?
Public Property LinkedToClient As Client
Public Property LinkedToSettingId As Integer?
Public Property LinkedToSetting As Setting
Public Property LastUpdateTimestamp As Date? Implements ILogicalTimestamp.LastUpdateTimestamp
Public Property CreationTimestamp As Date? Implements ILogicalTimestamp.CreationTimestamp
Public Enum ProtocolType
AutoChanges = 0
Explicitly = 1
End Enum
End Class
如何在协议中编写更改?
我怎样才能将当前的UserId 放入SaveChanges 方法中以填充我的协议类中的CreatedByUserId 属性?
也许任何人都有一个自动执行此操作的想法。
【问题讨论】:
标签: vb.net entity-framework asp.net-core audit