odata

config.MapODataServiceRoute error

老子叫甜甜 提交于 2019-12-21 07:29:34
问题 I am currently following this guide -> Link to asp.net website As the guide says I added all the necessary packages via the nuget console and added the necessary usings to the WebApIConfig file. . But when I added the endpoint register method VS gave me an error. The method I added: public static void Register(HttpConfiguration config) { // New code: ODataModelBuilder builder = new ODataConventionModelBuilder(); builder.EntitySet<Product>("Products"); config.MapODataServiceRoute( routeName:

Media Resource Support for OData POST in Web API

ぐ巨炮叔叔 提交于 2019-12-21 07:27:29
问题 I would like to create oData controller to upload files FileDto FileId NameWithExtension (Type: String) Metadata (Type: List) Content (Type: Stream) =========================Http Request Actions================== • GET: ~/Files({id}) Content-Type: application/json Result: FileDto without Content • GET: ~/Files({id}) Content-Type: application/octet-stream Result: Stream of the File only • POST: ~/Files Content-Type: ? Body: FileDto with Content Result: FileId Not sure how i can achieve this

How to expand multiple properties on OData

两盒软妹~` 提交于 2019-12-21 07:27:18
问题 Consider I have this OData expression: http://services.odata.org/northwind/northwind.svc/Categories? $expand=Products/Category It will correctly expand the Products.Category . Now I want to expand another property too. For example 'Products.Supplier`. I've tried duplicating the $expand usage: http://services.odata.org/northwind/northwind.svc/Categories? $expand=Products/Category &$expand=Products/Supplier but it failed returning this error: Query parameter '$expand' is specified, but it

How to EnableCaseInsensitive, EnableEnumPrefixFree and EnableUnqualifiedNameCall in OData v6.0.0

六眼飞鱼酱① 提交于 2019-12-21 05:20:06
问题 I recently updated OData from (v5.9.1) to the latest stable version (v6.0.0) and in the former one I used to configure my environment like this: //Allows calling the Url like {entityAction}/{id} config.SetUrlConventions(ODataUrlConventions.KeyAsSegment); //Allows urls to be case insensitive config.EnableCaseInsensitive(true); // Remove the necessity of having to specify the namespace of enums. config.EnableEnumPrefixFree(true); //This allows call a function without using the full namespace.

New oData javascript library (from MSFT) compared to jQuery

蹲街弑〆低调 提交于 2019-12-21 05:14:19
问题 What is the benefit of the new Javascript OData library over using jQuery? http://blogs.msdn.com/b/astoriateam/archive/2011/02/08/new-javascript-library-for-odata-and-beyond.aspx 回答1: jQuery is very good at what it does and datajs doesn't try to duplicate any of its features, so it's hard to answer the question in those terms. datajs currently implements extensive OData support, including multiple formats, support for parsing conceptual models, the ability to enhance results when metadata is

Get the OData catalog for Web API OData v4 in XML

。_饼干妹妹 提交于 2019-12-21 04:51:42
问题 I am trying to get a Web API OData V4 endpoint up and running. I got it going finally (after removing all the DateTime properties from my endpoint) and now the listing of the entities is in JSON. I love JSON, but I use LinqPad to test my endpoints. It does not understand the JSON for the listing of the entities that are in my feed. I have looked and can't seem to find a way to change this back to XML, so I am asking here. Is there a way to have the listing of entities for a Web API OData v4

Request error with WCF Data Services

爱⌒轻易说出口 提交于 2019-12-21 04:29:27
问题 Its my first time setting up an OData Service and I'm of course having some problems... The problem is that I can't get the service running, I keep getting an "Request Error". I have researched on what the problem can be and I found that a common issue is that the access rules are incorrectly typed. So I have tried fixing this both with Singular names, Plural names and I have also tried with typeof(Post).getType().Name Well here is my code. I hope you can help me, I've been stuck for hours.

How to correctly unit test OData v6.0 controller?

耗尽温柔 提交于 2019-12-21 04:28:18
问题 I'm attempting to unit test out OData controllers, however the APIs changed and previously recommended methods I tried do not work - currently I'm getting No non-OData HTTP route registered. when trying to instantiate ODataQueryOptions to be passed into the Get method of the controller My current code (based on answers like this one): [TestMethod()] public void RankingTest() { var serviceMock = new Mock<IVendorService>(); serviceMock.SetReturnsDefault<IEnumerable<Vendor>>(new List<Vendor>() {

The best way to modify a WebAPI OData QueryOptions.Filter

限于喜欢 提交于 2019-12-21 00:40:13
问题 I am using the OData sample project at http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/working-with-entity-relations. In the Get I want to be able to change the Filter in the QueryOptions of the EntitySetController: public class ProductsController : EntitySetController<Product, int> { ProductsContext _context = new ProductsContext(); [Queryable(AllowedQueryOptions=AllowedQueryOptions.All)] public override IQueryable<Product> Get() { var products = QueryOptions.ApplyTo(

How do you get a web API odatamodelbuilder to work with EF fluent API mappings

Deadly 提交于 2019-12-20 19:31:43
问题 I have created a fairly simply domain model using pocos. I have mapped these to an EF DB context using EntityTypeConfiguration<TEnitityType> classes. This all works fine. I am now trying to create an OData V4 WebAPI controller endpoint using a ODataConventionModelBuilder and this is where things are coming unstuck. It all works fine until it encounters an association that is not convention based. But I cannot find a way to get the ODataBuilder to pick up the mappings from my