This file contains hidden or 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
[WebGet] | |
public int GetOrdersCount() | |
{ | |
return this.CurrentDataSource.Orders.Count(); | |
} |
This file contains hidden or 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
public class Post | |
{ | |
public int PostId { get; set; } | |
public string PostName { get; set; } | |
public PostContent Content { get; set; } | |
… | |
} |
This file contains hidden or 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
[ComplexType] | |
public class PostContent | |
{ | |
public string Title { get; set; } | |
public string SubTitle { get; set; } | |
public string Body { get; set; } | |
} |
This file contains hidden or 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
public partial class ShipInfo | |
{ | |
public string ShipName { get; set; } | |
public string ShipAddress { get; set; } | |
public string ShipCity { get; set; } | |
public string ShipRegion { get; set; } | |
public string ShipPostalCode { get; set; } | |
public string ShipCountry { get; set; } | |
} | |
This file contains hidden or 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
SearchQueryOption | |
Expression = BinaryOperatorNode | |
OperationKind = BinaryOperatorKind.And | |
Left = SearchTermNode | |
Text = a | |
Right = SearchTermNode | |
Text = b |
This file contains hidden or 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
Dictionary<string, string> options = new Dictionary<string, string>() | |
{ | |
{"$select" , "ID" }, | |
{"$expand" , "ProductDetail" }, | |
{"$filter" , "Categories/any(d:d/ID gt 1)" }, | |
{"$orderby" , "ID desc" }, | |
{"$top" , "1" }, | |
{"$count" , "true" }, | |
{"$search" , "tom" }, | |
}; |
This file contains hidden or 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
Uri fullUri = new Uri("Products?$select=ID&$expand=ProductDetail" + | |
"&$filter=Categories/any(d:d/ID%20gt%201)&$orderby=ID%20desc" + | |
"&$top=1&$count=true&$search=tom", UriKind.Relative); | |
ODataUriParser parser = new ODataUriParser(model, serviceRoot, fullUri); | |
SelectExpandClause expand = | |
parser.ParseSelectAndExpand(); //parse $select, $expand | |
FilterClause filter = parser.ParseFilter(); // parse $filter | |
OrderByClause orderby = parser.ParseOrderBy(); // parse $orderby | |
SearchClause search = parser.ParseSearch(); // parse $search | |
long? top = parser.ParseTop(); // parse $top |
This file contains hidden or 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
Uri fullUri = new Uri("http://services.odata.org/V4/OData/OData.svc/Products(1)"); | |
ODataUriParser parser = new ODataUriParser(model, serviceRoot, fullUri); | |
ODataPath path = parser.ParsePath(); |
This file contains hidden or 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
Uri serviceRoot = new Uri("http://services.odata.org/V4/OData/OData.svc"); | |
IEdmModel model = EdmxReader.Parse(XmlReader.Create(serviceRoot + "/$metadata")); | |
Uri fullUri = new Uri("http://services.odata.org/V4/OData/OData.svc/Products"); | |
ODataUriParser parser = new ODataUriParser(model, serviceRoot, fullUri); |
This file contains hidden or 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
public static class ExtensionMethods | |
{ | |
… | |
public static IEnumerable<IEdmOperation> FindBoundOperations(this IEdmModel model, IEdmType bindingType); | |
public static IEnumerable<IEdmOperation> FindBoundOperations(this IEdmModel model, string qualifiedName, IEdmType bindingType); | |
public static IEdmEntityContainer FindEntityContainer(this IEdmModel model, string qualifiedName); | |
public static IEnumerable<IEdmOperation> FindOperations(this IEdmModel model, string qualifiedName); | |
public static IEdmSchemaType FindType(this IEdmModel model, string qualifiedName); | |
public static IEdmValueTerm FindValueTerm(this IEdmModel model, string qualifiedName); | |
… |