[ https://issues.apache.org/jira/browse/IGNITE-13336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17243137#comment-17243137 ]
Pavel Tupitsyn commented on IGNITE-13336: ----------------------------------------- Merged to master: 2b2b07842ffc5512b0b1207ac4b03db887899862 > .NET: Misleading LINQ exception when expression can't be translated > ------------------------------------------------------------------- > > Key: IGNITE-13336 > URL: https://issues.apache.org/jira/browse/IGNITE-13336 > Project: Ignite > Issue Type: Bug > Components: platforms > Affects Versions: 2.8.1 > Reporter: Pavel Tupitsyn > Assignee: Sergey Stronchinskiy > Priority: Minor > Labels: .NET > Fix For: 2.10 > > Time Spent: 20m > Remaining Estimate: 0h > > The following program results in a cryptic exception, when the problem is > simply lack of Expression<> wrapper around the query filter: > {code} > class Program > { > private static readonly IIgnite Ignite = Ignition.Start(); > static void Main(string[] args) > { > var cache = GetCache<Foo>(); > cache["1"] = new Foo(); > var res = Where2<Foo>(e => e.Value.X == 0); > Console.WriteLine(res); > } > public static ICache<string, T> GetCache<T>() > { > var cacheName = typeof(T).Name; > var cfg = new CacheConfiguration(cacheName, new > QueryEntity(typeof(T))); > return Ignite.GetOrCreateCache<string, T>(cfg); > } > public static List<T> Where2<T>(Func<ICacheEntry<string, T>, bool> > query) > { > var queryResult = GetCache<T>().AsCacheQueryable().Where(x => > query(x)); > return queryResult.Select(x => x.Value).ToList(); > } > } > public class Foo > { > [QuerySqlField] public int X { get; set; } > } > {code} > We should throw a better exception that says "LINQ expression can't be > translated to SQL because of ..." -- This message was sent by Atlassian Jira (v8.3.4#803005)