コード例 #1
0
        public static DeviceDetailModel ToDeviceDetailModel(this DurableEntityStatus entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var retVal = new DeviceDetailModel();

            var jobject = entity.State as JObject;

            if (jobject != null)
            {
                retVal = jobject.ToDeviceDetailModel();
            }
            retVal.DeviceId = entity.EntityId.EntityKey;


            return(retVal);
        }
コード例 #2
0
        public static DeviceTelemetryModel ToDeviceTelemetryModel(this DurableEntityStatus entity)
        {
            if (entity == null)
            {
                return(null);
            }

            DeviceTelemetryModel retVal = null;

            var jobject = entity.State as JObject;

            if (jobject != null)
            {
                var lastTelemetry = jobject.Property("lastData").Value as JObject;
                if (lastTelemetry != null)
                {
                    retVal = lastTelemetry.ToDeviceTelemetryModel();
                }
            }

            return(retVal);
        }