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>
Have you tried using the fully qualified name?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With