Skip to content

Trigger API has been updated

Compare
Choose a tag to compare
@win7user10 win7user10 released this 15 Apr 17:25
· 9 commits to master since this release
b5a4fe9

New triggers API

The main difference is related to the way of relating to the old and new rows in a trigger.
Early each reference was in its own parameter
.Insert<UserBalance>((oldRow, newRow) => new MyEntity { Value = oldRow.Value + newRow.Value }
now the one variable contains all references
.Insert<UserBalance>(tableRefs => new MyEntity { Value = tableRefs .Old.Value + tableRefs.New.Value }

Update Upsert and InsertIfNotExists API

The next updates are related to the changed Upsert and InsertIfNotExists API. Now they consume predicates as the first parameter instead of NewExpression, which sounds more logical.
Early
.Upsert(deletedTransaction => new UserBalance { UserId = deletedTransaction.UserId } ..)
and now
.Upsert((tableRefs, balances) => tableRefs.Old.UserId == balances.UserId, ..)

Configuring trigger prefix

Not the trigger prefixes can be changed via te next static parameter
Laraue.EfCoreTriggers.Common.Constants.AnnotationKey = "MY_PREFIX"