...
In order to share this object, it must be registered by the device which configures it. To do this, we can use the following:
Code Block | ||
---|---|---|
| ||
using Connexion.Core; using Shared; using System; namespace ConfigOwnerDevice { [DevicePlugin("Configuration Master Device", "Hosts a shared configuration", DeviceDefinitionFlags.NonProcessingDevice, typeof(object), typeof(object), typeof(SingletonTestingFactory))] public class ConfigOwnerDevice: BaseDevice<SharedConfiguration> { public ConfigOwnerDevice(Guid deviceKey, IMessageChannelDevice messageChannelDevice) : base(deviceKey, messageChannelDevice) { } public override void Load(string configuration) { base.Load(configuration); // register our configuration for other devices to read MessageChannel.ObjectRegistryService.Register(MessageChannel.GroupKey, Configuration); } } } |
...