-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tables: Query support for dictionary entities and CreateFilter (#12366)
* Support for dictionary entities and CreateFilter * add comment to CreateFilter * take the new Azure.ClientSdk.Analyzers and remove pragmas * remove redundant .ToList() calls in tests * make CreateFilter less prominant on the client
- Loading branch information
1 parent
b6d7f43
commit 6e83f93
Showing
15 changed files
with
3,803 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
sdk/tables/Azure.Data.Tables/src/Extensions/TableClientExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq.Expressions; | ||
|
||
namespace Azure.Data.Tables.Queryable | ||
{ | ||
public static class TableClientExtensions | ||
{ | ||
/// <summary> | ||
/// Creates an Odata filter query string from the provided expression. | ||
/// </summary> | ||
/// <typeparam name="T">The type of the entity being queried. Typically this will be derrived from <see cref="TableEntity"/> or <see cref="Dictionary{String, Object}"/>.</typeparam> | ||
/// <param name="client">The <see cref="TableClient"/>.</param> | ||
/// <param name="filter">A filter expresssion.</param> | ||
/// <returns>The string representation of the filter expression.</returns> | ||
public static string CreateFilter<T>(this TableClient client, Expression<Func<T, bool>> filter) => client.Bind(filter); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
sdk/tables/Azure.Data.Tables/src/Queryable/ReflectionUtil.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Collections.Generic; | ||
using System.Reflection; | ||
|
||
namespace Azure.Data.Tables.Queryable | ||
{ | ||
internal static class ReflectionUtil | ||
{ | ||
internal static MethodInfo DictionaryGetItemMethodInfo { get; } | ||
|
||
static ReflectionUtil() | ||
{ | ||
DictionaryGetItemMethodInfo = typeof(IDictionary<string, object>).GetMethod("get_Item"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.