public IPocoRepository <T> ForPoco <T>(IDomainUnitOfWork uow) where T : class, new() { var factory = Factories.GetOrAdd(typeof(T), t => ReflectionExtensions.BuildPocoRepositoryFunc <T>()) as Func <IMetrics, IStoreEvents, IStoreSnapshots, IDomainUnitOfWork, IPocoRepository <T> >; if (factory == null) { throw new InvalidOperationException("unknown entity repository"); } return(factory(_metrics, _eventstore, _snapstore, uow)); }