private IMapTable Serialize(object fromValue, Type fromType, IMapSerializeOptions options) { if (fromType == null) { throw new ArgumentNullException(nameof(fromType)); } if (options == null) { throw new ArgumentNullException(nameof(options)); } var table = new MapTable(); var context = new MapSerializeContext(this._serializer, table); this._config.AttachTo(fromType, options); this._serializer.Serialize(MapPath.Root, fromValue, fromType, options, context); return(table.AfterSerialize(options)); }
public IMapTable BeforeDeserialize(IMapDeserializeOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } var table = new MapTable(this); var maps = options.GetMaps(); foreach (var map in maps) { var token = table.GetToken(map.Key); table.Remove(map.Key); foreach (var path in map.Value) { table.SetToken(path, token); } } return(table); }