本文整理汇总了C#中SimpleStatement.EnableTracing方法的典型用法代码示例。如果您正苦于以下问题:C# SimpleStatement.EnableTracing方法的具体用法?C# SimpleStatement.EnableTracing怎么用?C# SimpleStatement.EnableTracing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleStatement
的用法示例。
在下文中一共展示了SimpleStatement.EnableTracing方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Warnings_With_Tracing_Test
public void Warnings_With_Tracing_Test()
{
const string query = "BEGIN UNLOGGED BATCH INSERT INTO {0} (k, t) VALUES ('{1}', '{2}') APPLY BATCH";
SimpleStatement insert = new SimpleStatement(String.Format(query, Table, "warn1", String.Join("", Enumerable.Repeat("a", 5 * 1025))));
var rs = Session.Execute(insert.EnableTracing());
Assert.NotNull(rs.Info.Warnings);
Assert.NotNull(rs.Info.QueryTrace);
Assert.AreEqual(1, rs.Info.Warnings.Length);
StringAssert.Contains("batch", rs.Info.Warnings[0].ToLowerInvariant());
StringAssert.Contains("exceeding", rs.Info.Warnings[0].ToLowerInvariant());
}
示例2: Warnings_With_Tracing_And_Custom_Payload_Test
public void Warnings_With_Tracing_And_Custom_Payload_Test()
{
const string query = "BEGIN UNLOGGED BATCH INSERT INTO {0} (k, t) VALUES ('{1}', '{2}') APPLY BATCH";
SimpleStatement insert = new SimpleStatement(String.Format(query, Table, "warn1", String.Join("", Enumerable.Repeat("a", 5 * 1025))));
var outgoing = new Dictionary<string, byte[]> { { "k1", Encoding.UTF8.GetBytes("value1") }, { "k2", Encoding.UTF8.GetBytes("value2") } };
insert.SetOutgoingPayload(outgoing);
var rs = Session.Execute(insert.EnableTracing());
Assert.NotNull(rs.Info.Warnings);
Assert.NotNull(rs.Info.QueryTrace);
Assert.AreEqual(1, rs.Info.Warnings.Length);
StringAssert.Contains("batch", rs.Info.Warnings[0].ToLowerInvariant());
StringAssert.Contains("exceeding", rs.Info.Warnings[0].ToLowerInvariant());
CollectionAssert.AreEqual(outgoing["k1"], rs.Info.IncomingPayload["k1"]);
CollectionAssert.AreEqual(outgoing["k2"], rs.Info.IncomingPayload["k2"]);
}