以ADFV2文档中此处给出的示例为基础-https://docs.microsoft.com/en-us/azure/data-factory/transform-data-using-dotnet-custom-activity#executing-commands
上述相同文档中的代码段不能按原样使用-
动态活动= JsonConvert.DeserializeObject(File.ReadAllText(“ activity.json”)); Console.WriteLine(activity.typeProperties.extendedProperties.connectionString.value
因为这将导致RuntimeBinderException: “ Newtonsoft.Json.Linq.JValue”不包含“值”的定义
答案 0 :(得分:1)
我不确定连接字符串的格式,但是我在ADFv2中运行了几个自定义(Azure Batch)活动。我在控制台应用程序中使用“ .ToString()”而不是“ .value”:
// Parse activity and reference objects info from input files
var parameters = new Dictionary<string, string>();
dynamic activity = JsonConvert.DeserializeObject(File.ReadAllText("activity.json"));
parameters.Add("url", activity.typeProperties.extendedProperties.Url.ToString());