wcf-data-services

How to solve this InvalidCastException while applying ClientCertificate to WCF DataService Client?

一个人想着一个人 提交于 2019-12-11 12:11:12
问题 I have used the examples in this article to add client certificate authentication to my WCF Data Service. I had to change the example slightly because I am using WCF DataService 5.6 in which the SendingRequest event has been deprecated and replaced by SendingRequest2 . Basically this meant changing the following event handler: private void OnSendingRequest_AddCertificate(object sender, SendingRequestEventArgs args) { if (null != ClientCertificate) { ((HttpWebRequest)args.Request)

WCF Data Service deployment issues

為{幸葍}努か 提交于 2019-12-11 11:54:51
问题 I have built a WCF Data Service that works when I run it on my development machine, but when I move it to a Windows 2008 VM running on Azure, I get the following error when I attempt to navigate to the .svc URL: Request Error The server encountered an error processing the request. The exception message is 'The type initializer for 'System.Data.Services.Providers.ResourceType' threw an exception.'. See server logs for more details. The exception stack trace is: at System.Data.Services

DataSets vs DataClasses as return type from WCF services

本秂侑毒 提交于 2019-12-11 11:53:01
问题 I need to path information from BL layer to the presentation layer via WCF services . I thought to do it via DataSets but I saw that people tell that it's a bad practice and it's recommended to use dataclasses. Can someone explain the difference and the advantages . Thanks for help. 回答1: DataSet is an old-school, outdated like-an-OR/M solution which worked fine for a long time in drag&drop developments . Once you want to expose some logic over a service using WCF or any other framework, you

how to increase return records size odata service from client side?

只愿长相守 提交于 2019-12-11 11:21:58
问题 I have wcf odata service return me some records, but when it records are returned it returns some limited number of records (100). I searched the web and found that there are some configuration parameters set in service initialization. MaxResultSetsPerCollection SetEntitySetPageSize Reference But is it possible to override these from the client side, when the service is consumed. if so how to do it. I want to set records returned to be 1000 instead of 100 回答1: No, you cannot increase the

Linq to Entity Query .Expand

橙三吉。 提交于 2019-12-11 10:12:43
问题 I got the following tables TableA , TableB , TableC , TableD , TableE and they have foreign key relations like FK_AB(one to many),FK_BC(one to one),FK_CD(One to many),FK_DE(one to one) and have the navigation properties based on these foreignkeys Now I want to query TableA and get the records from TableA, TableD and TableE whoose Loadedby column equal to System. My query is like below var query= from A in Context.TableA.Expand(TableB/TableC/TableD).Expand(TableB/TableC/TableD/TableE) where A

Proper way to return IQueryable using WCF Data Service and EF

ε祈祈猫儿з 提交于 2019-12-11 09:04:27
问题 So I want to return some data, and I'm using WCF Data Services and Entity Framework, that looks like: public class MyWcfDataService : DataService<MyEFModel> { [WebGet(ResponseFormat = WebMessageFormat.Json)] public IQueryable<GetMyListEF> GetMyList() { using (MyEfModel context = this.CurrentDataSource) { return context.GetMyListEF().ToList().AsQueryable(); } } } As you can see I'm casting to a list, then to queryable. If I only cast AsQueryable() , I won't be able to Read the data because the

JayData oData request with custom headers

眉间皱痕 提交于 2019-12-11 08:47:33
问题 I need to send custom headers to my wcf oData Service but with the following function the headers dont get modified. entities.onReady(function () { entities.prepareRequest = function(r) { r[0].headers['APIKey'] = 'ABC'; }; entities.DataServiceClient.toArray(function (cli) { cli.forEach(function (c) { console.log(c.Name) }); }); }); headers are not affected. any clue? thanks! 回答1: It seems that the marked answer is incorrect. I was suffering from a similar issue, but got it working without

How do I extract ETAG from a WCF Dataservices response?

◇◆丶佛笑我妖孽 提交于 2019-12-11 07:58:16
问题 I've been trying to get an answer to this question for quite some time. Since the WCF Dataservice isn't thread safe, and often it needs to be recreated, once I query my datastore for a record, how do I extract the ETAG from that response so I can use it when I reconstruct my datacontext? 回答1: That depends on which language/library you're using on the client and which format you're using on the wire (ATOM vs JSON). The ETag is stored in the payload and in case of a single entity payload also

Error in WCF Data Service when using string.Contains within LINQ statement from Silverlight

…衆ロ難τιáo~ 提交于 2019-12-11 07:21:49
问题 This is the code within Silverligh. I'm trying to get data from a wcf data service: public DataServiceQuery<Group> GetGroupsByDisplayName(string groupPartitionKey, string displayName) { DataServiceQuery<Group> query = (DataServiceQuery<Group>)(from g in this.Groups where g.PartitionKey == groupPartitionKey & g.DisplayName.Contains(displayName) == true select g); return query; } This is the result of that query: http://127.0.0.1:8080/DataService/WcfDataService.svc/Groups()?$filter=PartitionKey

Relationship navigation in WCF Data Service with custom (object) data source

試著忘記壹切 提交于 2019-12-11 06:54:04
问题 I have 3 levels of hierarchy in my data: DepartmentList -> EmployeeCollection -> Employee Basically, there are a number departments, each containing a number of employees. Here is my source code: public class DataService : DataService<Departments> public class Departments { private List<Department> _deptCollection; public IQueryable<Department> DeptCollection { get { return this._deptCollection.AsQueryable(); } } ... ... } [DataServiceKey("DepartmentId")] public class Department { public