Remove the parameter from your method and make the expression accept two parameters:
public static Expression<Func<MyModel, DateTime, bool>> IsDateOf = (MyModel p, DateTime d) => p.StartedAt.AddSeconds(p.UtcOffset) == d.Date;
Note I have made it a static field, not a method. Then in your LINQ expression, you need to invoke it:
If you don't make it a field (or property), you have to first invoke the method to get the expression; then you need to invoke the expression:
Which, in my opinion, looks weird.
- How can I extract DbFunctions/SqlFunctions call into a resuable extension/method with EntityFramework 6.2?
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- Ambiguous call when using LINQ extension method on DbSet<T>
- Why can't I call an extension method from a base class of the extended type?
- Using Linq's Where/Select to filter out null and convert the type to non-nullable cannot be made into an extension method
- How to call extension method "ElementAt"of List<T> with reflection?
- Is there a clever way to call a type dependent extension method dynamically?
- Convert linq query expression with multiple froms into extension method syntax
- Conditionally call Linq extension method
- LINQ statement no longer works after being wrapped into an extension method
- Why the extension method of where for LINQ in this code would print out a single number while it shouldn't print anything at all?
- Why do I have to call the Cast<> extension method on a DataGridViewRow?
- Linq extension method equivalent for that code in VB.NET
- How to code an Or extension method
- c# Linq or code to extract groups from a single list of source data
- how to translate method call into lambda expression
- What is the use of Enumerable.Zip extension method in Linq?
- LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression
- Using LINQ extension method syntax on a MatchCollection
- IQueryable<T> does not contain a definition for 'Include' and no extension method 'Include'
- What is the performance of the Last() extension method for List<T>?
- LINQ SelectMany and Where extension method ignoring nulls
- How do I invoke an extension method using reflection?
- How to implement left join in JOIN Extension method
- LinqPad Linq Include() extension method is not found even after adding references
- LINQ to Entities does not recognize the method 'System.DateTime AddSeconds(Double)' method, and this method cannot be translated into
- Incorrect number of arguments supplied for call to method 'Boolean Equals
- LINQ Max extension method gives an error on empty collections
- Extension method for IQueryable left outer join using LINQ
- Average extension method in Linq for default value
- ASP.net cache access causing Collection Modified exception in foreach loop
- Getting an index was out of range exception with NHibernate
- select a data in a group which is the newest by linq
- Should I stick to LINQ in this simple case?
- How to get string list from a linq query?
- LINQ Entity Framework - COUNT AND QUERY
- Error: LINQ to Entities does not recognize the method
- EF one to many where condition
- How to remove duplicate combinations from a List<string> using LINQ
- linq join with groupby and max issues
- Linq GroupBy to switch dimensions
- Combine two rows of data using LINQ/SQL
- Avoiding SingleOrDefault null reference exception
- Mongodb, linq driver. How to construct Contains with variable or statements
- Linq join get latest value from second table
- IQueryable and sorting
- Linq - Select list of tags from a list objects, each containing a list of tags
- Get Nth item from SelectList
- Select First, Last, Min, Max Value based on Time From a List of Objects
- array.Contains() on Jagged array