mikehadlow/EasyNetQ — pull request #298 by stefan-base (2014-10-24 08:52:32+00:00)
Title: Simplify the usage of ConnectionStringParser

When parsing the connection string, the resulting object is read-only. That's a pain when you want to tweak the configuration. I've changed the IConnectionStringParser to be a generic interface, so you can specify which concrete implementation of IConnectionConfiguration you're actually parsing to. Then I also made the default ConnectionStringParser expose the fact that it's working with the default implementation, so you can write:

var config = new ConnectionStringParser().Parse("....");
config.PrefetchCount = 1;

I'd even go further and drop IConnectionConfiguration. Why do you pull an interface out of a POCO? If you need the ability to extend (I can't forsee anybody doing that, honestly - it's a core domain object), then make the getters/setters virtual. If you want immutable data, I'd use struct. If that would happen, I'd also pull the static helper into ConnectionConfiguration, so you could do:

var config = ConnectionConfiguration.Parse("...");
config.PrefetchCount = 1;

Looking forward to your thoughts.