OData and Entity Framework are suppose to work well together, in that OData options will be passed to the EF db context to filter queries - ie. return only the number of records
You don't mix and match QueryableAttribute and ODataQueryOptions. Pick one depending on whether you want manual control over applying the query options (ODataQueryOptions) or make it happen automatically (QueryableAttribute).
You have two options,
public IEnumerable Get(ODataQueryOptions options)
{
var dbContext = new ATMS.DAL.AtmsContext();
var ret = options.ApplyTo(dbContext.USERS).Cast();
return ret;
}
or
[Queryable]
public IEnumerable Get(ODataQueryOptions options)
{
var dbContext = new ATMS.DAL.AtmsContext();
var ret = dbContext.USERS;
return ret;
}
The reason you are seeing that behavior is that you are applying the query twice, once using ODataQueryOptions and then again through QueryableAttribute.