Language: C#
.Where Clause parameter Expression<Func<T>> or Func<T>
// works as expected public wws_Item LoadBySku(string sku) { Expression< Func<wws_Item, bool> > func = itm => itm.Sku == sku; Entity = Context.wws_Items.Where(func).SingleOrDefault(); if (Entity != null) OnLoaded(Entity); return this.Entity; // return LoadBase(func); // works } // doesn't work (Entity is null) but compiles public wws_Item LoadBySku(string sku) { Func<wws_Item, bool> func = itm => itm.Sku == sku; Entity = Context.wws_Items.Where(func).SingleOrDefault(); if (Entity != null) OnLoaded(Entity); return this.Entity; // return LoadBase(func); // doesn't work }
Tags:
Description:
I guess I'm not sure why the Func<T> only parameters exist and if they ever would actually work? It seems it always requires an expression in order to run the L2S code.
Expressions only for L2S and Func<T> from LINQ to Objects?
Expressions only for L2S and Func<T> from LINQ to Objects?
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

