Chris Wenham
Chris Wenham

Reputation: 24017

WCF Data Services error "The given name 'Foo' was not found in the entity sets"

I'm developing a WCF Data Service to expose a database. I want to provide access to one of the tables (call it 'Foo'), so I put this in the InitializeService method of my DatabaseService.svc.cs:

config.SetEntitySetAccessRule("Foo", EntitySetRights.AllRead);

However, when the service is initialized it throws an ArgumentException with the message "The given name 'Foo' was not found in the entity sets."

The table is definitely in the .edmx file with that name, case and spelling correct. It's also in the .Designer.cs file, like this:

[EdmEntityTypeAttribute(NamespaceName="FooDBModel", Name="Foo")]
[Serializable()]
[DataContractAttribute(IsReference=true)]
public partial class Foo : EntityObject

The service class itself is declared as:

public class FooDatabaseService : DataService<FooDBEntities>

Upvotes: 6

Views: 3165

Answers (1)

CodingGorilla
CodingGorilla

Reputation: 19842

Have you tried using the fully qualified name?

Upvotes: 5

Related Questions