Azure.DigitalTwins.Core
1.4.0
Prefix Reserved
dotnet add package Azure.DigitalTwins.Core --version 1.4.0
NuGet\Install-Package Azure.DigitalTwins.Core -Version 1.4.0
<PackageReference Include="Azure.DigitalTwins.Core" Version="1.4.0" />
paket add Azure.DigitalTwins.Core --version 1.4.0
#r "nuget: Azure.DigitalTwins.Core, 1.4.0"
// Install Azure.DigitalTwins.Core as a Cake Addin #addin nuget:?package=Azure.DigitalTwins.Core&version=1.4.0 // Install Azure.DigitalTwins.Core as a Cake Tool #tool nuget:?package=Azure.DigitalTwins.Core&version=1.4.0
Azure IoT Digital Twins client library for .NET
This library provides access to the Azure Digital Twins service for managing twins, models, relationships, etc.
Getting started
The complete Microsoft Azure SDK can be downloaded from the Microsoft Azure downloads page, and it ships with support for building deployment packages, integrating with tooling, rich command line tooling, and more.
For the best development experience, developers should use the official Microsoft NuGet packages for libraries. NuGet packages are regularly updated with new functionality and hotfixes.
Install the package
Install the Azure Digital Twins client library for .NET with NuGet:
dotnet add package Azure.DigitalTwins.Core
View the package details at nuget.org.
Prerequisites
- A Microsoft Azure Subscription
- To call Microsoft Azure services, create an Azure subscription.
- An Azure Digital Twins instance
- In order to use the Azure Digital Twins SDK, first create a Digital Twins instance using one of options:
- Using Azure portal
- Using Azure Management APIs
- Using Azure CLI
- You will need to install azure cli and the Azure IoT extension for Azure CLI.
- Refer to IoT CLI documentation for more information on how to create and interact with your Digital Twins instance.
- In order to use the Azure Digital Twins SDK, first create a Digital Twins instance using one of options:
Authenticate the Client
In order to interact with the Azure Digital Twins service, you will need to create an instance of a TokenCredential class and pass it to the constructor of your DigitalTwinsClient.
Key concepts
Azure Digital Twins Preview is an Azure IoT service that creates comprehensive models of the physical environment. It can create spatial intelligence graphs to model the relationships and interactions between people, spaces, and devices.
You can learn more about Azure Digital Twins by visiting Azure Digital Twins Documentation
Thread safety
We guarantee that all client instance methods are thread-safe and independent of each other (guideline). This ensures that the recommendation of reusing client instances is always safe, even across threads.
Additional concepts
Client options | Accessing the response | Long-running operations | Handling failures | Diagnostics | Mocking | Client lifetime
Examples
You can familiarize yourself with different APIs using samples for Digital Twins.
Source code folder structure
/src
The Digital Twins public client, DigitalTwinsClient
, and the additional configuration options, DigitalTwinsClientOptions
, that can be sent to the Digital Twins service.
/src/Generated
The code generated by autorest using the swagger file defined in the autorest config file.
To regenerate the code, run the powershell script generate.ps1.
Any time the client library code is updated, the following scripts need to be run:
- Export-AdtApis.ps1, which will update the API surface document.
- Update-Snippets.ps1, which will update all the code snippets in the readme files and in the client documentation comments.
/src/Customized
The customzied code written to override the following behavior of auto-generated code:
- Rename some of the generated types, eg. GetModelsOptions
- Declare some of the generated types as internal, instead of the autorest default of public.
- Declare some methods to accept input parameters as strings instead of objects.
- Declare some methods to return the response as strings instead of objects.
/src/Models
Model classes useful for use with the Digital Twins client operations.
/src/Properties
Assembly properties required for running unit tests.
/src/Serialization
Serialization helpers provided to help serialize/deserialize commonly used types within the Digital Twins service.
Troubleshooting
All service operations will throw RequestFailedException on failure reported by the service, with helpful error codes and other information.
For example, use the GetModelAsync
operation to check if the model exists before creating it, catch only when that specific HttpStatusCode is specified.
try
{
Response<ModelData> desiredModel = await DigitalTwinsClient.GetModelAsync(desiredModelId);
}
catch (RequestFailedException ex) when (ex.Status == (int)HttpStatusCode.NotFound)
{
// Model does not exist, so create it.
}
Next steps
See implementation examples with our code samples.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Azure.Core (>= 1.25.0)
- System.Text.Json (>= 4.7.2)
NuGet packages (10)
Showing the top 5 NuGet packages that depend on Azure.DigitalTwins.Core:
Package | Downloads |
---|---|
Elastacloud.DigiTwin.SDK
Package Description |
|
Microsoft.DigitalWorkplace.DigitalTwins.QueryBuilder
A C# query builder for Azure Digital Twins based on Azure Digital Twins SDK. |
|
Kae.DomainModel.Csharp.Framework.Adaptor.ExternalStorage.AzureDigitalTwins
Domain Model C# Code Generator Library for Azure Digital Twins as External Storage |
|
Microsoft.SmartPlaces.Facilities.IngestionManager
This is library injects data from one DTDL based graph, then converts and inserts the data into another DTDL base graph. |
|
Microsoft.DigitalWorkplace.DigitalTwins.Models.Generator
A model generator that transforms DTDL models into C# POCO classes. |
GitHub repositories (4)
Showing the top 4 popular GitHub repositories that depend on Azure.DigitalTwins.Core:
Repository | Stars |
---|---|
Xabaril/AspNetCore.Diagnostics.HealthChecks
Enterprise HealthChecks for ASP.NET Core Diagnostics Package
|
|
Azure-Samples/streaming-at-scale
How to implement a streaming at scale solution in Azure
|
|
digitaltwinconsortium/ManufacturingOntologies
A reference solution for leveraging manufacturing ontologies.
|
|
Azure-Samples/digital-twins-samples
Azure Digital Twins building scenario sample code
|
Version | Downloads | Last updated |
---|---|---|
1.4.0 | 785,931 | 7/9/2022 |
1.4.0-beta.1 | 3,496 | 3/25/2022 |
1.3.0-beta.2 | 2,429 | 8/6/2021 |
1.3.0-beta.1 | 221 | 8/4/2021 |
1.2.2 | 341,314 | 4/12/2021 |
1.2.1 | 12,637 | 2/4/2021 |
1.2.0 | 99,628 | 11/16/2020 |
1.0.1 | 2,715 | 11/5/2020 |
1.0.0 | 3,444 | 10/30/2020 |
1.0.0-preview.3 | 18,123 | 7/13/2020 |
1.0.0-preview.2 | 7,477 | 6/8/2020 |