Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 322
Chris Wenham Avatar asked Mar 29 '11 15:03

Chris Wenham


1 Answers

Have you tried using the fully qualified name?

like image 96
CodingGorilla Avatar answered Oct 03 '22 02:10

CodingGorilla