Ejemplo n.º 1
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var slist   = (ISerializableList)value;
            var toWrite = new RawSerializedListData()
            {
                CreatedOn = slist.CreatedOn.ToConcreteDictionary(),
                UpdatedOn = slist.UpdatedOn.ToConcreteDictionary(),
                CollectionTypeFullName = slist.GetType().FullName,
                Items = slist.OfType <ISerializableItem>().Select(x => x.ContentHash).ToArray(),
            };

            foreach (ISerializableItem v in slist)
            {
                _engine.Save(v);
            }

            serializer.Serialize(writer, toWrite);
        }
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var slist = (ISerializableList)value;
            var toWrite = new RawSerializedListData() {
                CreatedOn = slist.CreatedOn.ToConcreteDictionary(),
                UpdatedOn = slist.UpdatedOn.ToConcreteDictionary(),
                ItemsRootTypeFullName = slist.GetBaseListType().FullName,
                Items = slist.OfType<ISerializableItem>().Select(x => x.ContentHash).ToArray(),
            };

            serializer.Serialize(writer, toWrite);
        }