Skip to content

Instantly share code, notes, and snippets.

View markdstafford's full-sized avatar

Mark Stafford markdstafford

  • Microsoft
  • Redmond, WA
View GitHub Profile
using System.Data.Services;
namespace OData101.UpdateTheSvcFileWhenBinDeploying
{
public class BinDeploy : DataService<DummyContext> { }
public class DummyContext { }
}
var queryString = ("/Northwind.svc/Products?"
+ "$filter=((Category/Category_ID eq 1)or"
+ "substringof('tofu',tolower"
+"(Product_Name)))&"
+ "$orderby=Category/Category_Name&"
+ "$select=Product_Name");
$.ajax({
url: queryString,
dataType: 'JSON',
context.Configurations.ResponsePipeline.OnEntryEnded((a =>
{
Type entityType = dataServiceContext.ResolveType(a.Entry.TypeName);
if (typeof(Product).IsAssignableFrom(entityType))
{
var properties = a.Entry.Properties as List<ODataProperty>;
if (properties == null)
{
properties = new List<ODataProperty>(a.Entry.Properties);
}