An Interest In:
Web News this Week
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
April 9, 2022 06:37 am GMT
Original Link: https://dev.to/ridomin/dtdl-parser-extensions-5b56
DTDL Parser extensions
The DTDL dotnet parser provides and object model to inspect DTDL elements: Telemetry, Properties, Commands, Components and Relationships.
All of these are represented as DTEntityInfo
elements that must be used with the appropriate DT*
types using casting.
To make it easier the navigation through those types, and by using some C# goodness, I've created this DTDL parser C# extensions:
That can be used as
var model = await new ModelParser().ParseAsync(ReadFile("dtmi/samples/aninterface-1.json"));Console.WriteLine(model.Id);foreach (var t in model.Telemetries){ Console.WriteLine($" [T] {t.Name} {t.Schema.Id}");}foreach (var p in model.Properties){ Console.WriteLine($" [P] {p.Name} {p.Schema.Id}");}foreach (var c in model.Commands){ Console.WriteLine($" [C] {c.Name} {c.Request.Id} {c.Response.Id}");}
Original Link: https://dev.to/ridomin/dtdl-parser-extensions-5b56
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To