public async Task MsgPackEncode() { // #tag::msgpack-encode[] var serializer = new MsgPackSerializer(); var transcoder = new MsgPackTranscoder(serializer); var user = new User2 { Name = "John Smith", Age = 27 }; await _collection.UpsertAsync("john-smith", user, options => options.Transcoder(transcoder)); // #end::msgpack-encode[] }
public async Task MsgPackDecode() { // #tag::msgpack-decode[] var serializer = new MsgPackSerializer(); var transcoder = new MsgPackTranscoder(serializer); var user = new User2 { Name = "John Smith", Age = 27 }; var result = await _collection.GetAsync("john-smith", options => options.Transcoder(transcoder)); var returnedUser = result.ContentAs <User2>(); // #end::msgpack-decode[] }