Exemplo n.º 1
0
            /// <inheritdoc/>
            public Twin GetTwin()
            {
                lock (_lock) {
                    var twin = Twin.Clone();

                    // Wipe out what a client should not see...
                    twin.Tags            = null;
                    twin.ConnectionState = null;
                    twin.Status          = null;

                    if (twin.Properties == null)
                    {
                        twin.Properties = new TwinPropertiesModel();
                    }
                    if (twin.Properties.Reported == null)
                    {
                        twin.Properties.Reported = new Dictionary <string, JToken>();
                    }
                    if (twin.Properties.Desired == null)
                    {
                        twin.Properties.Desired = new Dictionary <string, JToken>();
                    }
                    // Double clone but that is ok.
                    return(twin.ToTwin());
                }
            }