Exemplo n.º 1
0
            public void CreateAndInitializeNewProjection(
                ProjectionManager projectionManager,
                Guid projectionCorrelationId,
                Guid workerId,
                bool isSlave                  = false,
                Guid slaveMasterWorkerId      = default(Guid),
                Guid slaveMasterCorrelationId = default(Guid),
                int?version = -1)
            {
                var projection = projectionManager.CreateManagedProjectionInstance(
                    _name,
                    _projectionId,
                    projectionCorrelationId,
                    workerId,
                    isSlave,
                    slaveMasterWorkerId,
                    slaveMasterCorrelationId);

                projection.InitializeNew(
                    new ManagedProjection.PersistedState
                {
                    Enabled             = _enabled,
                    HandlerType         = _handlerType,
                    Query               = _query,
                    Mode                = _projectionMode,
                    EmitEnabled         = _emitEnabled,
                    CheckpointsDisabled = !_checkpointsEnabled,
                    Epoch               = -1,
                    Version             = version,
                    RunAs               = _enableRunAs ? SerializedRunAs.SerializePrincipal(_runAs) : null
                },
                    _replyEnvelope);
            }
Exemplo n.º 2
0
            public void CreateAndInitializeNewProjection(
                ProjectionManager projectionManager, Action <ManagedProjection> completed, Guid projectionCorrelationId,
                int queueIndex, bool isSlave  = false, IPublisher slaveResultsPublisher = null,
                Guid slaveMasterCorrelationId = default(Guid))
            {
                var projection = projectionManager.CreateManagedProjectionInstance(
                    _name, _projectionId, projectionCorrelationId, queueIndex, isSlave, slaveResultsPublisher,
                    slaveMasterCorrelationId);

                projection.InitializeNew(
                    () => completed(projection),
                    new ManagedProjection.PersistedState
                {
                    Enabled             = _enabled,
                    HandlerType         = _handlerType,
                    Query               = _query,
                    Mode                = _projectionMode,
                    EmitEnabled         = _emitEnabled,
                    CheckpointsDisabled = !_checkpointsEnabled,
                    Epoch               = -1,
                    Version             = -1,
                    RunAs               = _enableRunAs ? ManagedProjection.SerializePrincipal(_runAs) : null,
                });
            }