Azure functions Azure函数不在本地创建Azure表列

Azure functions Azure函数不在本地创建Azure表列,azure-functions,azure-storage,azure-table-storage,azure-storage-queues,azure-storage-emulator,Azure Functions,Azure Storage,Azure Table Storage,Azure Storage Queues,Azure Storage Emulator,我正在尝试创建Azure函数。在本地,我希望能够在部署功能之前对其进行测试。我正在使用VS代码开发MacOS 11.2.3。我正在使用Docker中运行的本地存储模拟器。我可以连接到本地模拟器并查看我的队列和存储。我的功能应用程序使用netcoreapp3.1,是一个功能v3应用程序 我的触发器是队列接收到的新有效负载。我的触发器工作正常,当我将数据写入Azure存储表时,我可以看到RowKey、PartitionKey和时间戳。我看不到我创建的任何数据。这是我的密码: public stati

我正在尝试创建Azure函数。在本地,我希望能够在部署功能之前对其进行测试。我正在使用VS代码开发MacOS 11.2.3。我正在使用Docker中运行的本地存储模拟器。我可以连接到本地模拟器并查看我的队列和存储。我的功能应用程序使用netcoreapp3.1,是一个功能v3应用程序

我的触发器是队列接收到的新有效负载。我的触发器工作正常,当我将数据写入Azure存储表时,我可以看到RowKey、PartitionKey和时间戳。我看不到我创建的任何数据。这是我的密码:

public static class MyFunction
{
    [FunctionName("MyFunction")]
    [return: Table("mytable")]
    public static MyObject Run([QueueTrigger("myqueue")]string queueItem, ILogger log)
    {
        log.LogInformation($"C# Queue trigger function processed");
        var myObject = JsonConvert.DeserializeObject<MyObject>(queueItem);
        log.LogInformation(JsonConvert.SerializeObject(myObject));
        return myObject;
    }
}

问题是我没有看到MyProperty列被创建。我给队列的JSON负载有它,我可以看到它被记录到记录器中,我只是在Azure Storage Explorer中看不到该列。我每次触发函数时都会看到一行。请帮助我理解为什么我看不到我的数据。

我相信您遇到这个问题是因为您的
MyProperty
没有公共setter

请尝试更改这行代码:

public string MyProperty { get; }

您的代码应该运行良好

参考:(请参阅代码中的“强制公共getter/setter”)


我相信您遇到这个问题是因为您的
MyProperty
没有公共setter

请尝试更改这行代码:

public string MyProperty { get; }

您的代码应该运行良好

参考:(请参阅代码中的“强制公共getter/setter”)


这确实奏效了。我还试着用一个私人的电视机,但也没用。使用不可变对象和Azure表有好的模式吗?这确实有效。我还试着用一个私人的电视机,但也没用。使用不可变对象和Azure表有好的模式吗?
public string MyProperty { get; set; }
internal static bool ShouldSkipProperty(PropertyInfo property, OperationContext operationContext)
{
    // reserved properties
    string propName = property.Name;
    if (propName == TableConstants.PartitionKey ||
        propName == TableConstants.RowKey ||
        propName == TableConstants.Timestamp ||
        propName == TableConstants.Etag)
    {
        return true;
    }

    MethodInfo setter = property.FindSetProp();
    MethodInfo getter = property.FindGetProp();

    // Enforce public getter / setter
    if (setter == null || !setter.IsPublic || getter == null || !getter.IsPublic)
    {
        Logger.LogInformational(operationContext, SR.TraceNonPublicGetSet, property.Name);
        return true;
    }

    // Skip static properties
    if (setter.IsStatic)
    {
        return true;
    }

    // properties with [IgnoreAttribute]
#if WINDOWS_RT || NETCORE 
    if (property.GetCustomAttribute(typeof(IgnorePropertyAttribute)) != null)
#else
    if (Attribute.IsDefined(property, typeof(IgnorePropertyAttribute)))
#endif
    {
        Logger.LogInformational(operationContext, SR.TraceIgnoreAttribute, property.Name);
        return true;
    }

    return false;
}