internal static EntityEventArgs CreateInstance(EventTypeEnum eventType, OGMImpl sender, Transaction trans, bool locked = false) { Type type = sender.GetEntity().EntityEventArgsType; EntityEventArgs args = (EntityEventArgs)Activator.CreateInstance(type, true) !; args.EventType = eventType; args.SenderInternalBridge = sender; args.Entity = sender.GetEntity(); args.Transaction = trans; args.Locked = locked; sender.AppendEventHistory(args); return(args); }
internal static PropertyEventArgs CreateInstance(EventTypeEnum eventType, OGMImpl sender, Property property, object?previousValue, object?assignedValue, DateTime moment, OperationEnum operation, Transaction trans) { Type senderType = sender.GetType(); Type argsType = property.GetPropertyEventArgsType(senderType); PropertyEventArgs args = (PropertyEventArgs)Activator.CreateInstance(argsType, true) !; args.EventType = eventType; args.SenderInternalBridge = sender; args.Entity = sender.GetEntity(); args.Property = property; args.Operation = operation; args.PreviousValueInternalBridge = previousValue; args.AssignedValueInternalBridge = assignedValue; args.Moment = moment; args.Transaction = trans; sender.AppendEventHistory(args); return(args); }