wcf-data-services

Exception handling with WCF Data Services

I want to customize exceptions/errors thrown from my WCF Data Service, so clients get as much as possible information about what exactly went wrong/what is missing. Any thoughts on how this could be achieved? ...

OData - Data Service Simple Authentication

Hello, I would like to add simple authentication to Data Services, for now only to restrict access for particular applications by simple token. I don't need Domain Authentication or Forms authentication. I read a lot about authentication here: http://franssenden.wordpress.com/2010/06/14/custom-security-odata-service-wcf-data-services...

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

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, 3...

Using enums in WCF Data Services

I'm trying to manually build a WCF Data Service using a POCO data model and I cannot figure out how to properly expose enum values. Assuming a simple model like: public class Order { public int ID {get; set;} public string Description {get; set;} public OrderStatus Status {get; set;} } public enum OrderStatus { New, InPr...

Entity Framework - Inserting records in child table when parent record already exists

Good afternoon- I am developing a Silverlight application using LINQ to Entity Framework for the data access layer. My n-tier database model includes about 30 or so tables, with a number of multi-leveled parent-child relationships throughout. Recently began writing my data services and unit tests and have discovered a problem with the...

How do I restrict access to a WCF Data Service to a specific user account?

I've read so many blog posts and articles that my eyes are getting blurry. I haven't yet found what I need (or I just don't understand what I'm doing, which is most likely). We have a WCF data service that we want to restrict access to. We want to put the web client in an app pool, and then only the app pool account should be able to us...

Custom property in partial class doesn't exist AFTER it's sent to client using WCF Data Services

So I have an Event class which is generated from Enitity Framework, I have extended what it generated in a partial like so: public partial class Event { [DataMemberAttribute()] public EventDate CurrentEventDate { get; set; } } When I use the custom property ON THE SERVER it's fine, example: [WebGet] public IQueryable<...

WCF Data Services and Projections. How to get the entity URI from an entity projection instance?

I'm using DataServiceContext to load some entity projections (entities have many properties, to minimize traffic I load only those properties, which are needed at the moment) like this: from x in ctx.Portfolios select new { Id = x.Id, Name = x.Name, PortfolioName = x.PortfolioName, Desc...

Is there a .NET class wrapper for the OData protocol Uri

Does anyone know if there an open-source .NET wrapper that can reliably parse the OData protocol Uri? I'm not looking for pointers to WCF Data Services... I'm creating a WCF-based data querying service that (for complicated reasons) cannot be a real Atom/OData service, but I really like the expressiveness of the OData Uri for identifyin...

WCF Data Service Proxy Class

I am pretty sure this is a stupid question, but here goes anyway. I have a WCF Data Service exposing an object, let's say Person. This Person object is in the namespace Domain.Person. I have a client with a proxy to the WCF Data Service. This client has code that works with the referenced Domain.Person class. However, the proxy is return...

How do I get Entity Framework 4 and WCF Data Services to work with Silverlight 3.0

I have a project that needs to be upgraded in stages. I need to implement Entity Framework v4 first and then eventually upgrade the Silverlight v3 application to v4. Unfortunately my client is not able to roll out Silverlight version 4 until for at least four months (they do want to move to v4 but they have to go though a company wide ...

Can you use WCF Data Services (ne OData, ne Astoria, ne ADO.NET Data Service) with NetTcpBinding?

I'm looking at creating a data query WCF service over a slow satellite connection and I really like WCF Data Services. The problem I see is that HTTP is a very verbose format and since everything I'm doing is internal and .NET, is it possible to use NetTcpBinding instead to reduce some of the overhead? Is this even possible? Advisable? ...

OData (WCF Data Service) with Subsonic 3

Hi all, I'm trying to use WCF Data Service with Subsonic, but ran into this error when I try to access my "service.svc". I have 2 projects, one is a class library (called "OData") that has Subsonic t4 templates to generate the classes for my table. Another is an ASP.NET MVC2 project that references to the "OData" project. I then create...

How do I buid a WCF Query on the fly?

I'd like to build some linq or alternatively, build a query string on the fly and pass it to a WCF Data Service (with Entity Framework data model). Something like this: public List<DocumentInformationRecord> SearchClientDocs(string clientCode, string clientName, string contactName, string groupCode, string groupName, ...

Intercept DataService Calls

I want to use Enterprise Library 5 and Unity to intercept calls made on some WCF Data Services. If I wanted to do this on a custom object I would have an IMyObject interface and a MyObject implementation. I would then include some config in my web.config along the lines of the following (I want to add performance counters in this instanc...

Set DataServiceHost DataService Context

Is there a way to set the context for your DataService in WCF Data Services? For example, say I have the following DataService: public class MyDataService : DataService<MyContext> Let's say MyContext has an interface of IMyContext and I obtain an instance of this during a custom DataServiceHostFactory's constructor by using Unity. So,...

custom error response in WCF data services

In my DataService derrived class I have overriden the HandleException method in order to do custom exception handling (simplified example): protected override void HandleException(HandleExceptionArgs args) { args.Exception = new DataServiceException( args.ResponseStatusCode, "RecordAlreadyExist", ...

OData WCF Data Services - Related data (by foreign key) doesn't show up when calling the service

When I get the data using the URL in browser, I'm able to see the related data, for example: http://localhost/services.svc/Dinners(1)/RSVPs That lists 5 RSVPs for DinnerId = 1 in my case, but when I'm consuming the OData from a different project, I can only retrieve Dinners, debugging the app shows that RSVPs = 0, while it should be 5....

How to disable unescaping of %2F in querystrings using WCF webHttpBinding

I'm calling into a WCF Data Service that passes parameters via query string. Sometimes, some of the keys contain special characters that are normally blocked, e.g. %2F (/) %5C (/) %23 (#) and so forth. The service returns a 400 when any of these characters are passed - even in their escaped format. The IIS tracelog shows the following...

WCF Data Services with Integrated Authentication issue

I have a web project that has Anonymous access and Integrated Windows authentication enabled. I built a WCF Data Service and since it allows only one authentication, I enabled Integrated authentication on the service. I am able to view the service in browser. However when I try to query the service for any Entity, it gives me Forbidden e...