私は Web Jobs SDK でもう少し遊んでいます。スケジューラを介してメソッドを呼び出すだけで、ストレージに 1-n 個のファイルを書き込む必要があります。WebJobs SDK の優れた点は、Azure Storage SDK を含める必要がなく、すべてが "バインド" されていることです。ファイル名を指定すると機能しますが、「WriteCustomFile」メソッドは「{name}」というファイルを書き込むだけです
コード:
class Program
{
static void Main(string[] args)
{
JobHost host = new JobHost();
host.Call(typeof(Program).GetMethod("WriteFile"));
host.Call(typeof(Program).GetMethod("WriteCustomFile"), new { name = "Helloworld1.txt" });
host.Call(typeof(Program).GetMethod("WriteCustomFile"), new { name = "Helloworld2.txt" });
host.Call(typeof(Program).GetMethod("WriteCustomFile"), new { name = "Helloworld3.txt" });
//host.RunAndBlock();
}
[NoAutomaticTrigger]
public static void WriteFile([Blob("container/foobar.txt")]TextWriter writer)
{
writer.WriteLine("Hello World..." + DateTime.UtcNow.ToShortDateString() + " - " + DateTime.UtcNow.ToShortTimeString());
}
[NoAutomaticTrigger]
public static void WriteCustomFile(string name, [Blob("container/{name}")] TextWriter writer)
{
writer.WriteLine("Hello World New ..." + name + ":" + DateTime.UtcNow.ToShortDateString() + " - " + DateTime.UtcNow.ToShortTimeString());
}
}
私が達成したいのは、特定のファイル名で「WriteCustomFile」を呼び出すことです。私が見つけたすべてのサンプルは、「Blob Input / Output」のアイデアを念頭に置いて使用しています。このサンプルを見つけましたが、ハックのようです ;) http://thenextdoorgeek.com/post/WAWS-WebJob-to-upload-FREB-files-to-Azure-Storage-using-the-WebJobs-SDK
現在、これを行う方法はありますか?