1
監査ログを自動的に書き込む方法はありますか? 私はここで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
プロパティを入力するにはどうすればよいですか? 誰かがそれを自動的に行う考えがあるかもしれません。