/// <summary> /// Delete supervisor /// </summary> private static async Task DeleteAsync(IIoTHubConfig config, string deviceId, string moduleId) { var logger = ConsoleLogger.Create(LogEventLevel.Error); var registry = new IoTHubServiceHttpClient(new HttpClient(logger), config, new NewtonSoftJsonSerializer(), logger); await registry.DeleteAsync(deviceId, moduleId, null, CancellationToken.None); }
/// <summary> /// Clear registry /// </summary> private static async Task ClearRegistryAsync() { var logger = ConsoleOutLogger.Create(); var config = new IoTHubConfig(null); var registry = new IoTHubServiceHttpClient(new HttpClient(logger), config, logger); var result = await registry.QueryAllDeviceTwinsAsync( "SELECT * from devices where IS_DEFINED(tags.DeviceType)"); foreach (var item in result) { await registry.DeleteAsync(item.Id, item.ModuleId, null, CancellationToken.None); } }