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.7 KiB
JavaScript

"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[3202],{7474:(a,e,t)=>{t.r(e),t.d(e,{assets:()=>d,contentTitle:()=>i,default:()=>u,frontMatter:()=>n,metadata:()=>o,toc:()=>s});var l=t(5893),r=t(1151);const n={id:"datavalidator",title:"3. DataValidator \u9759\u6001\u7c7b",sidebar_label:"3. DataValidator \u9759\u6001\u7c7b"},i=void 0,o={id:"global/datavalidator",title:"3. DataValidator \u9759\u6001\u7c7b",description:"3.1 \u9a8c\u8bc1\u5bf9\u8c61\u6570\u636e",source:"@site/docs/global/datavalidator.mdx",sourceDirName:"global",slug:"/global/datavalidator",permalink:"/docs/global/datavalidator",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/global/datavalidator.mdx",tags:[],version:"current",lastUpdatedBy:"MonkSoul",lastUpdatedAt:1651894493,formattedLastUpdatedAt:"May 7, 2022",frontMatter:{id:"datavalidator",title:"3. DataValidator \u9759\u6001\u7c7b",sidebar_label:"3. DataValidator \u9759\u6001\u7c7b"},sidebar:"global",previous:{title:"2. Db \u9759\u6001\u7c7b",permalink:"/docs/global/db"},next:{title:"4. Oops \u9759\u6001\u7c7b",permalink:"/docs/global/oops"}},d={},s=[{value:"3.1 \u9a8c\u8bc1\u5bf9\u8c61\u6570\u636e",id:"31-\u9a8c\u8bc1\u5bf9\u8c61\u6570\u636e",level:2},{value:"3.2 \u9a8c\u8bc1\u5355\u4e2a\u503c",id:"32-\u9a8c\u8bc1\u5355\u4e2a\u503c",level:2},{value:"3.3 \u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\u5355\u4e2a\u503c",id:"33-\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\u5355\u4e2a\u503c",level:2},{value:"3.4 \u9a8c\u8bc1\u7c7b\u578b\u9a8c\u8bc1\u5355\u4e2a\u503c",id:"34-\u9a8c\u8bc1\u7c7b\u578b\u9a8c\u8bc1\u5355\u4e2a\u503c",level:2}];function c(a){const e={code:"code",h2:"h2",pre:"pre",...(0,r.a)(),...a.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(e.h2,{id:"31-\u9a8c\u8bc1\u5bf9\u8c61\u6570\u636e",children:"3.1 \u9a8c\u8bc1\u5bf9\u8c61\u6570\u636e"}),"\n",(0,l.jsx)(e.pre,{children:(0,l.jsx)(e.code,{className:"language-cs",metastring:"showLineNumbers ",children:"var result = DataValidator.TryValidateObject(obj);\n"})}),"\n",(0,l.jsx)(e.h2,{id:"32-\u9a8c\u8bc1\u5355\u4e2a\u503c",children:"3.2 \u9a8c\u8bc1\u5355\u4e2a\u503c"}),"\n",(0,l.jsx)(e.pre,{children:(0,l.jsx)(e.code,{className:"language-cs",metastring:"showLineNumbers ",children:"var result = DataValidator.TryValidateValue(value, typeof(RequiredAttribure), typeof(RangeAttribute));\n"})}),"\n",(0,l.jsx)(e.h2,{id:"33-\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\u5355\u4e2a\u503c",children:"3.3 \u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\u5355\u4e2a\u503c"}),"\n",(0,l.jsx)(e.pre,{children:(0,l.jsx)(e.code,{className:"language-cs",metastring:"showLineNumbers ",children:'var result = DataValidator.TryValidateValue(value,"\u6b63\u5219\u8868\u8fbe\u5f0f");\n'})}),"\n",(0,l.jsx)(e.h2,{id:"34-\u9a8c\u8bc1\u7c7b\u578b\u9a8c\u8bc1\u5355\u4e2a\u503c",children:"3.4 \u9a8c\u8bc1\u7c7b\u578b\u9a8c\u8bc1\u5355\u4e2a\u503c"}),"\n",(0,l.jsx)(e.pre,{children:(0,l.jsx)(e.code,{className:"language-cs",metastring:"showLineNumbers ",children:"var result = DataValidator.TryValidateValue(value, ValidationTypes.Number);\r\n\r\nvar result2 = DataValidator.TryValidateValue(value, ValidationPattern.AllOfThem, ValidationTypes.Number, ValidationTypes.Required);\n"})})]})}function u(a={}){const{wrapper:e}={...(0,r.a)(),...a.components};return e?(0,l.jsx)(e,{...a,children:(0,l.jsx)(c,{...a})}):c(a)}},1151:(a,e,t)=>{t.d(e,{Z:()=>o,a:()=>i});var l=t(7294);const r={},n=l.createContext(r);function i(a){const e=l.useContext(n);return l.useMemo((function(){return"function"==typeof a?a(e):{...e,...a}}),[e,a])}function o(a){let e;return e=a.disableParentContext?"function"==typeof a.components?a.components(r):a.components||r:i(a.components),l.createElement(n.Provider,{value:e},a.children)}}}]);