WCF Data Services Error "The given name" Foo "was not found in the object sets"

I am creating a WCF data service to open a database. I want to grant access to one of the tables (call it "Foo"), so I put this in InitializeServicemy method DatabaseService.svc.cs:

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

However, when the service is initialized, it displays a message ArgumentExceptionwith the message "This name" Foo "was not found in entity sets."

The table is definitely located in the .edmx file with that name, case, and correct spelling. It is also in the file .Designer.cs, for example:

[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>
+5
source share
1

?

+5

All Articles