Created a test DTDL model class with one of the writable property as false and another writable property as true as defined in this model
Even though writable property is false, this below code is executed without any issues. How can I make only readable properties in DTDL?
BasicDigitalTwin twinData = new BasicDigitalTwin();
twinData.Id = "123Test";
twinData.Metadata.ModelId = "dtmi:DigitalTwins:test;2";
twinData.CustomProperties.Add("testprop1", "test1");
twinData.CustomProperties.Add("testprop2", "test2");
twinData.CustomProperties.Add("testprop3", "test3");
await client.CreateDigitalTwinAsync(twinData.Id, JsonSerializer.Serialize(twinData));
Writable properties only play a role in the Device Twin in IoT Hub, and not in Azure Digital Twins. This document tries to shed some light on it, but I can understand the confusion.
The Digital Twin Definition Language (DTDL), is used to describe digital twins in Azure Digital Twins (ADT), but also the capability model for IoT Plug and Play. While writable properties are part of the DTDL language, it's not playing a role in ADT.