forked from simplefx/Simple.OData
-
Notifications
You must be signed in to change notification settings - Fork 197
Retrieving a single row matching search criteria
Jason Finch edited this page Aug 23, 2018
·
12 revisions
var product = await _client
.For("Products")
.Filter("ProductName+eq+%27Chai%27")
.FindEntryAsync();
Assert.Equal("Chai", product["ProductName"]);
var product = await _client
.For<Products>()
.Filter(x => x.ProductName == "Chai")
.FindEntryAsync();
Assert.Equal("Chai", product.ProductName);
var x = ODataDynamic.Expression;
var product = await _client
.For(x.Products)
.Filter(x.ProductName == "Chai")
.FindEntryAsync();
Assert.Equal("Chai", product.ProductName);
Request URI: GET Products?$filter=ProductName+eq+%27Chai%27
var product = await _client
.For("Products")
.Filter("CategoryID+eq+1+and+SupplierID+eq+1")
.FindEntryAsync();
Assert.Equal("Chai", product["ProductName"]);
var product = await _client
.For<Products>()
.Filter(x => x.CategoryID == 1 && x.SupplierID == 1)
.FindEntryAsync();
Assert.Equal("Chai", product.ProductName);
var x = ODataDynamic.Expression;
var product = await _client
.For("Products")
.Filter(x.CategoryID == 1 && x.SupplierID == 1)
.FindEntryAsync();
Assert.Equal("Chai", product.ProductName);
Request URI: GET Products?$filter=CategoryID+eq+1+and+SupplierID+eq+1
See also:
Retrieving data