wcf-data-services

Enable WCF Data Service to accept/return JSON by default

为君一笑 提交于 2019-12-20 11:52:45
问题 I have a WCF Data Service that I'd like to return JSON by default for all operations. Is there a place I can set that in configuration/via service attributes? 回答1: In order to enable json via the $format tag like this: host:8038/YourService.svc/?$format=json Add this attribute to your service declaration: [JSONPSupportBehavior] public class Service : DataService<YourEntities> Add this as a class to your service: using System; using System.ServiceModel; using System.ServiceModel.Channels;

Enable WCF Data Service to accept/return JSON by default

寵の児 提交于 2019-12-20 11:52:00
问题 I have a WCF Data Service that I'd like to return JSON by default for all operations. Is there a place I can set that in configuration/via service attributes? 回答1: In order to enable json via the $format tag like this: host:8038/YourService.svc/?$format=json Add this attribute to your service declaration: [JSONPSupportBehavior] public class Service : DataService<YourEntities> Add this as a class to your service: using System; using System.ServiceModel; using System.ServiceModel.Channels;

Problem with WCF Data Service (OData), SetEntitySetPageSize and custom operations

家住魔仙堡 提交于 2019-12-20 06:27:51
问题 I have a WCF Data Service with a custom operation named MostRecentFilms that returns the 10 most recent films in the source. Each film has, among others, a Year property. All goes fine with the default setting but when I set the page size for entity sets, config.SetEntitySetPageSize("*", 100) , the order of returned films are not good. Doesn't matter if the result set has less than 100, they are not properly ordered from more recent to less, how it was returned when the page size restriction

How can I keep Entity Framework from generating inefficient queries in SQL Server?

吃可爱长大的小学妹 提交于 2019-12-19 19:59:20
问题 I have an entity defined in an EF 4.0 that is based on a view. The view lays over a table with about 18 million rows of data. I have selected the 4 deterministic properties of the entity as a compound Entity key for this entity. I have exposed access to the model containing this view via an OData WCF data service. The WCF Data service is set to limit results like so config.SetEntitySetPageSize("*", 100) When I make a basic query against this view: var fcbs = this.iBenchmarkCostContext

How can I keep Entity Framework from generating inefficient queries in SQL Server?

早过忘川 提交于 2019-12-19 19:58:08
问题 I have an entity defined in an EF 4.0 that is based on a view. The view lays over a table with about 18 million rows of data. I have selected the 4 deterministic properties of the entity as a compound Entity key for this entity. I have exposed access to the model containing this view via an OData WCF data service. The WCF Data service is set to limit results like so config.SetEntitySetPageSize("*", 100) When I make a basic query against this view: var fcbs = this.iBenchmarkCostContext

WCF, Web services or ADO.NET data services: What shall I use?

老子叫甜甜 提交于 2019-12-19 03:08:46
问题 For a project I have to implement a communication between a database hosted on a web server and several clients out there in the internet. After reading a bit and watching a few introductory videos about possible (Microsoft) technologies I figured out that I seem to have (at least) three options: 1) Windows Communication Foundation (WCF) 2) ASP.NET Web services 3) ADO.NET Data services Because I am not familiar with any of those three technologies I have to learn (hopefully only) one of them

WCF, Web services or ADO.NET data services: What shall I use?

你离开我真会死。 提交于 2019-12-19 03:08:07
问题 For a project I have to implement a communication between a database hosted on a web server and several clients out there in the internet. After reading a bit and watching a few introductory videos about possible (Microsoft) technologies I figured out that I seem to have (at least) three options: 1) Windows Communication Foundation (WCF) 2) ASP.NET Web services 3) ADO.NET Data services Because I am not familiar with any of those three technologies I have to learn (hopefully only) one of them

How do I update an OData entity and modify its navigation properties in one request?

跟風遠走 提交于 2019-12-18 13:22:37
问题 I am trying to implement what I thought was a simple scenario using an OData service provided by WCF Data services (using the OData V3 application/json;odata=verbose payload format, for now. I may use the JSON Light format in the future). The basic scenario goes like this: I have two entities: class Person { public int ID { get; set; } public string Name { get; set; } public virtual PersonCategory Category { get; set; } } class PersonCategory { public int ID { get; set; } public string

Select entities where ID in int array - WCF Data Services, LINQ

China☆狼群 提交于 2019-12-18 05:59:14
问题 I would like to return a set of entities who has and ID that is contained in a list or array of IDs using LINQ and Data Services. I know how to this using LinqToEF but I am at a loss how to this with Data Services or using OData query conventions for that matter. My thought is that I would do something like: int[] intArray = {321456, 321355, 218994, 189232}; var query = (from data in context.Entity where intArray.contains(data.ID) select data); Is there any way to accomplish using Data

Data inserted successful but jquery still returning error

谁说胖子不能爱 提交于 2019-12-17 23:17:00
问题 I used following jQuery to insert data via Data Service. Event though I got status-response 201 and the data is successfully inserted into my database, the system still regard it as an error and gives me "failed" alert? What am I missing here? $.ajax({ type: "POST", url: "http://localhost:49223/Form/WebDataService.svc/XMLForm(guid'1eaef3a0-d6df-45bf-a8f6-3e7292c0d77e')/XMLRecord/", data: JSON.stringify(record), contentType: "application/json; charset=utf-8", dataType: "json", success: