当前位置: 首页>>代码示例>>C#>>正文


C# TelemetryContext.Initialize方法代码示例

本文整理汇总了C#中Microsoft.ApplicationInsights.DataContracts.TelemetryContext.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# TelemetryContext.Initialize方法的具体用法?C# TelemetryContext.Initialize怎么用?C# TelemetryContext.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.ApplicationInsights.DataContracts.TelemetryContext的用法示例。


在下文中一共展示了TelemetryContext.Initialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeSetsTelemetryInstrumentationKeyFromArgument

        public void InitializeSetsTelemetryInstrumentationKeyFromArgument()
        {
            var source = new TelemetryContext { InstrumentationKey = "TestValue" };
            var target = new TelemetryContext();

            target.Initialize(source, "OtherTestValue");

            Assert.Equal("OtherTestValue", target.InstrumentationKey);
        }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:9,代码来源:TelemetryContextTest.cs

示例2: InitializeDoesNotOverrideTelemetryInstrumentationKey

        public void InitializeDoesNotOverrideTelemetryInstrumentationKey()
        {
            var source = new TelemetryContext { InstrumentationKey = "SourceValue" };
            var target = new TelemetryContext { InstrumentationKey = "TargetValue" };

            target.Initialize(source, source.InstrumentationKey);

            Assert.Equal("TargetValue", target.InstrumentationKey);
        }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:9,代码来源:TelemetryContextTest.cs

示例3: InitializeDoesNotOverwriteTags

        public void InitializeDoesNotOverwriteTags()
        {
            string tagName = "TestTag";
            var source = new TelemetryContext { Tags = { { tagName, "Source Value" } } };
            var target = new TelemetryContext { Tags = { { tagName, "Target Value" } } };

            target.Initialize(source, source.InstrumentationKey);

            Assert.Equal("Target Value", target.Tags[tagName]);
        }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:10,代码来源:TelemetryContextTest.cs

示例4: InitializeCopiesTags

        public void InitializeCopiesTags()
        {
            string tagName = "TestTag";
            string tagValue = "TestValue";
            var source = new TelemetryContext { Tags = { { tagName, tagValue } } };
            var target = new TelemetryContext();

            target.Initialize(source, source.InstrumentationKey);

            Assert.Equal(tagValue, target.Tags[tagName]);
        }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:11,代码来源:TelemetryContextTest.cs

示例5: CopyAndSerialize

        private static string CopyAndSerialize(TelemetryContext source)
        {
            // Create a copy of the source context to verify that Serialize writes property values stored in tags
            // dictionary even if their context objects (User, Location, etc) haven't been initialized yet.
            var target = new TelemetryContext();
            target.Initialize(source, source.InstrumentationKey);

            using (var stringWriter = new StringWriter(CultureInfo.InvariantCulture))
            {
                Telemetry.WriteTelemetryContext(new JsonWriter(stringWriter), source);
                return stringWriter.ToString();
            }
        }
开发者ID:ZeoAlliance,项目名称:ApplicationInsights-dotnet,代码行数:13,代码来源:TelemetryContextTest.cs


注:本文中的Microsoft.ApplicationInsights.DataContracts.TelemetryContext.Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。