I am trying to serialize a ItemTransaction
and protobuf-net (r282) is having a problem.
ItemTransaction : IEnumerable<KeyValuePair<Type, IItemCollection>></code>
and ItemCollection is like this:
FooCollection : ItemCollection<Foo>
ItemCollection<T> : BindingList<T>, IItemCollection
IItemCollection : IList<Item>
where T is a derived type of Item. ItemCollection also has a property of type IItemCollection.
I am serializing like this:
IItemCollection itemCol = someService.Blah(...);
...
SerializeWithLengthPrefix<IItemCollection>(stream, itemCol, PrefixStyle.Base128);
My eventual goal is to serialize ItemTransaction, but am snagged with IItemCollection.
Item and it's derived types can be [de]serialized with no issues, see [1], but deserializing an IItemCollection fails (serializing works). ItemCollection has a ItemExpression property and when deserializing protobuf can't create an abstract class. This makes sense to me, but I'm not sure how to get through it.
ItemExpression<T> : ItemExpression, IItemExpression
ItemExpression : Expression
ItemExpression is abstract as is Expression
How do I get this to work properly?
Also, I am concerned that ItemTransaction will fail since the IItemCollections are going to be differing and unknown at compile time (an ItemTransaction will have FooCollection, BarCollection, FlimCollection, FlamCollection, etc).
What am I missing (Marc) ?
[1] http://stackoverflow.com/questions/2276104/protobuf-net-deserializing-across-assembly-boundaries