Exemplo n.º 1
0
 public ProjectorBuilder <TProjectionKey, TMessageEnvelope> SetDependencyLifetimeScopeFactory(IDependencyLifetimeScopeFactory factory)
 {
     if (factory == null)
     {
         throw new ArgumentNullException(nameof(factory));
     }
     _dependencyLifetimeScopeFactory = factory;
     return(this);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Internal constructor, used by <see cref="ProjectorBuilder{TProjectionKey, TMessageEnvelope}"/>.
 /// </summary>
 /// <param name="projections">The registered projections.</param>
 /// <param name="dependencyLifetimeScopeFactory">The dependency lifetime scope factory.</param>
 internal Projector(HashSet <IProjection <TProjectionKey, TMessageEnvelope> > projections, IDependencyLifetimeScopeFactory dependencyLifetimeScopeFactory)
 {
     if (projections == null)
     {
         throw new ArgumentNullException(nameof(projections));
     }
     if (!projections.Any())
     {
         throw new ArgumentException("No projections registered", nameof(projections));
     }
     if (dependencyLifetimeScopeFactory == null)
     {
         throw new ArgumentNullException(nameof(dependencyLifetimeScopeFactory));
     }
     GuaranteeKeyUniqueness(projections);
     _projections = new List <IProjection <TProjectionKey, TMessageEnvelope> >(projections);
     _projections.Sort(new ProjectionPriorityComparer <TProjectionKey, TMessageEnvelope>());
     _dependencyLifetimeScopeFactory = dependencyLifetimeScopeFactory;
 }