我目前已经实现了创建模型时触发的事件:
Option Strict Off
' ...
Dim dataValue As String = "True"
Dim changeTypeIndex() As String = {"System.Boolean", "System.Char", "System.SByte", "System.Byte", "System.Int16"}
Dim changeType As Type = Type.GetType(changeTypeIndex(0))
Dim o As Object = Activator.CreateInstance(changeType)
Dim result As Object = o.Parse(dataValue)
Console.WriteLine(result.GetType().Name) ' Outputs "Boolean"
Console.WriteLine(result) ' Outputs "True"
没什么特别的,它工作正常。但是我想在具有多个参数的模型创建时调用事件。像这样:
protected $dispatchesEvents = [
'created' => EvaluationRequestForZ0UQ0::class
];
我该如何实现?也许我的方法是错误的。如果是这样,请随时告诉我另一种方法。