Closed GoogleCodeExporter closed 9 years ago
Original comment by elliott....@gmail.com
on 10 Jul 2008 at 4:59
Original comment by elliott....@gmail.com
on 10 Jul 2008 at 5:00
Wanted to rethink this a little. There may be a use case for just setting the
item type.
[JsonExCollection(ItemType=typeof(string))]
public class MyStringCollection : CollectionBase {
public void Add(string Item) {
this.InnerList.Add(Item);
}
}
In this situation the handler would first find an existing Handler to handle the
particular class. Then it would create a wrapper around the handler.
public class CollectionHandlerWrapper : CollectionHandler {
private CollectionHandler _inner;
private Type _collectionType;
private Type _itemType;
public CollectionHandlerWrapper(CollectionHandler Inner, Type CollectionType, Type
ItemType) {
_inner = Inner;
_collectionType = CollectionType;
_itemType = ItemType;
}
public override bool IsCollection(Type CollectionType) {
return _collectionType.IsAssignableFrom(CollectionType);
}
public override Type GetItemType(Type CollectionType) {
return _itemType;
}
// All other methods delegate to the _inner instance
}
}
Original comment by elliott....@gmail.com
on 10 Jul 2008 at 1:41
Should probably add some type of support for this to the Config and maybe the
Context
although you could do it in the context without any extra support it would just
make
it easier.
Original comment by elliott....@gmail.com
on 10 Jul 2008 at 1:44
Original comment by elliott....@gmail.com
on 19 Jul 2008 at 7:04
Original issue reported on code.google.com by
elliott....@gmail.com
on 10 Jul 2008 at 4:08