You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
3.3 KiB
JavaScript

12 months ago
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[1689],{7925:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>p,contentTitle:()=>t,default:()=>x,frontMatter:()=>o,metadata:()=>a,toc:()=>l});var r=s(5893),i=s(1151);const o={id:"linqexpression",title:"5. LinqExpression \u9759\u6001\u7c7b",sidebar_label:"5. LinqExpression \u9759\u6001\u7c7b"},t=void 0,a={id:"global/linqexpression",title:"5. LinqExpression \u9759\u6001\u7c7b",description:"5.1 \u521b\u5efa\u4e00\u4e2a\u8868\u8fbe\u5f0f",source:"@site/docs/global/linqexpression.mdx",sourceDirName:"global",slug:"/global/linqexpression",permalink:"/docs/global/linqexpression",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/global/linqexpression.mdx",tags:[],version:"current",lastUpdatedBy:"MonkSoul",lastUpdatedAt:1651894493,formattedLastUpdatedAt:"May 7, 2022",frontMatter:{id:"linqexpression",title:"5. LinqExpression \u9759\u6001\u7c7b",sidebar_label:"5. LinqExpression \u9759\u6001\u7c7b"},sidebar:"global",previous:{title:"4. Oops \u9759\u6001\u7c7b",permalink:"/docs/global/oops"},next:{title:"6. Http \u9759\u6001\u7c7b",permalink:"/docs/global/shttp"}},p={},l=[{value:"5.1 \u521b\u5efa\u4e00\u4e2a\u8868\u8fbe\u5f0f",id:"51-\u521b\u5efa\u4e00\u4e2a\u8868\u8fbe\u5f0f",level:2},{value:"5.2 \u62fc\u63a5\u4e24\u4e2a\u8868\u8fbe\u5f0f",id:"52-\u62fc\u63a5\u4e24\u4e2a\u8868\u8fbe\u5f0f",level:2}];function d(e){const n={code:"code",h2:"h2",pre:"pre",...(0,i.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"51-\u521b\u5efa\u4e00\u4e2a\u8868\u8fbe\u5f0f",children:"5.1 \u521b\u5efa\u4e00\u4e2a\u8868\u8fbe\u5f0f"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers ",children:"var expression = LinqExpression.Create<T>(u => u.Id == 1);\r\nvar expression2 = LinqExpression.Create<T>((u,i) => u.Id == 1 && i > 0);\n"})}),"\n",(0,r.jsx)(n.h2,{id:"52-\u62fc\u63a5\u4e24\u4e2a\u8868\u8fbe\u5f0f",children:"5.2 \u62fc\u63a5\u4e24\u4e2a\u8868\u8fbe\u5f0f"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers ",children:"// \u521b\u5efa\u4e00\u4e2a\u521d\u59cb\u5316\u7684\u8868\u8fbe\u5f0f\r\nvar expression = LinqExpression.And();\r\nvar expression2 = LinqExpression.IndexAnd();\r\nvar expression3 = LinqExpression.Or();\r\nvar expression4 = LinqExpression.IndexOr();\r\n\r\n// \u62fc\u63a5\u8868\u8fbe\u5f0f\r\nvar expression5 = expression.And(expression2);\r\nvar expression6 = expression.AndIf(age > 18, expression2);\r\nvar expression7 = expression.Or(expression2);\r\nvar expression8 = expression.OrIf(age > 18, expression2);\r\n\r\n// \u83b7\u53d6\u8868\u8fbe\u5f0f\u5c5e\u6027\u540d\r\nvar properyName = expression.GetExpressionPropertyName(u => u.Name); // Name\n"})})]})}function x(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},1151:(e,n,s)=>{s.d(n,{Z:()=>a,a:()=>t});var r=s(7294);const i={},o=r.createContext(i);function t(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:t(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]);