internal SdkMessageResponse ToSdk(SdkMessage sdk) { var response = new SdkMessageResponse(Id); foreach (var field in ResponseFields) { response.ResponseFields[field.Key] = field.Value; } return response; }
public SdkMessagePair ToSdk(SdkMessage sdk) { var pair = new SdkMessagePair(sdk, Id, MessageNamespace); pair.Request = Request.ToSdk(pair); if (Response != null) { pair.Response = Response.ToSdk(sdk); } return pair; }
void Fill(ResultSet resultSet) { foreach (var result in resultSet.Results) { if ((result.SdkMessageId != Guid.Empty) && !MessageCollection.ContainsKey(result.SdkMessageId)) { var message = new SdkMessage(result.SdkMessageId, result.Name, result.IsPrivate); MessageCollection.Add(result.SdkMessageId, message); } MessageCollection[result.SdkMessageId].Fill(result); } }
public MetadataMessage(SdkMessage message) { Name = message.Name; Id = message.Id; IsPrivate = message.IsPrivate; IsCustomAction = message.IsCustomAction; MetadataPairs = new Dictionary<Guid, MetadataPair>(); foreach (var pair in message.SdkMessagePairs) { MetadataPairs[pair.Key] = new MetadataPair(pair.Value); } MetadataFilters = new Dictionary<Guid, MetadataFilter>(); foreach (var filter in message.SdkMessageFilters) { MetadataFilters[filter.Key] = new MetadataFilter(filter.Value); } }
static CodeTypeDeclarationCollection BuildMessage(SdkMessage message, ServiceProvider serviceProvider) { Trace.TraceInformation("Entering {0}", new object[] {MethodBase.GetCurrentMethod().Name}); var declarations = new CodeTypeDeclarationCollection(); foreach (var pair in message.SdkMessagePairs.Values) { if (serviceProvider.CodeMessageFilterService.GenerateSdkMessagePair(pair, serviceProvider)) { declarations.Add(BuildMessageRequest(pair, pair.Request, serviceProvider)); declarations.Add(BuildMessageResponse(pair, pair.Response, serviceProvider)); } else { Trace.TraceInformation("Skipping {0}.Message Pair from being generated.", new object[] {message.Name, pair.Request.Name}); } } Trace.TraceInformation("Exiting {0}", new object[] {MethodBase.GetCurrentMethod().Name}); return declarations; }
public SdkMessagePair(SdkMessage message, Guid id, string messageNamespace) { Message = message; _id = id; _messageNamespace = messageNamespace; }
bool ICodeWriterMessageFilterService.GenerateSdkMessage(SdkMessage message, IServiceProvider services) { if (!_generateMessages) { return false; } if (message.IsPrivate) { return false; } if (message.SdkMessageFilters.Count == 0) { return false; } return true; }