using System;
using System.Data.Services;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Web;
using EntityFramework;
using EntityFramework.ReadWrite;

public class GridAdoNetDataService : DataService<NorthwindEntities35>
{    
    public static void InitializeService(IDataServiceConfiguration config)
    {        
         config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
         config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
    }

    [WebGet]
    public int GetCount(string where)
    {
        return String.IsNullOrEmpty(where) ? CurrentDataSource.Products.Count() :
            CurrentDataSource.Products.Where(where).Count();
    }

}
