You can use compiled queries: see here or here
static readonly Func<AdventureWorksEntities, Decimal, IQueryable<SalesOrderHeader>> s_compiledQuery2 = CompiledQuery.Compile<AdventureWorksEntities, Decimal, IQueryable<SalesOrderHeader>>( (ctx, total) => from order in ctx.SalesOrderHeaders where order.TotalDue >= total select order);
But as mentioned here , the request object should not go beyond. You can handle this either by storing it in the cache in the session, or as an application variable.
source share