예제 #1
0
        public async Task <DeviceConfiguration> DetermineConfiguration(GetDeviceConfiguration query)
        {
            var device = await _deviceRepo.GetDevice(query.DeviceId);

            if (device == null)
            {
                return(DeviceConfiguration.DeviceNotFound);
            }

            var application = await _applicationRepo.GetApplication(device.ApplicationId);

            // Get the application level configurations and override with any device level
            // configuration settings.
            DeviceConfiguration appConfig    = application.BuildConfiguration();
            DeviceConfiguration deviceConfig = device.BuildConfiguration();

            var configuration = appConfig.OverrideWith(deviceConfig);

            // Based on the combined settings, set the corresponding application and
            // agent versions.
            RegistryEntry registry = await GetRegistryEntry(configuration);

            configuration.SetRegistry(registry);

            return(configuration);
        }