Last active
August 29, 2015 14:06
-
-
Save k-maru/9fe021033226965eddee to your computer and use it in GitHub Desktop.
Microsoft.AspNet.WebApi.OData Setting
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
//using に追加 | |
using System.Web.Http.OData; | |
using System.Web.Http.OData.Query; | |
namespace Sample.Controllers { | |
public class SampleController: ApiController { | |
//属性付加 | |
[EnableQuery] | |
public IQueryable<User> Get(){ | |
//IQueryable | |
return new SampleEntities().Users.AsQueryable(); | |
} | |
} | |
} |
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
//using に追加 | |
using System.Web.Http.OData.Extensions; | |
namespace Sample{ | |
public static class WebApiConfig { | |
public static void Register(HttpConfiguration config) { | |
//いろいろ設定 | |
//OData | |
config.AddODataQueryFilter(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment