public Task EnlistAsync(IWeakActivationExtension subject, IWeakActivationFactor factor) { Registrations[subject] = factor switch { FakeWeakActivationFactor activity => activity, _ => throw new NotSupportedException(), }; return(Task.CompletedTask); }
public int CompareTo(IWeakActivationFactor other) { return(other switch { // a defined value is always greater than null null => 1, // apply comparison rules ActivityState activity => Priority.CompareTo(activity.Priority), // this factor only supports comparing against the same factor type _ => throw new InvalidOperationException() });
public Task EnlistAsync(IWeakActivationExtension subject, IWeakActivationFactor factor) { if (subject is null) { throw new ArgumentNullException(nameof(subject)); } if (factor is null) { throw new ArgumentNullException(nameof(factor)); } _registry[subject] = new Entry(factor); return(Task.CompletedTask); }
public Entry(IWeakActivationFactor factor) { Factor = factor ?? throw new ArgumentNullException(nameof(factor)); }
public int CompareTo(IWeakActivationFactor other) { return(other is FakeWeakActivationFactor factor ? FakeProperty.CompareTo(factor.FakeProperty) : throw new InvalidOperationException()); }