Skip to content

Commit d8c90db

Browse files
committed
Updating LINQ query
1 parent 15d32cf commit d8c90db

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

articles/cosmos-db/tutorial-query-table.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,9 @@ For more information on how to construct filter expressions for various data typ
7979
You can also query by using LINQ, which translates to the corresponding OData query expressions. Here's an example of how to build queries by using the .NET SDK:
8080

8181
```csharp
82-
CloudTableClient tableClient = account.CreateCloudTableClient();
83-
CloudTable table = tableClient.GetTableReference("People");
84-
85-
TableQuery<CustomerEntity> query = new TableQuery<CustomerEntity>()
86-
.Where(
87-
TableQuery.CombineFilters(
88-
TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "Smith"),
89-
TableOperators.And,
90-
TableQuery.GenerateFilterCondition("Email", QueryComparisons.Equal,"[email protected]")
91-
));
92-
93-
await table.ExecuteQuerySegmentedAsync<CustomerEntity>(query, null);
82+
IQueryable<CustomerEntity> linqQuery = table.CreateQuery<CustomerEntity>()
83+
.Where(x => x.PartitionKey == "4")
84+
.Select(x => new CustomerEntity() { PartitionKey = x.PartitionKey, RowKey = x.RowKey, Email = x.Email });
9485
```
9586

9687
## Next steps

0 commit comments

Comments
 (0)