6 Dec 2024

Data Exchange SDK update: .NET 8 support, improved performance & much more

The Data Exchange SDK is a C# SDK that allows developers to quickly build connectors and other integrations into the Autodesk Data Exchange platform. The SDK is a vital component used across various Autodesk Data Exchange connectors. This new version (5.1.1-beta) update brings multiple new functionalities and improves performance and stability over the previous version.

 

What’s new

Added .NET 8 support

The SDK now supports .NET 8 in addition to .NET Framework 4.8 so that you can choose whichever target works best for your needs.

 

Performance improvements

The SDK includes significant improvements to data synchronization. Creating exchange data is now 85% faster, and reading exchange data is 25% faster compared to the previous version. Additionally, this version of the SDK offers better support for larger and more complex models.

 

Support for creating and managing Type parameters

Type parameters are parameters that apply to all elements of a given "type". Modifying a type parameter applies that change to all elements of that type, simplifying the management of common properties. To create a type parameter, first ensure that the "type" has been defined. A type is defined automatically when an element specifies a type during creation.

In the code sample below, once this line is executed, the "MyType" type is defined and can be used to set type parameters.

var Element = model.AddElement(new ElementProperties("<Id>", "<elementname>", "<category>", "<family>", "MyType"));

At this point, other elements with the same type can also be created, and all of these elements will share the same type parameters.

To create a type parameter, use the CreateTypeParameterAsync method by passing in the "MyType" string and the parameter to set. This is different from Instance parameters, where the parameter is set for the individual element. Type parameters are common across all elements of that type.

var parameter = ParameterDefinition.Create(parameterType, ParameterDataType.String);
((StringParameterDefinition)parameter).Value = "text value";
ElementDataModel.CreateTypeParameterAsync("MyType", parameter);

An Element's TypeParameters property lists all the type parameters associated with that element. 

See the documentation for more details on creating and fetching Type Parameters.

 

Connector APIs for UI-based connectors

These APIs enable access for UI-based connectors, allowing for automated testing of connectors. This can also be extended so that connectors can be automated by downstream consumers.

The ConnectorAPI class wraps an existing Application object and provides automation over basic operations. To implement this, simply initialize a new ConnectorAPI class by passing it a reference of the Application object.

var application = new Application(...);
var connectorAPI = new ConnectorAPI(application);

The connectorAPI object can then be used to trigger exchange creation operation and a few other options.

var exchangeItem = await connectorAPI.CreateExchange("New exchange name", "folderId", "projectId", "hubId");

The ConnectorAPI class also supports events that are triggered when an exchange is loaded and when the connector is closed. For operations that require user inputs, there is support for passing in suppressargs to bypass the user interaction.

Check out the documentation for more details.

 

Notes

The 5.1.1-beta update has breaking changes over the previous version. The key changes are specified in the changelog.

The 5.1.1-beta SDK can be downloaded via the Data Exchange Beta feedback community project.

Documentation for the SDK is available on the APS Developer Portal.

There are also useful samples on GitHub to accelerate your development process, available at these links:

 

Related Article