IDataServiceMetadataProvider Entities Missing in $metadata

Posted on
WCF Data Services

If you are following through the example on creating custom data service providers as on this blog:

And you notice that your entities are not showing up in the $metadata file, double check that you have added this:

public class service : MyNewDataService
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
            config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
Just remember to set the entity set access rules for all entities - other they won't show up!