public static void CopyViaPoco( [BlobTrigger(BlobPath)] PocoBlob input, [Blob(OutputBlobPath)] out PocoBlob output) { output = new PocoBlob { Value = "*" + input.Value + "*" }; }
public void Initialize(ExtensionConfigContext context) { context.AddConverter <Stream, PocoBlob>(s => { TextReader reader = new StreamReader(s); string text = reader.ReadToEnd(); return(new PocoBlob { Value = text }); }); context.AddConverter <ApplyConversion <PocoBlob, Stream>, object>(p => { PocoBlob value = p.Value; Stream stream = p.Existing; TextWriter writer = new StreamWriter(stream); writer.WriteAsync(value.Value).GetAwaiter().GetResult(); writer.FlushAsync().GetAwaiter().GetResult(); return(null); }); context.AddConverter <Stream, CustomDataObject>(s => { // Read() shouldn't be called if the stream is missing. Assert.False(true, "If stream is missing, should never call Read() converter"); return(null); }); context.AddConverter <ApplyConversion <CustomDataObject, Stream>, object>(p => { CustomDataObject value = p.Value; Stream stream = p.Existing; if (value != null) { Assert.AreEqual(TestValue, value.ValueId); const byte ignore = 0xFF; stream.WriteByte(ignore); } return(null); }); context.AddConverter <Stream, CustomDataValue>(s => { // Read() shouldn't be called if the stream is missing. Assert.False(true, "If stream is missing, should never call Read() converter"); return(default(CustomDataValue)); }); context.AddConverter <ApplyConversion <CustomDataValue, Stream>, object>(p => { CustomDataValue value = p.Value; Stream stream = p.Existing; Assert.AreEqual(TestValue, value.ValueId); const byte ignore = 0xFF; stream.WriteByte(ignore); return(null); }); }