public void ShouldCreateChildRepositoryFactory() { var factory = ReflectionExtensions.BuildParentRepositoryFunc <FakeChildEntity, FakeEntity>(); factory.Should().NotBeNull(); factory(Fake <FakeEntity>(), Fake <IStoreEntities>()).Should().BeAssignableTo <IRepository <FakeChildEntity, FakeEntity> >(); }
public IRepository <TEntity, TParent> ForEntity <TEntity, TParent>(TParent parent, IDomainUnitOfWork uow) where TEntity : IChildEntity <TParent> where TParent : IEntity { var factory = Factories.GetOrAdd(typeof(TEntity), t => ReflectionExtensions.BuildParentRepositoryFunc <TEntity, TParent>()) as Func <TParent, IMetrics, IStoreEvents, IStoreSnapshots, IOobWriter, IEventFactory, IDomainUnitOfWork, IRepository <TEntity, TParent> >; if (factory == null) { throw new InvalidOperationException("unknown entity repository"); } return(factory(parent, _metrics, _eventstore, _snapstore, _oobStore, _factory, uow)); }
public IRepository <TEntity, TParent> ForEntity <TEntity, TParent>(TParent parent) where TEntity : IChildEntity <TParent> where TParent : IEntity { var factory = Factories.GetOrAdd(typeof(TEntity), t => ReflectionExtensions.BuildParentRepositoryFunc <TEntity, TParent>()) as Func <TParent, IStoreEntities, IRepository <TEntity, TParent> >; if (factory == null) { throw new InvalidOperationException("unknown entity repository"); } return(factory(parent, _store)); }