private static EntityTypeBuilder <T> AddOnInsertTrigger <T>(this EntityTypeBuilder <T> entityTypeBuilder, Action <OnInsertTrigger <T> > configuration, TriggerTime triggerTime) where T : class { var trigger = new OnInsertTrigger <T>(triggerTime); configuration.Invoke(trigger); return(entityTypeBuilder.AddTriggerAnnotation(trigger)); }
public virtual void SalesAreaShouldBeGeneratedCorrectSql() { var trigger = new OnInsertTrigger <SalesArea>(TriggerTime.After) .Action(action => action .Condition(f => f.Status == EntityStatus.New) .Update <SalesArea>((a, b) => a.Id == b.Id, (a, b) => new SalesArea() { Status = EntityStatus.Draft })); var sql = trigger.BuildSql(_provider); Assert.Equal(ExpectedSalesAreaTriggerSql, sql); }