{"id":3753,"date":"2014-03-30T05:12:09","date_gmt":"2014-03-30T05:12:09","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/nhlambdaextensions-create-a-criterion-object-to-add-to-icriteria-later-collection-of-common-programming-errors\/"},"modified":"2014-03-30T05:12:09","modified_gmt":"2014-03-30T05:12:09","slug":"nhlambdaextensions-create-a-criterion-object-to-add-to-icriteria-later-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/nhlambdaextensions-create-a-criterion-object-to-add-to-icriteria-later-collection-of-common-programming-errors\/","title":{"rendered":"NHLambdaExtensions: Create a Criterion object to add to ICriteria later-Collection of common programming errors"},"content":{"rendered":"<p>My application creates a dynamically generated query at runtime based on user input by creating Criterion objects e.g:<\/p>\n<pre><code>ICriterion criterion = Restrictions.Eq(\"Name\", \"John\");\n......\ndetachedCriteriaSomewhereElse.Add(criterion);\n<\/code><\/pre>\n<p>How do I do this in NHLambdaExtensions?<\/p>\n<p>what I really need to do is<\/p>\n<pre><code>ICriterion criterion = Restrictions.Eq(p=&gt;  p.Name == \"John\");\n<\/code><\/pre>\n<p>but this isn&#8217;t valid. Is there any way to do this?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My application creates a dynamically generated query at runtime based on user input by creating Criterion objects e.g: ICriterion criterion = Restrictions.Eq(&#8220;Name&#8221;, &#8220;John&#8221;); &#8230;&#8230; detachedCriteriaSomewhereElse.Add(criterion); How do I do this in NHLambdaExtensions? what I really need to do is ICriterion criterion = Restrictions.Eq(p=&gt; p.Name == &#8220;John&#8221;); but this isn&#8217;t valid. Is there any way to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3753","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3753"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3753\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}