本文整理汇总了C#中EventStore.Core.Messaging.Message.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Message.GetType方法的具体用法?C# Message.GetType怎么用?C# Message.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventStore.Core.Messaging.Message
的用法示例。
在下文中一共展示了Message.GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextMessage
public static string TextMessage(HttpEntity entity, Message message)
{
Debug.Assert(message.GetType() == typeof(HttpMessage.TextMessage));
var textMessage = message as HttpMessage.TextMessage;
return textMessage != null ? entity.ResponseCodec.To(textMessage) : string.Empty;
}
示例2: CreateStreamCompleted
public static ResponseConfiguration CreateStreamCompleted(HttpEntity entity, Message message)
{
Debug.Assert(message.GetType() == typeof(ClientMessage.CreateStreamCompleted));
var completed = message as ClientMessage.CreateStreamCompleted;
if (completed == null)
return InternalServerEror(entity, message);
switch (completed.ErrorCode)
{
case OperationErrorCode.Success:
return new ResponseConfiguration(HttpStatusCode.Created,
"Stream created",
null,
new KeyValuePair<string, string>("Location",
HostName.Combine(entity.UserHostName,
"/streams/{0}",
completed.EventStreamId)));
case OperationErrorCode.PrepareTimeout:
case OperationErrorCode.CommitTimeout:
case OperationErrorCode.ForwardTimeout:
return new ResponseConfiguration(HttpStatusCode.InternalServerError, "Create timeout", null);
case OperationErrorCode.WrongExpectedVersion:
case OperationErrorCode.StreamDeleted:
case OperationErrorCode.InvalidTransaction:
return new ResponseConfiguration(HttpStatusCode.BadRequest,
string.Format("Error code : {0}. Reason : {1}", completed.ErrorCode, completed.Error),
null);
default:
throw new ArgumentOutOfRangeException();
}
}
示例3: ReadEventCompleted
public static ResponseConfiguration ReadEventCompleted(HttpEntity entity, Message message)
{
Debug.Assert(message.GetType() == typeof(ClientMessage.ReadEventCompleted));
var completed = message as ClientMessage.ReadEventCompleted;
if (completed == null)
return InternalServerEror(entity, message);
switch (completed.Result)
{
case SingleReadResult.Success:
return new ResponseConfiguration(HttpStatusCode.OK,
"OK",
entity.ResponseCodec.ContentType,
new KeyValuePair<string, string>(
"Cache-Control",
string.Format("max-age={0}", MaxPossibleAge)));
case SingleReadResult.NotFound:
case SingleReadResult.NoStream:
return NotFound(entity, completed);
case SingleReadResult.StreamDeleted:
return Gone(entity, completed);
default:
throw new ArgumentOutOfRangeException();
}
}
示例4: ReadEventsBackwardsCompletedFeed
public static string ReadEventsBackwardsCompletedFeed(HttpEntity entity, Message message, int start, int count)
{
Debug.Assert(message.GetType() == typeof(ClientMessage.ReadEventsBackwardsCompleted));
var completed = message as ClientMessage.ReadEventsBackwardsCompleted;
if (completed != null)
{
switch (completed.Result)
{
case RangeReadResult.Success:
var updateTime = completed.Events.Length != 0
? completed.Events[0].TimeStamp
: DateTime.MinValue.ToUniversalTime();
return entity.ResponseCodec.To(Convert.ToFeed(completed.EventStreamId,
start,
count,
updateTime,
completed.Events,
Convert.ToEntry,
entity.ServerHttpEndPoint));
case RangeReadResult.NoStream:
case RangeReadResult.StreamDeleted:
return string.Empty;
default:
throw new ArgumentOutOfRangeException();
}
}
return string.Empty;
}
示例5: GetFreshStatsCompleted
public static string GetFreshStatsCompleted(HttpEntity entity, Message message)
{
Debug.Assert(message.GetType() == typeof(MonitoringMessage.GetFreshStatsCompleted));
var completed = message as MonitoringMessage.GetFreshStatsCompleted;
if (completed == null || !completed.Success)
return string.Empty;
return entity.ResponseCodec.To(completed.Stats);
}
示例6: ListStreamsCompletedServiceDoc
public static string ListStreamsCompletedServiceDoc(HttpEntity entity, Message message)
{
Debug.Assert(message.GetType() == typeof(ClientMessage.ListStreamsCompleted));
var streams = message as ClientMessage.ListStreamsCompleted;
return streams != null
? entity.ResponseCodec.To(Convert.ToServiceDocument(streams.Streams,
new string[0],
entity.ServerHttpEndPoint))
: string.Empty;
}
示例7: ReadEventCompletedEntry
public static string ReadEventCompletedEntry(HttpResponseFormatterArgs entity, Message message, EmbedLevel embed)
{
Debug.Assert(message.GetType() == typeof(ClientMessage.ReadEventCompleted));
var completed = message as ClientMessage.ReadEventCompleted;
if (completed != null)
{
switch (completed.Result)
{
case ReadEventResult.Success:
return entity.ResponseCodec.To(Convert.ToEntry(completed.Record, entity.UserHostName, embed));
case ReadEventResult.NotFound:
case ReadEventResult.NoStream:
case ReadEventResult.StreamDeleted:
return string.Empty;
default:
throw new ArgumentOutOfRangeException();
}
}
return string.Empty;
}
示例8: ReadEventCompletedEntry
public static string ReadEventCompletedEntry(HttpEntity entity, Message message)
{
Debug.Assert(message.GetType() == typeof(ClientMessage.ReadEventCompleted));
var completed = message as ClientMessage.ReadEventCompleted;
if (completed != null)
{
switch (completed.Result)
{
case SingleReadResult.Success:
return entity.ResponseCodec.To(Convert.ToEntry(completed.Record, entity.ServerHttpEndPoint));
case SingleReadResult.NotFound:
case SingleReadResult.NoStream:
case SingleReadResult.StreamDeleted:
return string.Empty;
default:
throw new ArgumentOutOfRangeException();
}
}
return string.Empty;
}
示例9: ReadStreamEventsBackwardCompletedFeed
public static string ReadStreamEventsBackwardCompletedFeed(HttpResponseFormatterArgs entity, Message message, EmbedLevel embed, bool headOfStream)
{
Debug.Assert(message.GetType() == typeof(ClientMessage.ReadStreamEventsBackwardCompleted));
var completed = message as ClientMessage.ReadStreamEventsBackwardCompleted;
if (completed != null)
{
switch (completed.Result)
{
case ReadStreamResult.Success:
return entity.ResponseCodec.To(Convert.ToReadStreamFeed(completed, entity.UserHostName, embed, headOfStream));
case ReadStreamResult.NoStream:
case ReadStreamResult.StreamDeleted:
case ReadStreamResult.NotModified:
case ReadStreamResult.Error:
return string.Empty;
default:
throw new ArgumentOutOfRangeException();
}
}
return string.Empty;
}
示例10: WriteEvents
public static string WriteEvents(ICodec codec, Message message)
{
Debug.Assert(message.GetType() == typeof (ClientMessage.WriteEvents));
var writeEvents = message as ClientMessage.WriteEvents;
if (writeEvents == null)
return string.Empty;
return codec.To(new ClientMessageDto.WriteEventText(writeEvents.CorrelationId,
writeEvents.ExpectedVersion,
writeEvents.Events.Select(e => new ClientMessageDto.EventText(e.EventId,
e.EventType,
e.Data,
e.Metadata)).ToArray()));
}
示例11: DeleteStreamCompleted
public static string DeleteStreamCompleted(HttpEntity entity, Message message)
{
Debug.Assert(message.GetType() == typeof(ClientMessage.DeleteStreamCompleted));
return string.Empty;
}
示例12: GetReplicationStatsCompleted
public static string GetReplicationStatsCompleted(HttpResponseFormatterArgs entity, Message message)
{
if (message.GetType() != typeof(ReplicationMessage.GetReplicationStatsCompleted))
throw new Exception(string.Format("Unexpected type of Response message: {0}, expected: {1}",
message.GetType().Name,
typeof(ReplicationMessage.GetReplicationStatsCompleted).Name));
var completed = message as ReplicationMessage.GetReplicationStatsCompleted;
return entity.ResponseCodec.To(completed.ReplicationStats);
}
示例13: ReadEventsFromEndCompleted
public static ResponseConfiguration ReadEventsFromEndCompleted(HttpEntity entity, Message message)
{
Debug.Assert(message.GetType() == typeof(ClientMessage.ReadEventsBackwardsCompleted));
var completed = message as ClientMessage.ReadEventsBackwardsCompleted;
if (completed == null)
return InternalServerEror(entity, message);
var startIdx = (int)entity.Manager.AsyncState;
var age = startIdx < AtomSpecs.FeedPageSize ? MinPossibleAge : MaxPossibleAge;
switch (completed.Result)
{
case RangeReadResult.Success:
return new ResponseConfiguration(HttpStatusCode.OK,
"OK",
entity.ResponseCodec.ContentType,
new KeyValuePair<string, string>(
"Cache-Control",
string.Format("max-age={0}", age)));
case RangeReadResult.NoStream:
return NotFound(entity, completed);
case RangeReadResult.StreamDeleted:
return Gone(entity, completed);
default:
throw new ArgumentOutOfRangeException();
}
}
示例14: ListStreamsCompletedServiceDoc
public static ResponseConfiguration ListStreamsCompletedServiceDoc(HttpEntity entity, Message message)
{
Debug.Assert(message.GetType() == typeof(ClientMessage.ListStreamsCompleted));
var completed = message as ClientMessage.ListStreamsCompleted;
return (completed != null && completed.Success)
? Ok(entity, message)
: new ResponseConfiguration(500, "Couldn't get streams list. Try turning projection 'Index By Streams' on", null);
}
示例15: GetFreshStatsCompleted
public static ResponseConfiguration GetFreshStatsCompleted(HttpEntity entity, Message message)
{
Debug.Assert(message.GetType() == typeof(MonitoringMessage.GetFreshStatsCompleted));
var completed = message as MonitoringMessage.GetFreshStatsCompleted;
if (completed == null)
return InternalServerEror(entity, message);
return completed.Success ? Ok(entity, completed) : NotFound(entity, message);
}