public async Task StatusAsync(HttpRequest request, HttpResponse response, ClaimsPrincipal user) { dynamic status = new ExpandoObject(); status.id = _contextInfo?.ContextId; status.name = _contextInfo != null ? _contextInfo.Name : "unknown"; status.description = _contextInfo?.Description; status.properties = _contextInfo?.Properties; status.uptime = _contextInfo?.Uptime; status.start_time = _contextInfo?.StartTime; status.current_time = new DateTime().ToUniversalTime().ToString(CultureInfo.InvariantCulture); var components = new List <string>(); if (_references2 != null) { foreach (var locator in _references2.GetAllLocators()) { components.Add(locator.ToString()); } } status.components = components; await SendResultAsync(response, JsonConverter.ToJson(status)); }
private async Task Status(HttpRequest request, HttpResponse response, RouteData routeData) { var id = _contextInfo != null ? _contextInfo.ContextId : ""; var name = _contextInfo != null ? _contextInfo.Name : "Unknown"; var description = _contextInfo != null ? _contextInfo.Description : ""; var uptime = (DateTime.UtcNow - _startTime).TotalMilliseconds; var properties = _contextInfo.Properties; var components = new List <string>(); if (_references != null) { foreach (var locator in _references.GetAllLocators()) { components.Add(locator.ToString()); } } var status = new { id = id, name = name, description = description, start_time = StringConverter.ToString(_startTime), current_time = StringConverter.ToString(DateTime.UtcNow), uptime = uptime, properties = properties, components = components }; await SendResultAsync(response, status); }