WCF DataService with Custom Function and parameter


namespace Senthamil.Sample

{
    public class PORSS : DataService<ModelEntities>
    {
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
            // Examples:
            config.SetEntitySetAccessRule(“RSS_STATUS”, EntitySetRights.AllRead);
            config.SetServiceOperationAccessRule(“MyFunction”, ServiceOperationRights.All);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
        }

        [WebGet]
        public IQueryable<RSS_STATUS> MyFunction(string RefNumb)
        {
            ModelEntities MySource = new ModelEntities();
            return from c in MySource.RSS_STATUS
                   where c.SUB_SYSTEM_NUMBER == RefNumb
                   select c;
        }
    }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s