SerializePrincipal() public static method

public static SerializePrincipal ( ProjectionManagementMessage runAs ) : SerializedRunAs
runAs ProjectionManagementMessage
return SerializedRunAs
Example #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);
            }
Example #2
0
 private void FixUpOldProjectionRunAs(PersistedState persistedState)
 {
     if (persistedState.RunAs == null || string.IsNullOrEmpty(persistedState.RunAs.Name))
     {
         _runAs = SystemAccount.Principal;
         persistedState.RunAs = SerializedRunAs.SerializePrincipal(ProjectionManagementMessage.RunAs.System);
     }
 }
Example #3
0
 private void DoSetRunAs1(ProjectionManagementMessage.Command.SetRunAs message)
 {
     _persistedState.RunAs = message.Action == ProjectionManagementMessage.Command.SetRunAs.SetRemove.Set
         ? SerializedRunAs.SerializePrincipal(message.RunAs)
         : null;
     _runAs = SerializedRunAs.DeserializePrincipal(_persistedState.RunAs);
     _pendingPersistedState = true;
 }