Azure-cosmos-dotnet-v3: LINQ Provider does not accept PropertyNamingPolicy setting

Created on 14 Oct 2019  路  2Comments  路  Source: Azure/azure-cosmos-dotnet-v3

Describe the bug

CosmosPropertyNamingPolicy.CamelCase is set to PropertyNamingPolicy, the class property name is not converted to camel case in the query generated by LINQ Provider.

To Reproduce

  1. Code snippet
public class Entry
{
    public string Id { get; set; }
    public string Title { get; set; }
    public string Body { get; set; }
    public IList<string> Tags { get; set; }
    public DateTimeOffset CreatedAt { get; set; }
}

class Program
{
    static async Task Main(string[] args)
    {
        var connectionString = "";

        var cosmosClient = new CosmosClient(connectionString, new CosmosClientOptions
        {
            ConnectionMode = ConnectionMode.Direct,
            SerializerOptions = new CosmosSerializationOptions
            {
                PropertyNamingPolicy = CosmosPropertyNamingPolicy.CamelCase
            }
        });

        var container = cosmosClient.GetContainer("Blog", "Entry");

        var query = container.GetItemLinqQueryable<Entry>()
                             .Where(x => x.Tags.Contains("鏃ヨ"))
                             .ToQueryDefinition();

        Console.WriteLine(query.QueryText);
    }
}

Expected behavior

Property name is converted to camel case.

SELECT VALUE root FROM root WHERE ARRAY_CONTAINS(root["tags"], "鏃ヨ")

Actual behavior

Property name is not actually converted to camel case.

SELECT VALUE root FROM root WHERE ARRAY_CONTAINS(root["Tags"], "鏃ヨ")

Environment summary

SDK Version: 3.3.1
OS Version: Windows 10 / .NET Core 3.0

bug needs-investigation

All 2 comments

@shibayan I figured out the root cause. I'm working on a fix and will do a 3.3.2 hot fix for this. It turns out the test validating this wasn't properly tagged so it wasn't running.

@shibayan 3.3.2 was released with the fix.

Was this page helpful?
0 / 5 - 0 ratings