Last active
July 17, 2018 18:13
-
-
Save aconfee/99d2b8435e4f7060fa40df230e84ecb8 to your computer and use it in GitHub Desktop.
MessageAdapter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MessageOperationPacket<TMessage> | |
{ | |
public MessageOperationPacket(QueueItem queueItem) | |
{ | |
this.queueItem = queueItem; | |
} | |
protected QueueItem queueItem { get; } | |
protected TMessage data | |
{ | |
get | |
{ | |
if (this._message == null) | |
{ | |
this._message = JsonConvert.DeserializeObject<TMessage>(this.QueueItem.WorkData); | |
} | |
return this._message; | |
} | |
} | |
private TMessage _message; | |
} | |
public class MyFancyMessageOperation : MessageOperationPacket<MyFancyMessageOperation> | |
{ | |
public MyFancyMessageOperation(QueueItem queueItem) | |
: base(queueItem) {} | |
public Guid? AdditionalDataId => this.queueItem.AdditionalDataId; | |
public string Thing | |
{ | |
get => this.data.Thing; | |
set => this.data.Thing = value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment