本文整理汇总了C#中ProjectionManagementMessage类的典型用法代码示例。如果您正苦于以下问题:C# ProjectionManagementMessage类的具体用法?C# ProjectionManagementMessage怎么用?C# ProjectionManagementMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectionManagementMessage类属于命名空间,在下文中一共展示了ProjectionManagementMessage类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProjectionsStatisticsHttpFormatted
public ProjectionsStatisticsHttpFormatted(
ProjectionManagementMessage.Statistics source, Func<string, string> makeAbsouteUrl)
{
_projections =
source.Projections.Select(v => new ProjectionStatisticsHttpFormatted(v, makeAbsouteUrl)).ToArray();
_transactionFileHeadPosition = source.TransactionFileHeadPosition;
}
示例2: Definition
public Definition(
string name, string handlerType, string query, SlaveProjectionRequestedNumber requestedNumber,
ProjectionMode mode, bool emitEnabled, bool checkpointsEnabled, bool enableRunAs,
ProjectionManagementMessage.RunAs runAs)
{
_name = name;
_handlerType = handlerType;
_query = query;
_requestedNumber = requestedNumber;
_runAs = runAs;
_enableRunAs = enableRunAs;
_checkpointsEnabled = checkpointsEnabled;
_emitEnabled = emitEnabled;
_mode = mode;
}
示例3: Handle
public void Handle(ProjectionManagementMessage.Command.Abort message)
{
_lastAccessed = _timeProvider.Now;
UpdateProjectionVersion();
SetLastReplyEnvelope(message.Envelope);
Disable();
Abort();
}
示例4: DoDisable
private void DoDisable(ProjectionManagementMessage.Disable message)
{
if (!Enabled)
{
message.Envelope.ReplyWith(new ProjectionManagementMessage.OperationFailed("Not enabled"));
return;
}
Disable();
PrepareAndBeginWrite(
forcePrepare: false,
completed: () => message.Envelope.ReplyWith(new ProjectionManagementMessage.Updated(message.Name)));
}
示例5: InitializeNew
public void InitializeNew(ProjectionManagementMessage.Post message, Action completed)
{
LoadPersistedState(
new PersistedState
{
Enabled = message.Enabled,
HandlerType = message.HandlerType,
Query = message.Query,
Mode = message.Mode
});
PrepareAndBeginWrite(forcePrepare: true, completed: () => StartNew(completed));
}
示例6: Handle
public void Handle(ProjectionManagementMessage.Enable message)
{
if (Enabled)
{
message.Envelope.ReplyWith(new ProjectionManagementMessage.OperationFailed("Not disabled"));
return;
}
Enable();
PrepareAndBeginWrite(
forcePrepare: true,
completed:
() =>
Start(
() => message.Envelope.ReplyWith(new ProjectionManagementMessage.Updated(message.Name))));
}
示例7: DoDelete
private void DoDelete(ProjectionManagementMessage.Delete message)
{
if (Enabled)
Disable();
Delete();
Action completed = () =>
{
message.Envelope.ReplyWith(new ProjectionManagementMessage.Updated(_name));
DisposeCoreProjection();
_output.Publish(new ProjectionManagementMessage.Internal.Deleted(_name, Id));
};
UpdateProjectionVersion();
if (Enabled)
Prepare(() => BeginWrite(completed));
else
BeginWrite(completed);
}
示例8: UpdateQuery
private void UpdateQuery(ProjectionManagementMessage.Command.UpdateQuery message)
{
PersistedProjectionState.HandlerType = message.HandlerType ?? HandlerType;
PersistedProjectionState.Query = message.Query;
PersistedProjectionState.EmitEnabled = message.EmitEnabled ?? PersistedProjectionState.EmitEnabled;
_pendingWritePersistedState = true;
if (_state == ManagedProjectionState.Completed)
{
Reset();
}
}
示例9: SetRunAs
private void SetRunAs(ProjectionManagementMessage.Command.SetRunAs message)
{
PersistedProjectionState.RunAs = message.Action == ProjectionManagementMessage.Command.SetRunAs.SetRemove.Set
? SerializedRunAs.SerializePrincipal(message.RunAs)
: null;
_runAs = SerializedRunAs.DeserializePrincipal(PersistedProjectionState.RunAs);
_pendingWritePersistedState = true;
}
示例10: SerializePrincipal
public static SerializedRunAs SerializePrincipal(ProjectionManagementMessage.RunAs runAs)
{
if (runAs.Principal == null)
return null; // anonymous
if (runAs.Principal == SystemAccount.Principal)
return new SerializedRunAs {Name = "$system"};
var genericPrincipal = runAs.Principal as OpenGenericPrincipal;
if (genericPrincipal == null)
throw new ArgumentException(
"OpenGenericPrincipal is the only supported principal type in projections", "runAs");
return new SerializedRunAs {Name = runAs.Principal.Identity.Name, Roles = genericPrincipal.Roles};
}
示例11: DoUpdateQuery
private void DoUpdateQuery(ProjectionManagementMessage.UpdateQuery message)
{
_persistedState.HandlerType = message.HandlerType ?? HandlerType;
_persistedState.Query = message.Query;
_persistedState.EmitEnabled = message.EmitEnabled ?? _persistedState.EmitEnabled;
if (_state == ManagedProjectionState.Completed)
{
ResetProjection();
}
Action completed = () =>
{
StartOrLoadStopped(() => { });
message.Envelope.ReplyWith(new ProjectionManagementMessage.Updated(message.Name));
};
UpdateProjectionVersion();
Prepare(() => BeginWrite(completed));
}
示例12: Handle
public void Handle(ProjectionManagementMessage.GetQuery message)
{
_lastAccessed = _timeProvider.Now;
if (!ProjectionManagementMessage.RunAs.ValidateRunAs(Mode, ReadWrite.Read, _runAs, message)) return;
var emitEnabled = _persistedState.EmitEnabled ?? false;
message.Envelope.ReplyWith(
new ProjectionManagementMessage.ProjectionQuery(_name, Query, emitEnabled, _persistedState.SourceDefinition));
}
示例13: DoDelete
private void DoDelete(ProjectionManagementMessage.Delete message)
{
if (Enabled)
Disable();
Delete();
PrepareAndBeginWrite(
forcePrepare: false,
completed: () => message.Envelope.ReplyWith(new ProjectionManagementMessage.Updated(message.Name)));
}
示例14: DoUpdateQuery
private void DoUpdateQuery(ProjectionManagementMessage.UpdateQuery message)
{
UpdateQuery(message.HandlerType ?? HandlerType, message.Query);
PrepareAndBeginWrite(
forcePrepare: true, completed: () =>
{
if (Enabled)
Start(() => { });
message.Envelope.ReplyWith(new ProjectionManagementMessage.Updated(message.Name));
});
}