Created
November 1, 2012 00:14
-
-
Save rofr/3990796 to your computer and use it in GitHub Desktop.
Protobuf attributes for JournalEntry
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
[ProtoContract(ImplicitFields = ImplicitFields.AllFields)] | |
[Serializable] | |
public abstract class JournalEntry | |
{ | |
public readonly long Id; | |
public readonly DateTime Created; | |
public JournalEntry(long id, DateTime? created = null) | |
{ | |
Created = created ?? DateTime.Now; | |
Id = id; | |
} | |
} | |
[ProtoContract(ImplicitFields = ImplicitFields.AllFields)] | |
[ProtoInclude(42, typeof(JournalEntry))] | |
[Serializable] | |
public class JournalEntry<T> : JournalEntry | |
{ | |
public T Item { get; protected internal set; } | |
public JournalEntry(long id, T item, DateTime? created = null) : base(id, created) | |
{ | |
Item = item; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment