【发布时间】:2014-03-21 15:31:59
【问题描述】:
就我而言,我提升了 UInt64 值。 UInt64 不能作为变体提升,所以我使用了promoteAsBinary。
这是我必须阅读的代码:
String sql =
@"Select Value33, InstanceId from
[System.Activities.DurableInstancing].[InstancePromotedProperties]
where PromotionName = 'MyUInt64'";
try
{
string connectionString = ConfigurationManager.ConnectionStrings
["InstanceStore"].ConnectionString;
using (SqlConnection conn = new SqlConnection(connectionString))
{
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
using (SqlDataReader reader = cmd.ExecuteReader())
{
Console.WriteLine("Promoted values:");
while (reader.Read())
{
byte[] result = (byte[])reader["Value33"];
// How do I turn this byte[] into an UInt64??
}
}
}
}
catch (Exception exception)
{
Console.WriteLine("Query Unhandled exception: {0}",
exception.Message);
}
我尝试将 byte[] 传递给 MemoryStream,然后使用带有默认编码、ASCI 和 UTF-8 的 BinaryReader,但它不起作用。我得到一个垃圾值。我将实例编码设置为无。
storeBehavior.InstanceEncodingOption =
InstanceEncodingOption.None;
【问题讨论】:
标签: c# .net workflow-foundation-4 workflowservice