The solution to my particular query was to do this:... var query = from pl in CurrentDataSource.ProductListing
join pla in CurrentDataSource.ProductListingAttribute
on new {pl.ProductID, pl.WebCategoryID, pl.ParentProductID}
equals new {pla.Pro...
Here's what I use to do this:...using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.Collections.ObjectModel;
namespace MyLibrary.Extensions
{
/// <summary>Defines extension methods for building and working with Expressions.</summary>
public static class Expressio...
You are generating the following code:...persons.Where((Person p) => p.Age > 30)
...persons... is of type ...IEnumerable<IPerson>..., which can't be cast to ...IEnumerable<Person...>. What you want is to add a call to ...Queryable.Cast... to cast the ...IPerson... objects to ...Person...:...persons.Cast<Person>().Where(p => p.Age > 30)
...Use the ...
Are ...dynamic... members incompatible with Dynamic Linq queries?, or is there another way of constructing expressions that would evaluate properly when dealing with members of type ...dynamic...?...Both can work together. Just do a conversion to Int32 before doing the comparison like so:...IEnumerable<DataItem> result =
repository.AsQu...
So I think this is the answer then:...
The name you use in the Where clause must be a property of the object which you have in the Queryable collection.
Have you tried checking the ...searchField... for null before passing it to ....ToString()...
So do something like:...foreach (var searchField in searchFields)
{
products = products.Where(searchField + " != null && " + searchField + ".ToString() == @0", searchText);
}
It looks like what you need is ...IndexOf.... This returns the starting index of the substring, if it exists, otherwise -1....var.Contains("abc") && var.Contains("def") &&
var.IndexOf("abc") > var.IndexOf("def")
...For example, if we use the string ...XabcXdefXabc..., ...var.IndexOf("abc")... will yield ...1... and ...var.IndexOf("def")... will...
Since there is no LIKE operator in Dynamic Linq library, I have created it my own version. The code is not pretty, but it does work. Hopefully someone can optimize it or suggest a better way to do this....public string ParseWildcardInParameterString(string parameter, string propertyName)
{
string stringWithWildcard = parameter;
if (paramete...