joliver/CommonDomain — pull request #19 by cbaxter (2012-01-04 02:54:34+00:00)
Title: EventStoreRepository GetById with Type at Runtime

In order to better facilitate loading an IAggregate with a type at Runtime (without using reflection) I added two new methods to the EventStoreRepository as shown below.

```C#
public virtual IAggregate GetById(Type aggregateType, Guid id)
public virtual IAggregate GetById(Type aggregateType, Guid id, int versionToLoad)
```

In order to keep the IRepository interface clean, I chose to push the prior implementations of GetById below in to the RepositoryExtensions class. The downside to the latter change is that it is a breaking change for those who may have overriden the EventStoreRepository class to extend either of the origional GetById methods. Of course the latter change is not required, but I felt that it was the clean choice given that the generic type paramter was only used for typeof(TAggregate) inside the private `GetAggregate` method.

The parameter `Type aggregateType` is validated inside of private `GetAggregate` method to ensure the IAggregate interface has been implemented by the type and will throw an ArgumentException if missing.