Closed MovGP0 closed 8 years ago
suggested change: add the following method:
public static Science<TResult> New<TResult>([NotNull]string name, [NotNull]IPublisher publisher)
{
if (string.IsNullOrWhiteSpace(name))
{
throw new ArgumentNullException(nameof(name));
}
if (publisher == null)
{
throw new ArgumentNullException(nameof(publisher));
}
return new Science<TResult>(name, publisher);
}
I'm fine with this, as long as a "global" publisher is still supported. My original goal was to be able to set the publisher once and not force the user to instantiate a publisher for each experiment.
It looks like you added this overload in #13 . :+1:
Resolved in #13. Closing.
i just did some unit tests and noted a problematic behavior:
because publisher is global, switching the publisher is problematic in multi-threaded application where multiple publishers are required. instead, the user should provide the publisher as needed via dependency injection.