c# - 如何将服务总线消息 SystemProperties.LockToken 反序列化到自己的类 C# 中?

标签 c# azure azureservicebus servicebus

我有以下代码将消息属性反序列化到我自己的类中,但如何将默认消息属性获取到同一个类中?

 var data = Encoding.UTF8.GetString(message.Body);
 var testdata = JsonConvert.DeserializeObject<MyClass>(data); 

我希望这个消息属性也进入 MyClass message.SystemProperties.LockToken

 public class CheckException
    {
        public Guid Id { get; set; }
        public string Name { get; set; }

最佳答案

LockToken 只是一个字符串。为什么不直接将其设置为一个属性,例如

testdata.LockToken = message.SystemProperties.LockToken;

关于c# - 如何将服务总线消息 SystemProperties.LockToken 反序列化到自己的类 C# 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51076030/

相关文章:

c# - Moq When(Func<bool>) 方法的使用

azure - 尝试使用 azure 保管库证书 key 解密时出错 : "Operation returned an invalid status code ' Forbidden'"

azure - 如何通过代码从 Azure Blob 存储中删除事件中心分区?

c# - Azure Functions 中 local.settings.json 的值

c# - .NET RegEx 用于替换 URL 中的语言代码

c# - 禁止对 List<T> 公开添加和删除

c# - 使用LINQ有效地分页大型数据集

asp.net-mvc-3 - 从 Azure 中的辅助角色部署 Web 角色

c# - Azure 主题辅助角色在 60 秒后停止处理消息

Azure Function 中的 Azure 服务总线处理程序