Interop migration
The examples below show the differences between the .NET 6+ adapter and the .NET Framework adapter in using the Interop API.
Raise an intent
Intents now support a cleaner way of initializing the Intent payload object.
var interopClient = await runtime.Interop.ConnectAsync("the-broker");
var intent = JsonConvert.DeserializeObject<Intent>(@$"{{
'name': 'StartCall',
'context': {{
'type': 'fdc3.contact',
'name': 'Andy',
'id': {{
'email': 'username@example.com'
}}
}}
}}");
var result = await interopClient.FireIntentAsync(intent);
Set a Context
The Context payload object is now easily settable and does not require either deserializing JSON or dealing with inheritance.
var interopClient = await runtime.Interop.ConnectAsync("the-broker");
await interopClient.JoinContextGroupAsync("green");
var contactContext = JsonConvert.DeserializeObject<Context>(@$"{{
'type': 'fdc3.contact',
'name': 'Andy',
'id': {{
'email': 'username@example.com'
}}
}}");
var result = await interopClient.FireIntentAsync(intent);