Note that there are some explanatory texts on larger screens.

plurals
  1. PO"Only arguments that can be evaluated on the client are supported for the String.Contains method"
    text
    copied!<pre><code>public static void MyFunction(MyErrorClass err) { var query = from filter in DataContext.ErrorFilters select filter; query = query.Where(f =&gt; err.ErrorMessage.Contains(f.ErrorMessage)); List&lt;ErrorFilter&gt; filters = query.ToList(); //...more code } </code></pre> <p>So I'm having some issues with the above code, and I'm getting the error from the subject line at the line with <code>query.ToList()</code>. Here's what I'm trying to do:</p> <p>First off, I have a custom error class, <code>MyErrorClass</code>. Whenever an error occurs on my site, I create a <code>MyErrorClass</code> object from the exception, store all the data from the exception in that object, and store the information in the database.</p> <p>One of the exception properties I am keeping track of is the message for the error (<code>ErrorMessage</code>). I have an <code>ErrorFilters</code> table set up in the database where the user can filter errors based on the <code>ErrorMessage</code>. So say you are getting a ton of errors that say "System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.", and you want to ignore them. You just add a filter to the database with the ErrorMessage as "timeout expired", and set it to ignore.</p> <p>Now, my class above is set to take an error, and decide if the error should be filtered. I'm trying to get a list of all filters that have an <code>ErrorMessage</code> matching that of the error.</p> <p>I'm sure this is an easy fix, I just don't know how to fix it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload