/// <summary> /// Mutate a <see cref="MonoBehaviour"/> in a <see cref="Context"/> before it gets injected. /// </summary> /// <typeparam name="T">The type of the <see cref="MonoBehaviour"/>.</typeparam> /// <param name="action">The callback to handle mutations in.</param> public InstallBuilder Mutate <T>(Action <MutationContext, T> action) where T : MonoBehaviour { if (action == null) { return(this); } Mutators.Add(new Tuple <Type, DelegateWrapper>(typeof(T), new DelegateWrapper().Wrap(action))); return(this); }
public static void SetMutator(string properyName, Func <TPreMutate, TPostMutate> onRequest, Func <TPostMutate, TPreMutate> onResponse) { var mutationObj = new MutationObject <TPreMutate, TPostMutate> { OnRequest = onRequest, OnResponse = onResponse }; if (!Mutators.ContainsKey(properyName)) { PropertiesToMutate.Add(properyName); Mutators.Add(properyName, mutationObj); return; } Mutators[properyName] = mutationObj; }
private void RegisterMutatorsInternal() { Mutators.Add(typeof(AggregateCreated), nameof(OnAggregateCreated)); RegisterMutators(Mutators); }