It seems that I cannot define commands/events conventions more than once. Every registered convention will override previous.
This works:
configuration.Conventions()
.DefiningCommandsAs(
type => type.FullName == "MyProject1.CommandA" || type.FullName == "MyProject2.CommandB");
But this doesn't:
configuration.Conventions()
.DefiningCommandsAs(
type => type.FullName == "MyProject1.CommandA");
configuration.Conventions()
.DefiningCommandsAs(
type => type.FullName == "MyProject2.CommandB");
Why do I need this:
I'm developing a package that once referenced in NSB project will perform periodic actions (send messages). It needs to define own command conventions in INeedInitialization
which will be picked up during assembly scanning. I don't want the user of the package to know that he needs to register conventions of the package. However the host project needs to register own conventions for commands. So it seems at the moment I either need to resort to Marker interfaces (which I don't want to do, there is a good reason why Unobtrusive mode was introduced) or come up with conventions like all commands must reside in *.Commands.* namespace which I don't like either.
So the questions is how to make package register it's own conventions unobtrusively and transparently to the Host.
Edit
Another way I can think of hacking around this is implementing a shared convention singleton and delegate registration of conventions to it. That singleton will then remember all conventions and will keep appending them every time. Not beautiful, but not uglier than other 2 options.