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

"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[5869],{4838:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>x,contentTitle:()=>o,default:()=>p,frontMatter:()=>a,metadata:()=>h,toc:()=>j});var r=i(5893),s=i(1151),l=i(510),d=i(4996),t=i(4866),c=i(5162);const a={id:"data-validation",title:"8. \u6570\u636e\u6821\u9a8c",sidebar_label:"8. \u6570\u636e\u6821\u9a8c"},o=void 0,h={id:"data-validation",title:"8. \u6570\u636e\u6821\u9a8c",description:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7",source:"@site/docs/data-validation.mdx",sourceDirName:".",slug:"/data-validation",permalink:"/docs/data-validation",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/data-validation.mdx",tags:[],version:"current",lastUpdatedBy:"\u767e\u5c0f\u50e7",lastUpdatedAt:1693503874,formattedLastUpdatedAt:"Aug 31, 2023",frontMatter:{id:"data-validation",title:"8. \u6570\u636e\u6821\u9a8c",sidebar_label:"8. \u6570\u636e\u6821\u9a8c"},sidebar:"docs",previous:{title:"7. \u53cb\u597d\u5f02\u5e38\u5904\u7406",permalink:"/docs/friendly-exception"},next:{title:"9. \u6570\u636e\u5e93\u64cd\u4f5c\u6307\u5357\uff08EFCore\uff09",permalink:"/docs/category/efcore"}},x={},j=[{value:"8.1 \u5173\u4e8e\u6570\u636e\u6821\u9a8c",id:"81-\u5173\u4e8e\u6570\u636e\u6821\u9a8c",level:2},{value:"8.2 \u6570\u636e\u6821\u9a8c\u7684\u597d\u5904",id:"82-\u6570\u636e\u6821\u9a8c\u7684\u597d\u5904",level:2},{value:"8.3 \u6570\u636e\u6821\u9a8c\u65b9\u5f0f",id:"83-\u6570\u636e\u6821\u9a8c\u65b9\u5f0f",level:2},{value:"8.3.1 \u4f20\u7edf\u65b9\u5f0f",id:"831-\u4f20\u7edf\u65b9\u5f0f",level:3},{value:"8.3.2 <code>Mvc</code> \u7279\u6027\u65b9\u5f0f",id:"832-mvc-\u7279\u6027\u65b9\u5f0f",level:3},{value:"8.4 <code>DataValidation</code> \u9a8c\u8bc1 \ud83e\udd17",id:"84-datavalidation-\u9a8c\u8bc1-",level:2},{value:"8.4.1 <code>DataValidation</code> \u4f18\u70b9",id:"841-datavalidation-\u4f18\u70b9",level:3},{value:"8.5 <code>DataValidation</code> \u4f7f\u7528",id:"85-datavalidation-\u4f7f\u7528",level:2},{value:"8.5.1 \u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1",id:"851-\u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1",level:3},{value:"8.5.2 \u517c\u5bb9 <code>Mvc</code> \u7279\u6027\u9a8c\u8bc1",id:"852-\u517c\u5bb9-mvc-\u7279\u6027\u9a8c\u8bc1",level:3},{value:"8.5.3 \u517c\u5bb9 <code>Mvc</code> \u590d\u6742\u9a8c\u8bc1",id:"853-\u517c\u5bb9-mvc-\u590d\u6742\u9a8c\u8bc1",level:3},{value:"8.6 \u624b\u52a8\u9a8c\u8bc1",id:"86-\u624b\u52a8\u9a8c\u8bc1",level:2},{value:"8.6.1 \u9a8c\u8bc1\u6a21\u578b",id:"861-\u9a8c\u8bc1\u6a21\u578b",level:3},{value:"8.6.2 <code>TryValidate</code> \u548c <code>Validate</code>",id:"862-tryvalidate-\u548c-validate",level:3},{value:"8.6.3 <code>ValidationTypes</code> \u5e38\u89c1\u9a8c\u8bc1",id:"863-validationtypes-\u5e38\u89c1\u9a8c\u8bc1",level:3},{value:"8.6.4 <code>[DataValidation]</code> \u7279\u6027",id:"864-datavalidation-\u7279\u6027",level:3},{value:"8.6.5 <code>[ModelBinder]</code> \u7279\u6027",id:"865-modelbinder-\u7279\u6027",level:3},{value:"8.7 <code>[NonValidation]</code> \u8df3\u8fc7\u9a8c\u8bc1",id:"87-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1",level:2},{value:"8.8 \u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c",id:"88-\u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c",level:2},{value:"8.8.1 \u81ea\u5b9a\u4e49 <code>ValidationTypes</code> \u7c7b\u578b",id:"881-\u81ea\u5b9a\u4e49-validationtypes-\u7c7b\u578b",level:3},{value:"8.8.2 \u81ea\u5b9a\u4e49 <code>ValidationTypes</code> \u5931\u8d25\u6d88\u606f",id:"882-\u81ea\u5b9a\u4e49-validationtypes-\u5931\u8d25\u6d88\u606f",level:3},{value:"\u9519\u8bef\u6d88\u606f\u67e5\u627e\u4f18\u5148\u7ea7",id:"\u9519\u8bef\u6d88\u606f\u67e5\u627e\u4f18\u5148\u7ea7",level:4},{value:"8.9 \u6a21\u578b\u9a8c\u8bc1\u8303\u56f4",id:"89-\u6a21\u578b\u9a8c\u8bc1\u8303\u56f4",level:2},{value:"8.9.1 \u5168\u5c40\u9a8c\u8bc1",id:"891-\u5168\u5c40\u9a8c\u8bc1",level:3},{value:"8.9.2 <code>[NonValidation]</code> \u8df3\u8fc7\u9a8c\u8bc1",id:"892-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1",level:3},{value:"8.9.3 <code>[TypeFilter(typeof(DataValidationFilter))]</code> \u5c40\u90e8\u9a8c\u8bc1",id:"893-typefiltertypeofdatavalidationfilter-\u5c40\u90e8\u9a8c\u8bc1",level:3},{value:"8.9.4 <code>[ApiController]</code> \u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1",id:"894-apicontroller-\u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1",level:3},{value:"8.10 <code>MiniProfiler</code> \u67e5\u770b",id:"810-miniprofiler-\u67e5\u770b",level:2},{value:"8.11 \u591a\u8bed\u8a00\u652f\u6301",id:"811-\u591a\u8bed\u8a00\u652f\u6301",level:2},{value:"8.12 \u96c6\u6210 <code>FluentValidation</code> \u7b2c\u4e09\u65b9\u6821\u9a8c",id:"812-\u96c6\u6210-fluentvalidation-\u7b2c\u4e09\u65b9\u6821\u9a8c",level:2},{value:"8.12.1 \u5b89\u88c5 <code>FluentValidation.AspNetCore</code> \u62d3\u5c55\u5305",id:"8121-\u5b89\u88c5-fluentvalidationaspnetcore-\u62d3\u5c55\u5305",level:3},{value:"8.12.2 \u5728 <code>Startup.cs</code> \u4e2d\u6ce8\u518c",id:"8122-\u5728-startupcs-\u4e2d\u6ce8\u518c",level:3},{value:"8.12.3 \u4f7f\u7528\u4f8b\u5b50",id:"8123-\u4f7f\u7528\u4f8b\u5b50",level:3},{value:"8.13 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"813-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function u(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",mdxAdmonitionTitle:"mdxAdmonitionTitle",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,s.a)(),...e.components},{Details:i}=n;return i||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(i,{children:[(0,r.jsx)("summary",{children:"\ud83d\udcdd \u6a21\u5757\u66f4\u65b0\u65e5\u5fd7"}),(0,r.jsx)("div",{children:(0,r.jsx)("div",{children:(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"\u65b0\u7279\u6027"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\xa0",(0,r.jsx)(l.Z,{children:"\u65b0\u589e"})," \u9a8c\u8bc1\u7279\u6027 ",(0,r.jsx)(n.code,{children:"[DataValidation]"})," \u652f\u6301 ",(0,r.jsx)(n.code,{children:"[Display]"})," \u548c ",(0,r.jsx)(n.code,{children:"[DisplayName]"})," \u7279\u6027\u8bbe\u7f6e ",(0,r.jsx)(n.code,{children:"{0}"})," ",(0,r.jsx)("sup",{children:"4.8.8.42"})," ",(0,r.jsx)("sup",{children:"\u23f1\ufe0f2023.09.01"})," ",(0,r.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I7XB3T",children:"#I7XB3T"})]}),"\n",(0,r.jsxs)(n.li,{children:["\xa0",(0,r.jsx)(l.Z,{children:"\u65b0\u589e"})," ",(0,r.jsx)(n.code,{children:"ValidationTypes"})," \u66f4\u591a\u5e38\u89c1\u9a8c\u8bc1\u683c\u5f0f\uff08",(0,r.jsx)(n.code,{children:"\u624b\u673a\u673a\u8eab\u7801\u7c7b\u578b"}),"\uff0c",(0,r.jsx)(n.code,{children:"\u7edf\u4e00\u793e\u4f1a\u4fe1\u7528\u4ee3\u7801"}),"\uff0c",(0,r.jsx)(n.code,{children:"GUID/UUID"}),"\uff0c",(0,r.jsx)(n.code,{children:"base64"}),"\uff09 ",(0,r.jsx)("sup",{children:"4.8.3.6"})," ",(0,r.jsx)("sup",{children:"\u23f1\ufe0f2022.12.13"})," ",(0,r.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/commit/3680d7a7a53515dfb78625f2c6a393a788025685",children:"3680d7a"})]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"\u95ee\u9898\u4fee\u590d"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\xa0",(0,r.jsx)(l.Z,{children:"\u4fee\u590d"})," \u6570\u636e\u9a8c\u8bc1 ",(0,r.jsx)(n.code,{children:"ValiationTypes.GUID_OR_UUID"})," \u4e0d\u652f\u6301\u5927\u5199\u95ee\u9898 ",(0,r.jsx)("sup",{children:"4.8.7.14"})," ",(0,r.jsx)("sup",{children:"\u23f1\ufe0f2023.03.16"})," ",(0,r.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/I6NP22",children:"#I6NP22"})]}),"\n"]}),"\n"]}),"\n"]})})})]}),"\n","\n","\n",(0,r.jsx)(n.h2,{id:"81-\u5173\u4e8e\u6570\u636e\u6821\u9a8c",children:"8.1 \u5173\u4e8e\u6570\u636e\u6821\u9a8c"}),"\n",(0,r.jsx)(n.p,{children:"\u6570\u636e\u6821\u9a8c\u5b57\u9762\u4e0a\u7684\u610f\u601d\u5c31\u662f\u5bf9\u4f7f\u7528\u8005\u63d0\u4ea4\u8fc7\u6765\u7684\u6570\u636e\u8fdb\u884c\u5408\u6cd5\u6027\u9a8c\u8bc1\u3002\u5728\u4e00\u5957\u5b8c\u5584\u7684\u5e94\u7528\u7cfb\u7edf\u4e2d\uff0c\u6570\u636e\u6709\u6548\u6027\u6821\u9a8c\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u4e1a\u52a1\u5904\u7406\u7b2c\u4e00\u9053\u5173\u5361\u3002"}),"\n",(0,r.jsx)(n.h2,{id:"82-\u6570\u636e\u6821\u9a8c\u7684\u597d\u5904",children:"8.2 \u6570\u636e\u6821\u9a8c\u7684\u597d\u5904"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u8fc7\u6ee4\u4e0d\u5b89\u5168\u6570\u636e\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u5b89\u5168\u6027"}),"\n",(0,r.jsx)(n.li,{children:"\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u4e1a\u52a1\u5f02\u5e38\u5904\u7406\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u54cd\u5e94\u901f\u5ea6"}),"\n",(0,r.jsx)(n.li,{children:"\u5927\u5927\u63d0\u9ad8\u7cfb\u7edf\u7a33\u5b9a\u6027"}),"\n",(0,r.jsx)(n.li,{children:"\u5927\u6570\u636e\u5e76\u53d1\u65f6\u8d77\u7740\u4e00\u5b9a\u7684\u7f13\u51b2\u4f5c\u7528"}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"83-\u6570\u636e\u6821\u9a8c\u65b9\u5f0f",children:"8.3 \u6570\u636e\u6821\u9a8c\u65b9\u5f0f"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u4f20\u7edf\u65b9\u5f0f\uff0c\u5728\u4e1a\u52a1\u4ee3\u7801\u4e4b\u524d\u624b\u52a8\u9a8c\u8bc1"}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Mvc"})," \u7279\u6027\u65b9\u5f0f\uff0c",(0,r.jsx)(n.code,{children:"Mvc"})," \u5185\u7f6e\u7684 ",(0,r.jsx)(n.code,{children:"DataAnnotations"})," \u65b9\u5f0f"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"\u63a8\u8350\u65b9\u5f0f"}),"\uff0c",(0,r.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u5185\u7f6e\u7684 ",(0,r.jsx)(n.code,{children:"DataValidation"})," \u9a8c\u8bc1"]}),"\n",(0,r.jsxs)(n.li,{children:["\u5176\u4ed6\u65b9\u5f0f\uff0c\u4f7f\u7528\u7b2c\u4e09\u65b9\u9a8c\u8bc1\u5e93\uff0c\u5982 ",(0,r.jsx)(n.code,{children:"FluentValidation"})]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"831-\u4f20\u7edf\u65b9\u5f0f",children:"8.3.1 \u4f20\u7edf\u65b9\u5f0f"}),"\n",(0,r.jsx)(n.p,{children:"\u5728\u5f88\u591a\u8001\u9879\u76ee\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u770b\u5230\u8fd9\u6837\u7684\u4ee3\u7801\uff1a"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {4,9,14}",children:'public bool Insert(Person person)\r\n{\r\n // \u9a8c\u8bc1\u53c2\u6570\r\n if(string.IsNullOrEmty(person.Name))\r\n {\r\n throw new System.Exception("\u540d\u5b57\u4e0d\u80fd\u4e3a\u7a7a");\r\n }\r\n\r\n if(person.Age < 18)\r\n {\r\n throw new System.Exception("\u5e74\u9f84\u4e0d\u80fd\u5c0f\u4e8e 18 \u5c81");\r\n }\r\n\r\n if(!person.Password.Equals(person.ConfirmPassword)\r\n {\r\n throw new System.Exception("\u4e24\u6b21\u5bc6\u7801\u4e0d\u4e00\u81f4");\r\n }\r\n\r\n // \u4e1a\u52a1\u4ee3\u7801\r\n _repository.Insert(person.Adapt<PersonEntity>());\r\n\r\n // ...\r\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:["\u4ece\u4e0a\u9762\u7684\u4ee3\u7801\u770b\u8d77\u6765\uff0c\u4f3c\u4e4e\u6ca1\u6709\u4ec0\u4e48\u4e0d\u59a5\uff0c\u4f46\u662f\u4ece\u4e00\u4e2a\u7a0b\u5e8f\u53ef\u7ef4\u62a4\u6027\u6765\u8bf4\uff0c\u8fd9\u662f\u4e00\u4e2a\u7cdf\u7cd5\u7684\u4ee3\u7801\uff0c\u56e0\u4e3a\u8be5\u4e1a\u52a1\u4ee3\u7801\u4e2d",(0,r.jsx)(n.strong,{children:"\u5305\u542b\u4e86\u592a\u591a\u4e0e\u4e1a\u52a1\u65e0\u5173\u7684\u6570\u636e\u9a8c\u8bc1"}),"\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u8bd5\u60f3\u4e00\u4e0b\uff0c\u5982\u679c\u8fd9\u4e2a ",(0,r.jsx)(n.code,{children:"Person"})," \u6709 \u51e0\u5341\u4e2a\u53c2\u6570\u90fd\u9700\u8981\u9a8c\u8bc1\u5462\uff1f\u53ef\u60f3\u800c\u77e5\uff0c\u8fd9\u662f\u4e00\u4e2a\u5e9e\u5927\u7684\u4e1a\u52a1\u4ee3\u7801\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u518d\u8005\uff0c\u5982\u679c\u5176\u4ed6\u5730\u65b9\u4e5f\u9700\u8981\u7528\u5230\u8fd9\u4e2a ",(0,r.jsx)(n.code,{children:"Person"})," \u7c7b\u9a8c\u8bc1\u5462\uff1f\u90a3\u4ee3\u7801\u597d\u6bd4\u8001\u9f20\u5543\u8fc7\u7684\u9762\u5305\u5c51\u4e00\u6837\uff0c\u5230\u5904\u90fd\u662f\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5982\u6b64\u5f97\u77e5\uff0c\u8fd9\u6837\u7684\u65b9\u5f0f\u662f\u6781\u5176\u4e0d\u63a8\u8350\u7684\uff0c",(0,r.jsx)(n.strong,{children:"\u4e0d\u4f46\u6c61\u67d3\u4e86\u4e1a\u52a1\u4ee3\u7801\uff0c\u4e5f\u7834\u574f\u4e86\u4e1a\u52a1\u804c\u8d23\u5355\u4e00\u6027\u539f\u7406\uff0c\u4e5f\u8ba9\u9a8c\u8bc1\u903b\u8f91\u65e0\u6cd5\u5b9e\u73b0\u901a\u7528\uff0c\u540e\u7eed\u7ef4\u62a4\u96be\u5ea6\u5927\u5927\u5347\u7ea7"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"832-mvc-\u7279\u6027\u65b9\u5f0f",children:["8.3.2 ",(0,r.jsx)(n.code,{children:"Mvc"})," \u7279\u6027\u65b9\u5f0f"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:"ASP.NET Core"})," \u4e2d\uff0c\u5fae\u8f6f\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u5168\u65b0\u7684 ",(0,r.jsx)(n.code,{children:"\u7279\u6027"})," \u9a8c\u8bc1\u65b9\u5f0f\uff0c\u53ef\u901a\u8fc7\u5bf9\u5bf9\u8c61\u8d34\u7279\u6027\u5b9e\u73b0\u6570\u636e\u9a8c\u8bc1\u3002\u8fd9\u79cd\u65b9\u5f0f\u6709\u6548\u7684\u5c06\u6570\u636e\u6821\u9a8c\u548c\u4e1a\u52a1\u4ee3\u7801\u5265\u79bb\u5f00\u6765\uff0c\u800c\u4e14\u5bb9\u6613\u4f7f\u7528\u548c\u62d3\u5c55\u3002"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"\u5728\u6a21\u578b\u4e2d\u9a8c\u8bc1"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,7-8,11-12}",children:"using System.ComponentModel.DataAnnotations;\r\n\r\nnamespace Hoa.Application.Authorization.Dtos\r\n{\r\n public class SignInInput\r\n {\r\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\r\n [MinLength(4)] // \u6700\u5c0f\u957f\u5ea6\u9a8c\u8bc1\r\n public string Account { get; set; }\r\n\r\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\r\n [MaxLength(32)] // \u6700\u5927\u957f\u5ea6\u9a8c\u8bc1\r\n public string Password { get; set; }\r\n }\r\n}\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"\u5728\u53c2\u6570\u4e2d\u9a8c\u8bc1"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2-3,8-9,12-13}",children:'public void CheckMethodParameterValid(\r\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\r\n [MinLength(4)] // \u6700\u5c0f\u957f\u5ea6\u9a8c\u8bc1\r\n string name,\r\n\r\n int age,\r\n\r\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\r\n [RegularExpression("[a-zA-Z0-9_]{8,30}") // \u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\r\n string password,\r\n\r\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\r\n [RegularExpression("[a-zA-Z0-9_]{8,30}") // \u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\r\n string confirmPassword\r\n)\r\n{\r\n // TODO\r\n}\n'})}),"\n",(0,r.jsx)(n.admonition,{title:"\u5c0f\u63d0\u9192",type:"note",children:(0,r.jsx)(n.p,{children:"\u5982\u679c\u51fd\u6570\u7684\u53c2\u6570\u5927\u4e8e\u6216\u7b49\u4e8e 3 \u4e2a\uff0c\u5efa\u8bae\u62bd\u79bb\u51fa\u6a21\u578b\u7c7b\uff0c\u4e5f\u5c31\u662f\u4e0d\u5efa\u8bae\u4e0a\u9762\u7684\u65b9\u5f0f\u3002"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:[(0,r.jsx)(n.code,{children:"Mvc"})," \u5185\u7f6e\u7279\u6027"]})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[ValidateNever]"}),"\uff1a\u6307\u793a\u719f\u6089\u6216\u53c2\u6570\u4ece\u9a8c\u8bc1\u4e2d\u6392\u9664"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[CreditCard]"}),"\uff1a\u4fe1\u7528\u5361\u683c\u5f0f\u9a8c\u8bc1"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[Compare]"}),"\uff1a\u9a8c\u8bc1\u4e24\u4e2a\u5c5e\u6027\u503c\u662f\u5426\u5339\u914d"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[EmailAddress]"}),"\uff1a\u9a8c\u8bc1\u7535\u5b50\u90ae\u7bb1"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[Phone]"}),"\uff1a\u9a8c\u8bc1\u7535\u8bdd\u53f7\u7801"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[Range]"}),"\uff1a\u9a8c\u8bc1\u6307\u5b9a\u8303\u56f4"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[RegularExpression]"}),"\uff1a\u9a8c\u8bc1\u5c5e\u6027\u503c\u662f\u5426\u5339\u914d\u6b63\u5219\u8868\u8fbe\u5f0f"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[Required]"}),"\uff1a\u9a8c\u8bc1\u4e0d\u4e3a null"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[StringLength]"}),"\uff1a\u9a8c\u8bc1\u5b57\u7b26\u4e32\u957f\u5ea6"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[URL]"}),"\uff1a\u9a8c\u8bc1\u662f\u5426\u6709\u6548\u7684 ",(0,r.jsx)(n.code,{children:"URL"})," \u683c\u5f0f"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[Remote]"}),"\uff1a\u8c03\u7528\u8fdc\u7a0b\u670d\u52a1\u5730\u5740\u8fdb\u884c\u5ba2\u6237\u7aef\u9a8c\u8bc1"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(n.admonition,{type:"tip",children:[(0,r.jsxs)(n.mdxAdmonitionTitle,{children:[(0,r.jsx)(n.code,{children:"Mvc"})," \u5185\u7f6e\u7279\u6027"]}),(0,r.jsxs)(n.p,{children:["\u60f3\u4e86\u89e3 ",(0,r.jsx)(n.code,{children:"Mvc"})," \u5185\u7f6e\u7279\u6027\u5217\u8868\u53ef\u67e5\u770b\u5b98\u65b9\u6587\u6863 ",(0,r.jsx)(n.a,{href:"https://docs.microsoft.com/zh-cn/aspnet/core/mvc/models/validation?view=aspnetcore-6.0",children:"ASP.NET Core - \u6a21\u578b\u9a8c\u8bc1"})]})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"\u81ea\u5b9a\u4e49\u7279\u6027\u9a8c\u8bc1"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,13-24}",children:'public class ClassicMovieAttribute : ValidationAttribute\r\n{\r\n public ClassicMovieAttribute(int year)\r\n {\r\n Year = year;\r\n }\r\n\r\n public int Year { get; }\r\n\r\n public string GetErrorMessage() =>\r\n $"Classic movies must have a release year no later than {Year}.";\r\n\r\n protected override ValidationResult IsValid(object value, ValidationContext validationContext)\r\n {\r\n var movie = (Movie)validationContext.ObjectInstance;\r\n var releaseYear = ((DateTime)value).Year;\r\n\r\n if (movie.Genre == Genre.Classic && releaseYear > Year)\r\n {\r\n return new ValidationResult(GetErrorMessage());\r\n }\r\n\r\n return ValidationResult.Success;\r\n }\r\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsxs)(n.strong,{children:[(0,r.jsx)(n.code,{children:"IValidatableObject"})," \u590d\u6742\u9a8c\u8bc1"]})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3,10-21}",children:'using System.Collections.Generic;\r\n\r\npublic class DtoModel : IValidatableObject\r\n{\r\n [Required]\r\n [StringLength(100)]\r\n public string Title { get; set; }\r\n\r\n // \u4f60\u7684\u9a8c\u8bc1\u903b\u8f91\r\n public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)\r\n {\r\n // \u8fd8\u53ef\u4ee5\u89e3\u6790\u670d\u52a1\r\n var service = validationContext.GetService(typeof(\u7c7b\u578b));\r\n\r\n if (\u4f60\u7684\u903b\u8f91\u4ee3\u7801)\r\n {\r\n yield return new ValidationResult(\r\n "\u9519\u8bef\u6d88\u606f"\r\n ,new[] { nameof(Title) } // \u9a8c\u8bc1\u5931\u8d25\u7684\u5c5e\u6027\r\n );\r\n }\r\n }\r\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Mvc"})," \u7279\u6027\u65b9\u5f0f\u6781\u5927\u7684\u5c06\u4e1a\u52a1\u903b\u8f91\u548c\u9a8c\u8bc1\u8fdb\u884c\u4e86\u5265\u79bb\u548c\u89e3\u8026\uff0c\u800c\u4e14\u8fd8\u80fd\u5b9e\u73b0\u81ea\u5b9a\u4e49\u590d\u6742\u9a8c\u8bc1\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsxs)(n.strong,{children:["\u4f46\u662f ",(0,r.jsx)(n.code,{children:"Mvc"})," \u7279\u6027\u9a8c\u8bc1\u65b9\u5f0f\u6709\u51e0\u4e2a\u660e\u663e\u7684\u7f3a\u70b9"]}),"\uff1a"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u53ea\u80fd\u5728 ",(0,r.jsx)(n.code,{children:"\u63a7\u5236\u5668"})," \u4e2d\u7684 ",(0,r.jsx)(n.code,{children:"Action"}),"\uff08\u52a8\u4f5c\u65b9\u6cd5\uff09\u4e2d\u4f7f\u7528"]}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"\u65e0\u6cd5\u5728\u4efb\u610f\u7c7b\u3001\u4efb\u610f\u65b9\u6cd5\u4e2d\u4f7f\u7528"})}),"\n",(0,r.jsx)(n.li,{children:"\u5185\u7f6e\u7684\u9a8c\u8bc1\u7c7b\u578b\u975e\u5e38\u6709\u9650\uff0c\u4e14\u4e0d\u6613\u62d3\u5c55"}),"\n",(0,r.jsx)(n.li,{children:"\u4e0d\u652f\u6301\u9a8c\u8bc1\u6d88\u606f\u540e\u671f\u914d\u7f6e"}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u6240\u4ee5\uff0c",(0,r.jsx)(n.code,{children:"Furion"})," \u63d0\u4f9b\u4e86\u65b0\u7684\u9a8c\u8bc1\u5f15\u64ce ",(0,r.jsx)(n.code,{children:"DataValidation"}),"\uff0c\u5728\u5b8c\u5168\u517c\u5bb9 ",(0,r.jsx)(n.code,{children:"Mvc"})," \u5185\u7f6e\u9a8c\u8bc1\u7684\u540c\u65f6\u63d0\u4f9b\u4e86\u5927\u91cf\u5e38\u89c1\u9a8c\u8bc1\u3001\u590d\u6742\u9a8c\u8bc1\u3001\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7b49\u80fd\u529b\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"84-datavalidation-\u9a8c\u8bc1-",children:["8.4 ",(0,r.jsx)(n.code,{children:"DataValidation"})," \u9a8c\u8bc1 \ud83e\udd17"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"DataValidation"})," \u662f ",(0,r.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u63d0\u4f9b\u4e86\u5168\u65b0\u7684\u9a8c\u8bc1\u65b9\u5f0f\uff0c\u5b8c\u5168\u517c\u5bb9 ",(0,r.jsx)(n.code,{children:"Mvc"})," \u5185\u7f6e\u9a8c\u8bc1\uff0c\u5e76\u4e14\u8d4b\u4e88\u4e86\u8d85\u80fd\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"841-datavalidation-\u4f18\u70b9",children:["8.4.1 ",(0,r.jsx)(n.code,{children:"DataValidation"})," \u4f18\u70b9"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsxs)(n.strong,{children:["\u5b8c\u5168\u517c\u5bb9 ",(0,r.jsx)(n.code,{children:"Mvc"})," \u5185\u7f6e\u9a8c\u8bc1\u5f15\u64ce"]})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"\u5185\u7f6e\u5e38\u89c1\u9a8c\u8bc1\u7c7b\u578b\u53ca\u53ef\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b\u578b\u529f\u80fd"})}),"\n",(0,r.jsx)(n.li,{children:"\u63d0\u4f9b\u5168\u5c40\u5bf9\u8c61\u62d3\u5c55\u9a8c\u8bc1\u65b9\u5f0f"}),"\n",(0,r.jsx)(n.li,{children:"\u652f\u6301\u9a8c\u8bc1\u6d88\u606f\u540e\u671f\u914d\u7f6e\uff0c\u652f\u6301\u5b9e\u65f6\u66f4\u65b0"}),"\n",(0,r.jsx)(n.li,{children:"\u652f\u6301\u5728\u4efb\u4f55\u7c7b\uff0c\u4efb\u4f55\u65b9\u6cd5\u3001\u4efb\u4f55\u4f4d\u7f6e\u5b9e\u73b0\u624b\u52a8\u9a8c\u8bc1\u3001\u7279\u6027\u65b9\u5f0f\u9a8c\u8bc1\u7b49"}),"\n",(0,r.jsx)(n.li,{children:"\u652f\u6301\u8bbe\u7f6e\u9a8c\u8bc1\u7ed3\u679c\u6a21\u578b"}),"\n"]}),"\n",(0,r.jsxs)(n.h2,{id:"85-datavalidation-\u4f7f\u7528",children:["8.5 ",(0,r.jsx)(n.code,{children:"DataValidation"})," \u4f7f\u7528"]}),"\n",(0,r.jsx)(n.admonition,{title:"\u5c0f\u63d0\u793a",type:"tip",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:".AddDataValidation()"})," \u9ed8\u8ba4\u5df2\u7ecf\u96c6\u6210\u5728 ",(0,r.jsx)(n.code,{children:"AddInject()"})," \u4e2d\u4e86\uff0c",(0,r.jsx)(n.strong,{children:"\u65e0\u9700\u518d\u6b21\u6ce8\u518c"}),"\u3002\u4e5f\u5c31\u662f ",(0,r.jsx)(n.code,{children:"8.5.1"})," \u7ae0\u8282\u53ef\u4e0d\u914d\u7f6e\u3002"]})}),"\n",(0,r.jsx)(n.h3,{id:"851-\u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1",children:"8.5.1 \u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:'showLineNumbers {11} title="Furion.Web.Core\\FurWebCoreStartup.cs"',children:"using Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Furion.Web.Core\r\n{\r\n [AppStartup(800)]\r\n public sealed class FurWebCoreStartup : AppStartup\r\n {\r\n public void ConfigureServices(IServiceCollection services)\r\n {\r\n services.AddControllers()\r\n .AddDataValidation();\r\n }\r\n }\r\n}\n"})}),"\n",(0,r.jsx)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:".AddDataValidation()"})," \u9700\u5728 ",(0,r.jsx)(n.code,{children:"services.AddControllers()"})," \u4e4b\u540e\u6ce8\u518c\u3002"]})}),"\n",(0,r.jsxs)(n.h3,{id:"852-\u517c\u5bb9-mvc-\u7279\u6027\u9a8c\u8bc1",children:["8.5.2 \u517c\u5bb9 ",(0,r.jsx)(n.code,{children:"Mvc"})," \u7279\u6027\u9a8c\u8bc1"]}),"\n",(0,r.jsxs)(t.Z,{defaultValue:"testdto",values:[{label:"TestDto",value:"testdto"},{label:"FurionAppService",value:"FurionAppService"}],children:[(0,r.jsx)(c.Z,{value:"testdto",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,7,10}",children:'using System.ComponentModel.DataAnnotations;\r\n\r\nnamespace Furion.Application\r\n{\r\n public class TestDto\r\n {\r\n [Range(10, 20, ErrorMessage = "Id \u53ea\u80fd\u5728 10-20 \u533a\u95f4\u53d6\u503c")]\r\n public int Id { get; set; }\r\n\r\n [Required(ErrorMessage = "\u5fc5\u586b"), MinLength(3, ErrorMessage = "\u5b57\u7b26\u4e32\u957f\u5ea6\u4e0d\u80fd\u5c11\u4e8e3\u4f4d")]\r\n public string Name { get; set; }\r\n }\r\n}\n'})})}),(0,r.jsx)(c.Z,{value:"FurionAppService",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {12,22}",children:'using Furion.DynamicApiController;\r\n\r\nnamespace Furion.Application\r\n{\r\n public class FurionAppService : IDynamicApiController\r\n {\r\n /// <summary>\r\n /// \u503c\u7c7b\u578b\u9a8c\u8bc1\r\n /// </summary>\r\n /// <param name="id"></param>\r\n /// <returns></returns>\r\n public int Get(int id)\r\n {\r\n return id;\r\n }\r\n\r\n /// <summary>\r\n /// \u5bf9\u8c61\u7c7b\u578b\u9a8c\u8bc1\r\n /// </summary>\r\n /// <param name="testDto"></param>\r\n /// <returns></returns>\r\n public TestDto Post(TestDto testDto)\r\n {\r\n return testDto;\r\n }\r\n }\r\n}\n'})})})]}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"}),"\n",(0,r.jsx)("img",{src:(0,d.Z)("img/sjyz1.gif")}),"\n",(0,r.jsxs)(n.h3,{id:"853-\u517c\u5bb9-mvc-\u590d\u6742\u9a8c\u8bc1",children:["8.5.3 \u517c\u5bb9 ",(0,r.jsx)(n.code,{children:"Mvc"})," \u590d\u6742\u9a8c\u8bc1"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2,6,14-24}",children:'using System.Collections.Generic;\r\nusing System.ComponentModel.DataAnnotations;\r\n\r\nnamespace Furion.Application\r\n{\r\n public class TestDto : IValidatableObject\r\n {\r\n [Range(10, 20, ErrorMessage = "Id \u53ea\u80fd\u5728 10-20 \u533a\u95f4\u53d6\u503c")]\r\n public int Id { get; set; }\r\n\r\n [Required(ErrorMessage = "\u5fc5\u586b"), MinLength(3, ErrorMessage = "\u5b57\u7b26\u4e32\u957f\u5ea6\u4e0d\u80fd\u5c11\u4e8e3\u4f4d")]\r\n public string Name { get; set; }\r\n\r\n public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)\r\n {\r\n // \u8fd8\u53ef\u4ee5\u89e3\u6790\u670d\u52a1\r\n var service = validationContext.GetService(typeof(\u7c7b\u578b));\r\n\r\n if (Name.StartsWith("Furion"))\r\n {\r\n yield return new ValidationResult(\r\n "\u4e0d\u80fd\u4ee5 Furion \u5f00\u5934"\r\n , new[] { nameof(Name) }\r\n );\r\n }\r\n }\r\n }\r\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"}),"\n",(0,r.jsx)("img",{src:(0,d.Z)("img/sjyz2.gif")}),"\n",(0,r.jsx)(n.h2,{id:"86-\u624b\u52a8\u9a8c\u8bc1",children:"8.6 \u624b\u52a8\u9a8c\u8bc1"}),"\n",(0,r.jsx)(n.h3,{id:"861-\u9a8c\u8bc1\u6a21\u578b",children:"8.6.1 \u9a8c\u8bc1\u6a21\u578b"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,11}",children:"using Furion.DataValidation;\r\nusing Furion.DynamicApiController;\r\n\r\nnamespace Furion.Application\r\n{\r\n public class FurionAppService : IDynamicApiController\r\n {\r\n [NonValidation] // \u8df3\u8fc7\u5168\u5c40\u9a8c\u8bc1\r\n public DataValidationResult Post(TestDto testDto)\r\n {\r\n return testDto.TryValidate();\r\n }\r\n }\r\n}\n"})}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"}),"\n",(0,r.jsx)("img",{src:(0,d.Z)("img/sjyz3.gif")}),"\n",(0,r.jsx)(n.admonition,{type:"note",children:(0,r.jsxs)(n.p,{children:["\u652f\u6301 ",(0,r.jsx)(n.strong,{children:(0,r.jsx)(n.code,{children:"Mvc"})})," \u5185\u7f6e\u7684\u7279\u6027\u9a8c\u8bc1\u3001\u5c5e\u6027\u9a8c\u8bc1\u53ca\u590d\u6742\u7684 ",(0,r.jsx)(n.strong,{children:(0,r.jsx)(n.code,{children:"IValidatableObject"})})," \u9a8c\u8bc1\u3002"]})}),"\n",(0,r.jsxs)(n.h3,{id:"862-tryvalidate-\u548c-validate",children:["8.6.2 ",(0,r.jsx)(n.code,{children:"TryValidate"})," \u548c ",(0,r.jsx)(n.code,{children:"Validate"})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u63d0\u4f9b\u4e86 ",(0,r.jsx)(n.code,{children:"TryValidate()"})," \u548c ",(0,r.jsx)(n.code,{children:"Validate()"})," \u4e24\u4e2a\u9a8c\u8bc1\u62d3\u5c55\u65b9\u6cd5\uff0c\u552f\u4e00\u7684\u533a\u522b\u5c31\u662f\u540e\u8005\u9a8c\u8bc1\u5931\u8d25\u5c06\u81ea\u52a8\u629b\u51fa\u5f02\u5e38\u6d88\u606f\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"863-validationtypes-\u5e38\u89c1\u9a8c\u8bc1",children:["8.6.3 ",(0,r.jsx)(n.code,{children:"ValidationTypes"})," \u5e38\u89c1\u9a8c\u8bc1"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u5185\u7f6e\u4e86\u5f88\u591a\u5e38\u7528\u7c7b\u578b\u7684\u6570\u636e\u9a8c\u8bc1\uff0c\u5305\u62ec\uff1a"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Numeric"}),"\uff1a\u6570\u503c\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"PositiveNumber"}),"\uff1a\u6b63\u6570\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"NegativeNumber"}),"\uff1a\u8d1f\u6570\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Integer"}),"\uff1a\u6574\u6570\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Money"}),"\uff1a\u91d1\u94b1\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Date"}),"\uff1a\u65e5\u671f\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Time"}),"\uff1a\u65f6\u95f4\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"IDCard"}),"\uff1a\u8eab\u4efd\u8bc1\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"PostCode"}),"\uff1a\u90ae\u7f16\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"PhoneNumber"}),"\uff1a\u624b\u673a\u53f7\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Telephone"}),"\uff1a\u56fa\u8bdd\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"PhoneOrTelNumber"}),"\uff1a\u624b\u673a\u6216\u56fa\u8bdd\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"EmailAddress"}),"\uff1a\u90ae\u4ef6\u5730\u5740\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Url"}),"\uff1a\u7f51\u5740\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Color"}),"\uff1a\u989c\u8272\u503c\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Chinese"}),"\uff1a\u4e2d\u6587\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"IPv4"}),"\uff1aIPv4 \u5730\u5740\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"IPv6"}),"\uff1aIPv6 \u5730\u5740\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Age"}),"\uff1a\u5e74\u9f84\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"ChineseName"}),"\uff1a\u4e2d\u6587\u540d\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"EnglishName"}),"\uff1a\u82f1\u6587\u540d\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Capital"}),"\uff1a\u7eaf\u5927\u5199\u82f1\u6587\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Lowercase"}),"\uff1a\u7eaf\u5c0f\u5199\u82f1\u6587\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Ascii"}),"\uff1aAscii \u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Md5"}),"\uff1aMd5 \u5b57\u7b26\u4e32\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Zip"}),"\uff1a\u538b\u7f29\u5305\u683c\u5f0f\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Image"}),"\uff1a\u56fe\u7247\u683c\u5f0f\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Document"}),"\uff1a\u6587\u6863\u683c\u5f0f\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"MP3"}),"\uff1aMp3 \u683c\u5f0f\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Flash"}),"\uff1aFlash \u683c\u5f0f\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Video"}),"\uff1a\u89c6\u9891\u6587\u4ef6\u683c\u5f0f\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Html"}),"\uff1a",(0,r.jsx)(n.code,{children:"Html"})," \u6807\u7b7e\u683c\u5f0f\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"IMEI"}),"\uff1a\u624b\u673a\u673a\u8eab\u7801\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"SocialCreditCode"}),"\uff1a\u7edf\u4e00\u793e\u4f1a\u4fe1\u7528\u4ee3\u7801\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"GUID_OR_UUID"}),"\uff1a",(0,r.jsx)(n.code,{children:"GUID"})," \u6216 ",(0,r.jsx)(n.code,{children:"UUID"})," \u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Base64"}),"\uff1a",(0,r.jsx)(n.code,{children:"base64"})," \u683c\u5f0f\u7c7b\u578b"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"\u4f7f\u7528\u793a\u4f8b"})}),"\n",(0,r.jsxs)(t.Z,{defaultValue:"dglx",values:[{label:"\u5355\u4e2a\u7c7b\u578b\u9a8c\u8bc1",value:"dglx"},{label:"\u591a\u4e2a\u7ec4\u5408\u7c7b\u578b\u9a8c\u8bc1",value:"zhlx"}],children:[(0,r.jsx)(c.Z,{value:"dglx",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'// \u9a8c\u8bc1\u4e2d\u6587\r\n"\u6211\u53eb MonK".TryValidate(ValidationTypes.Chinese); // => false\r\n\r\n// \u9a8c\u8bc1\u6570\u503c\r\n2.TryValidate(ValidationTypes.Numeric); // => true\r\n\r\n// \u9a8c\u8bc1\u6574\u6570\r\ntrue.TryValidate(ValidationTypes.Integer); // => false\r\n\r\n// \u9a8c\u8bc1\u90ae\u7bb1\r\n"monksoul@outlook.com".TryValidate(ValidationTypes.EmailAddress); // => true\r\n\r\n// \u9a8c\u8bc1\u8d1f\u6570\r\n2.0m.TryValidate(ValidationTypes.NegativeNumber); // => false\r\n\r\n// \u81ea\u5b9a\u4e49\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\r\n"Furion".TryValidate("/^Furion$"); // => true\n'})})}),(0,r.jsx)(c.Z,{value:"zhlx",children:(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'// \u9a8c\u8bc1\u6570\u503c\u7c7b\u578b\u4e14\u662f\u6574\u6570\r\n"20".TryValidate(ValidationTypes.Numeric, ValidationTypes.Integer); // => true\r\n\r\n// \u9a8c\u8bc1\u65f6\u65e5\u671f\u6216\u65f6\u95f4\u683c\u5f0f\r\n"2020-05-20".TryValidate(ValidationPattern.AtLeastOne, ValidationTypes.Date, ValidationTypes.Time); // => true\r\n"23:45:20".TryValidate(ValidationPattern.AtLeastOne, ValidationTypes.Date, ValidationTypes.Time); // => true\r\n\n'})})})]}),"\n",(0,r.jsx)(n.admonition,{title:"\u5c0f\u77e5\u8bc6",type:"tip",children:(0,r.jsxs)(n.p,{children:["\u53ef\u901a\u8fc7\u8bbe\u7f6e ",(0,r.jsx)(n.code,{children:"TryValidate([ValidationPattern], params object[] validationTypes)"})," \u65b9\u6cd5\u7684 ",(0,r.jsx)(n.code,{children:"ValidationPattern"})," \u53c2\u6570\u914d\u7f6e\u9a8c\u8bc1\u903b\u8f91\uff0c\u5982\uff1a",(0,r.jsx)(n.strong,{children:(0,r.jsx)(n.code,{children:"\u540c\u65f6\u6210\u7acb"})})," \u6216 ",(0,r.jsx)(n.strong,{children:(0,r.jsx)(n.code,{children:"\u53ea\u8981\u4e00\u4e2a\u6210\u7acb"})})," \u5373\u53ef\u9a8c\u8bc1\u901a\u8fc7"]})}),"\n",(0,r.jsxs)(n.h3,{id:"864-datavalidation-\u7279\u6027",children:["8.6.4 ",(0,r.jsx)(n.code,{children:"[DataValidation]"})," \u7279\u6027"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u8fd8\u63d0\u4f9b\u4e86 ",(0,r.jsx)(n.code,{children:"[DataValidation]"})," \u7279\u6027\u65b9\u4fbf\u5728\u6a21\u578b\u53c2\u6570\u4e2d\u4f7f\u7528 ",(0,r.jsx)(n.code,{children:"ValidationTypes"})," \u5e38\u89c1\u9a8c\u8bc1\u6216\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u3002"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,7,10,14,17,20}",children:'using Furion.DataValidation;\r\n\r\nnamespace Furion.Application\r\n{\r\n public class TestDto\r\n {\r\n [DataValidation(ValidationTypes.Integer)]\r\n public int Id { get; set; }\r\n\r\n [DataValidation(ValidationTypes.Numeric, ValidationTypes.Integer)]\r\n public int Cost { get; set; }\r\n\r\n [DataValidation(ValidationPattern.AtLeastOne, ValidationTypes.Chinese, ValidationTypes.Date)]\r\n public string Name { get; set; }\r\n\r\n // \u53ef\u4ee5\u548cMvc\u7279\u6027\u5171\u5b58\r\n [Required, DataValidation(ValidationTypes.Age)]\r\n public int Age { get; set; }\r\n\r\n [DataValidation(ValidationTypes.IDCard, ErrorMessage = "\u81ea\u5b9a\u4e49\u8eab\u4efd\u8bc1\u63d0\u793a\u6d88\u606f")]\r\n public string IDCard { get; set; }\r\n }\r\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:[(0,r.jsx)(n.code,{children:"[DataValidation]"})," \u7279\u6027\u5177\u5907 ",(0,r.jsx)(n.code,{children:"ValidationAttribute"})," \u7279\u6027\u7684\u6240\u6709\u914d\u7f6e\u4ee5\u5916\u8fd8\u63d0\u4f9b\u4e86\u4ee5\u4e0b\u914d\u7f6e\uff1a"]})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"ValidationTypes"}),"\uff1a\u9a8c\u8bc1\u7c7b\u578b\uff0c",(0,r.jsx)(n.code,{children:"Enum[]"})," \u7c7b\u578b\uff0c"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"ValidationPattern"}),"\uff1a\u9a8c\u8bc1\u903b\u8f91\uff0c",(0,r.jsx)(n.code,{children:"ValidationPattern"})," \u7c7b\u578b\uff0c\u53ef\u9009 ",(0,r.jsx)(n.code,{children:"AllOfThem\uff08\u5168\u90e8\u9a8c\u8bc1\u901a\u8fc7\uff09"})," \u548c ",(0,r.jsx)(n.code,{children:"AtleastOne\uff08\u81f3\u5c11\u4e00\u4e2a\u9a8c\u8bc1\u901a\u8fc7\uff09"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"AllowNullValue"}),"\uff1a\u662f\u5426\u5141\u8bb8\u7a7a\u503c\uff0c",(0,r.jsx)(n.code,{children:"bool"})," \u7c7b\u578b\uff0c\u9ed8\u8ba4 ",(0,r.jsx)(n.code,{children:"false"})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"AllowEmptyStrings"}),"\uff1a\u662f\u5426\u5141\u8bb8\u7a7a\u5b57\u7b26\u4e32\uff0c",(0,r.jsx)(n.code,{children:"bool"})," \u7c7b\u578b\uff0c\u9ed8\u8ba4 ",(0,r.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:"Furion 4.8.8.42+"})," \u7248\u672c\uff0c",(0,r.jsx)(n.code,{children:"[DataValidation]"})," \u7684 ",(0,r.jsx)(n.code,{children:"ErrorMessage"})," \u652f\u6301 ",(0,r.jsx)(n.code,{children:"[Display]"})," \u548c ",(0,r.jsx)(n.code,{children:"[DisplayName]"})," \u7279\u6027\u6307\u5b9a\u683c\u5f0f\u5316 ",(0,r.jsx)(n.code,{children:"{0}"})," \u4fe1\u606f\uff0c\u5982\uff1a"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1-3}",children:'[Display(Name = "\u624b\u673a\u53f7\u7801")]\r\n// [DisplayName("\u624b\u673a\u53f7\u7801")]\r\n[DataValidation(ValidationTypes.PhoneNumber, ErrorMessage = "\u4e0d\u662f\u4e00\u4e2a\u6b63\u786e\u7684{0}")]\r\npublic string PhoneNumber { get; set; }\n'})}),"\n",(0,r.jsxs)(n.h3,{id:"865-modelbinder-\u7279\u6027",children:["8.6.5 ",(0,r.jsx)(n.code,{children:"[ModelBinder]"})," \u7279\u6027"]}),"\n",(0,r.jsxs)(n.p,{children:["\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u9a8c\u8bc1\u5931\u8d25\u4fe1\u606f\u4f1a\u6839\u636e\u5c5e\u6027\u540d\u8fdb\u884c\u5e8f\u5217\u5316\uff0c\u4f46\u662f\u5982\u679c\u5c5e\u6027\u5e8f\u5217\u5316\u81ea\u5b9a\u4e49\u4e86 ",(0,r.jsx)(n.code,{children:"[JsonPropertyName]"})," \u7279\u6027\uff0c\u90a3\u4e48\u9a8c\u8bc1\u5931\u8d25\u7684\u6d88\u606f\u5c31\u4e0d\u5339\u914d\u4e86\uff0c\u8fd9\u65f6\u6211\u4eec\u9700\u8981\u6dfb\u52a0 ",(0,r.jsx)(n.code,{children:'[ModelBinder(Name = "\u5e8f\u5217\u5316\u5bf9\u5e94\u540d\u5b57")]'})," \u8fdb\u884c\u7ea0\u6b63\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff1a"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1}",children:'[JsonPropertyName("phone_number"), ModelBinder(Name = "phone_number")]\r\npublic string PhoneNumber { get; set; }\n'})}),"\n",(0,r.jsxs)(n.h2,{id:"87-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1",children:["8.7 ",(0,r.jsx)(n.code,{children:"[NonValidation]"})," \u8df3\u8fc7\u9a8c\u8bc1"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u63d0\u4f9b\u4e86\u5bf9\u8c61\u6a21\u578b\u8df3\u8fc7\u9a8c\u8bc1\u7279\u6027 ",(0,r.jsx)(n.code,{children:"[NonValidation]"}),"\uff0c\u652f\u6301\u5728 ",(0,r.jsx)(n.code,{children:"\u63a7\u5236\u5668"}),"\uff0c",(0,r.jsx)(n.code,{children:"\u52a8\u4f5c\u65b9\u6cd5"}),"\uff0c",(0,r.jsx)(n.code,{children:"\u7c7b"})," \u4e2d\u4f7f\u7528\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u4e00\u65e6\u8d34\u4e86\u6b64\u7279\u6027\uff0c\u90a3\u4e48\u5c06\u4e0d\u4f1a\u6267\u884c\u9a8c\u8bc1\u64cd\u4f5c\u3002"}),"\n",(0,r.jsx)(n.admonition,{type:"note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:(0,r.jsx)(n.code,{children:"[NonValidation]"})})," \u53ea\u5bf9\u5bf9\u8c61\u7c7b\u578b\u6709\u6548\uff0c\u503c\u7c7b\u578b\u65e0\u6548\u3002"]})}),"\n",(0,r.jsx)(n.h2,{id:"88-\u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c",children:"8.8 \u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c"}),"\n",(0,r.jsxs)(n.h3,{id:"881-\u81ea\u5b9a\u4e49-validationtypes-\u7c7b\u578b",children:["8.8.1 \u81ea\u5b9a\u4e49 ",(0,r.jsx)(n.code,{children:"ValidationTypes"})," \u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.p,{children:["\u9664\u4e86 ",(0,r.jsx)(n.code,{children:"Furion"})," \u5185\u7f6e\u7684\u9a8c\u8bc1\u7c7b\u578b\u4ee5\u5916\uff0c",(0,r.jsx)(n.code,{children:"Furion"})," \u8fd8\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b\u578b\u673a\u5236\u3002"]}),"\n",(0,r.jsx)(n.p,{children:"\u5b9e\u73b0\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b\u578b\u5fc5\u987b\u9075\u5faa\u4ee5\u4e0b\u914d\u7f6e\uff1a"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["\u9a8c\u8bc1\u7c7b\u578b\u5fc5\u987b\u662f\u516c\u5f00\u4e14\u662f ",(0,r.jsx)(n.code,{children:"Enum"})," \u679a\u4e3e\u7c7b\u578b"]}),"\n",(0,r.jsxs)(n.li,{children:["\u679a\u4e3e\u7c7b\u578b\u5fc5\u987b\u8d34\u6709 ",(0,r.jsx)(n.code,{children:"[ValidationType]"})," \u7279\u6027"]}),"\n",(0,r.jsxs)(n.li,{children:["\u679a\u4e3e\u4e2d\u6bcf\u4e00\u9879\u5fc5\u987b\u8d34\u6709 ",(0,r.jsx)(n.code,{children:"[ValidationItemMetadata]"})," \u7279\u6027"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"\u5982"}),"\uff1a"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,6,12,18}",children:'using Furion.DataValidation;\r\nusing System.Text.RegularExpressions;\r\n\r\nnamespace Furion.Application\r\n{\r\n [ValidationType]\r\n public enum MyValidationTypes\r\n {\r\n /// <summary>\r\n /// \u5f3a\u5bc6\u7801\u7c7b\u578b\r\n /// </summary>\r\n [ValidationItemMetadata(@"^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$", "\u5fc5\u987b\u987b\u5305\u542b\u5927\u5c0f\u5199\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u7ec4\u5408\uff0c\u4e0d\u80fd\u4f7f\u7528\u7279\u6b8a\u5b57\u7b26\uff0c\u957f\u5ea6\u57288-10\u4e4b\u95f4")]\r\n StrongPassword,\r\n\r\n /// <summary>\r\n /// \u4ee5 Furion \u5b57\u7b26\u4e32\u5f00\u5934\uff0c\u5ffd\u7565\u5927\u5c0f\u5199\r\n /// </summary>\r\n [ValidationItemMetadata(@"^(furion).*", "\u9ed8\u8ba4\u63d0\u793a\uff1a\u5fc5\u987b\u4ee5Fur\u5b57\u7b26\u4e32\u5f00\u5934\uff0c\u5ffd\u7565\u5927\u5c0f\u5199", RegexOptions.IgnoreCase)]\r\n StartWithFurString\r\n }\r\n}\n'})}),"\n",(0,r.jsx)(n.admonition,{title:"\u5c0f\u77e5\u8bc6",type:"tip",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Any-Rule"})," \u662f\u56fd\u4eba\u8bb0\u5f55\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5927\u5168\uff0c\u5982\u9700\u67e5\u627e\u6b63\u5219\u8868\u8fbe\u5f0f\u53ef\u67e5\u9605 ",(0,r.jsx)(n.a,{href:"https://any86.github.io/any-rule/",children:"https://any86.github.io/any-rule/"})]})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"\u4f7f\u7528"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u624b\u52a8\u4f7f\u7528"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'"q1w2e3".TryValidate(MyValidationTypes.StrongPassword); // => false\r\n\r\n"furos".TryValidate(MyValidationTypes.StartWithFurString); // => true\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[DataValidation]"})," \u4e2d\u4f7f\u7528"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"[DataValidation(MyValidationTypes.StrongPassword)]\r\npublic string Password { get; set; }\n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u591a\u4e2a\u81ea\u5b9a\u4e49\u7c7b\u578b\u6df7\u7528"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'"Q1w2e3r4t5!*".TryValidate(MyValidationTypes.StrongPassword, ValidationTypes.EmailAddress); // => true\n'})}),"\n",(0,r.jsx)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"caution",children:(0,r.jsx)(n.p,{children:"\u81ea\u5b9a\u4e49\u7684\u9a8c\u8bc1\u7c7b\u578b\u4e5f\u8981\u4fdd\u8bc1\u540d\u79f0\u5168\u5c40\u552f\u4e00\uff0c\u4e5f\u5c31\u662f\u591a\u4e2a\u9a8c\u8bc1\u7c7b\u578b\u4e0d\u80fd\u51fa\u73b0\u4e00\u6837\u7684\u540d\u5b57\u3002"})}),"\n",(0,r.jsxs)(n.h3,{id:"882-\u81ea\u5b9a\u4e49-validationtypes-\u5931\u8d25\u6d88\u606f",children:["8.8.2 \u81ea\u5b9a\u4e49 ",(0,r.jsx)(n.code,{children:"ValidationTypes"})," \u5931\u8d25\u6d88\u606f"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u5185\u7f6e\u7684 ",(0,r.jsx)(n.code,{children:"ValidationTypes"})," \u5df2\u6709\u9ed8\u8ba4\u7684\u5931\u8d25\u6d88\u606f\uff1a"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Numeric"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a numeric type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"PositiveNumber"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a positive number type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"NegativeNumber"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a negative number type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Integer"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a integer type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Money"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a money type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Date"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a date type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Time"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a time type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"IDCard"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a idcard type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"PostCode"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a postcode type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"PhoneNumber"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a phone number type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Telephone"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a telephone type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"PhoneOrTelNumber"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a phone number or telephone type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"EmailAddress"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a email address type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Url"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a url address type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Color"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a color type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Chinese"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a chinese type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"IPv4"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a IPv4 type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"IPv6"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a IPv6 type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Age"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a age type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"ChineseName"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a chinese name type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"EnglishName"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a english name type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Capital"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a capital type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Lowercase"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a lowercase type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Ascii"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a ascii type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Md5"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a md5 type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Zip"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a zip type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Image"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a image type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Document"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a document type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"MP3"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a mp3 type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Flash"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a flash type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Video"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a video type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Html"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a html type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"IMEI"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a IMEI type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"SocialCreditCode"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a social credit code type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"GUID_OR_UUID"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a GUID or UUID type."})]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"Base64"}),"\uff1a",(0,r.jsx)(n.strong,{children:"The value is not a base64 type."})]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u521b\u5efa\u7ee7\u627f ",(0,r.jsx)(n.code,{children:"IValidationMessageTypeProvider"})," \u9a8c\u8bc1\u6d88\u606f\u63d0\u4f9b\u5668\u7c7b\u578b\uff0c\u6216\u901a\u8fc7 ",(0,r.jsx)(n.code,{children:"appsettings.json"})," \u914d\u7f6e\u3002"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:(0,r.jsx)(n.code,{children:"[ValidationMessageType]"})})," \u65b9\u5f0f"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {5,9,12,15,19,22}",children:'using Furion.DataValidation;\r\n\r\nnamespace Furion.Application\r\n{\r\n [ValidationMessageType]\r\n public enum MyValidationMessageType\r\n {\r\n [ValidationMessage("\u5fc5\u987b\u662f\u6570\u503c\u7c7b\u578b")]\r\n Numeric,\r\n\r\n [ValidationMessage("\u5fc5\u987b\u662f\u6b63\u6570")]\r\n PositiveNumber,\r\n\r\n // \u4fee\u6539\u81ea\u5b9a\u4e49\u7c7b\u578b\u9a8c\u8bc1\u5931\u8d25\u6d88\u606f\r\n [ValidationMessage("\u5bc6\u7801\u592a\u7b80\u5355\u4e86")]\r\n StrongPassword,\r\n\r\n [ValidationMessage("\u5fc5\u987b\u4ee5 Furion \u5f00\u5934")]\r\n StartWithFurString\r\n }\r\n}\n'})}),"\n",(0,r.jsxs)(n.admonition,{title:"\u5c0f\u77e5\u8bc6",type:"tip",children:[(0,r.jsxs)(n.p,{children:["\u9664\u4e86\u8d34 ",(0,r.jsx)(n.code,{children:"[ValidationMessageType]"})," \u7279\u6027\u5916\uff0c",(0,r.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u8fd8\u63d0\u4f9b\u4e86 ",(0,r.jsx)(n.code,{children:"IValidationMessageTypeProvider"})," \u65b9\u5f0f\u67e5\u627e\u9a8c\u8bc1\u6d88\u606f\u7c7b\u578b\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a"]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,6,8-12}",children:"using Furion.DataValidation;\r\nusing System;\r\n\r\nnamespace Furion.Application\r\n{\r\n public class MyValidationTypeMessageProvider : IValidationMessageTypeProvider\r\n {\r\n public Type[] Definitions => new[]\r\n {\r\n typeof(MyValidationMessageType),\r\n typeof(MyValidationMessageType2)\r\n };\r\n }\r\n}\n"})}),(0,r.jsx)(n.p,{children:"\u6ce8\u518c\u9a8c\u8bc1\u6d88\u606f\u63d0\u4f9b\u5668"}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:'showLineNumbers {11} title="Furion.Web.Core\\FurWebCoreStartup.cs"',children:"using Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Furion.Web.Core\r\n{\r\n [AppStartup(800)]\r\n public sealed class FurWebCoreStartup : AppStartup\r\n {\r\n public void ConfigureServices(IServiceCollection services)\r\n {\r\n services.AddControllers()\r\n .AddDataValidation<MyValidationTypeMessageProvider>();\r\n }\r\n }\r\n}\n"})})]}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"}),"\n",(0,r.jsx)("img",{src:(0,d.Z)("img/sjyz4.png")}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsxs)(n.strong,{children:[(0,r.jsx)(n.code,{children:"appsettings.json"})," \u65b9\u5f0f"]})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",metastring:'showLineNumbers {2-9} title="Furion.Web.Entry/appsettings.json"',children:'{\r\n "ValidationTypeMessageSettings": {\r\n "Definitions": [\r\n ["Numeric", "\u5fc5\u987b\u662f\u6570\u503c\u7c7b\u578b"],\r\n\r\n ["StrongPassword", "\u5bc6\u7801\u592a\u7b80\u5355\u4e86!!!"]\r\n ]\r\n }\r\n}\n'})}),"\n",(0,r.jsx)(n.admonition,{type:"important",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"appsettings.json"})," \u4e2d\u76f8\u540c\u7684 ",(0,r.jsx)(n.code,{children:"Key"})," \u4f1a\u8986\u76d6 ",(0,r.jsx)(n.code,{children:"IValidationMessageTypeProvider"})," \u63d0\u4f9b\u76f8\u540c ",(0,r.jsx)(n.code,{children:"Key"})," \u7684\u503c\u3002"]})}),"\n",(0,r.jsx)(n.h4,{id:"\u9519\u8bef\u6d88\u606f\u67e5\u627e\u4f18\u5148\u7ea7",children:"\u9519\u8bef\u6d88\u606f\u67e5\u627e\u4f18\u5148\u7ea7"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"DefaultErrorMessage"})," -> ",(0,r.jsx)(n.code,{children:"IValidationMessageTypeProvider"})," -> ",(0,r.jsx)(n.code,{children:"appsettings.json"})," (",(0,r.jsx)(n.strong,{children:"\u4f4e -> \u9ad8"}),")"]}),"\n",(0,r.jsx)(n.h2,{id:"89-\u6a21\u578b\u9a8c\u8bc1\u8303\u56f4",children:"8.9 \u6a21\u578b\u9a8c\u8bc1\u8303\u56f4"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u63d0\u4f9b\u591a\u79cd\u6a21\u578b\u9a8c\u8bc1\u8303\u56f4\u8bbe\u7f6e\uff1a"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u5168\u5c40\u9a8c\u8bc1\uff08\u9ed8\u8ba4\uff09"}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[NonValidation]"})," \u8df3\u8fc7\u9a8c\u8bc1"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[TypeFilter(typeof(DataValidationFilter))]"})," \u5c40\u90e8\u9a8c\u8bc1"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"[ApiController]"})," \u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1"]}),"\n"]}),"\n",(0,r.jsx)(n.h3,{id:"891-\u5168\u5c40\u9a8c\u8bc1",children:"8.9.1 \u5168\u5c40\u9a8c\u8bc1"}),"\n",(0,r.jsxs)(n.p,{children:["\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u901a\u8fc7 ",(0,r.jsx)(n.code,{children:".AddDataValidation()"})," \u6ce8\u518c\u6570\u636e\u9a8c\u8bc1\u670d\u52a1\u5df2\u7ecf\u542f\u7528\u4e86\u5168\u5c40\u9a8c\u8bc1\uff0c\u5982\u82e5\u4e0d\u60f3\u542f\u7528\u5168\u5c40\u9a8c\u8bc1\uff0c\u5219\u4f20\u5165 ",(0,r.jsx)(n.code,{children:"false"})," \u5373\u53ef\uff0c\u5982\uff1a",(0,r.jsx)(n.code,{children:".AddDataValidation(false)"}),"\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"892-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1",children:["8.9.2 ",(0,r.jsx)(n.code,{children:"[NonValidation]"})," \u8df3\u8fc7\u9a8c\u8bc1"]}),"\n",(0,r.jsxs)(n.p,{children:["\u53ef\u901a\u8fc7 ",(0,r.jsx)(n.code,{children:"[NonValidation]"})," \u8d34\u5728 ",(0,r.jsx)(n.code,{children:"\u63a7\u5236\u5668"}),"\uff0c",(0,r.jsx)(n.code,{children:"\u52a8\u4f5c\u65b9\u6cd5"}),"\uff0c",(0,r.jsx)(n.code,{children:"\u7c7b"})," \u4e2d\u8df3\u8fc7\u5168\u5c40\u9a8c\u8bc1\u6216\u4e0d\u9700\u8981\u9a8c\u8bc1"]}),"\n",(0,r.jsxs)(n.h3,{id:"893-typefiltertypeofdatavalidationfilter-\u5c40\u90e8\u9a8c\u8bc1",children:["8.9.3 ",(0,r.jsx)(n.code,{children:"[TypeFilter(typeof(DataValidationFilter))]"})," \u5c40\u90e8\u9a8c\u8bc1"]}),"\n",(0,r.jsxs)(n.p,{children:["\u6211\u4eec\u4e5f\u53ef\u4ee5\u65e0\u9700\u6ce8\u518c ",(0,r.jsx)(n.code,{children:".AddDataValidation()"})," \u670d\u52a1\uff0c\u76f4\u63a5\u5728 ",(0,r.jsx)(n.code,{children:"\u52a8\u4f5c\u65b9\u6cd5"})," \u4e0a\u8d34 ",(0,r.jsx)(n.code,{children:"[TypeFilter(typeof(DataValidationFilter))]"})," \u53ef\u542f\u7528\u5c40\u90e8\u9a8c\u8bc1\u3002\u5982\uff1a"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,3,9}",children:"using Furion.DataValidation;\r\nusing Furion.DynamicApiController;\r\nusing Microsoft.AspNetCore.Mvc;\r\n\r\nnamespace Furion.Application\r\n{\r\n public class FurionAppService : IDynamicApiController\r\n {\r\n [TypeFilter(typeof(DataValidationFilter))]\r\n public TestDto Post(TestDto testDto)\r\n {\r\n return testDto;\r\n }\r\n }\r\n}\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"894-apicontroller-\u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1",children:["8.9.4 ",(0,r.jsx)(n.code,{children:"[ApiController]"})," \u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"[ApiController]"})," \u662f ",(0,r.jsx)(n.code,{children:"Mvc"})," \u63d0\u4f9b\u7684\u63a7\u5236\u5668\u8303\u56f4\uff08\u542b\u6240\u6709\u52a8\u4f5c\u65b9\u6cd5\uff09\u7684\u9a8c\u8bc1\u3002"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1,5}",children:"using Microsoft.AspNetCore.Mvc;\r\n\r\nnamespace Furion.Web.Entry.Controllers\r\n{\r\n [ApiController]\r\n public class MvcController : Controller\r\n {\r\n public IActionResult Index()\r\n {\r\n return View();\r\n }\r\n }\r\n}\n"})}),"\n",(0,r.jsxs)(n.h2,{id:"810-miniprofiler-\u67e5\u770b",children:["8.10 ",(0,r.jsx)(n.code,{children:"MiniProfiler"})," \u67e5\u770b"]}),"\n",(0,r.jsx)(n.p,{children:"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"}),"\n",(0,r.jsx)("img",{src:(0,d.Z)("img/sjyz5.png")}),"\n",(0,r.jsx)(n.h2,{id:"811-\u591a\u8bed\u8a00\u652f\u6301",children:"8.11 \u591a\u8bed\u8a00\u652f\u6301"}),"\n",(0,r.jsxs)(n.p,{children:["\u53c2\u89c1 ",(0,r.jsx)(n.a,{href:"./local-language",children:"\u3010\u5168\u7403\u5316\u548c\u672c\u5730\u5316\uff08\u591a\u8bed\u8a00\uff09\u3011"})," \u7ae0\u8282"]}),"\n",(0,r.jsxs)(n.h2,{id:"812-\u96c6\u6210-fluentvalidation-\u7b2c\u4e09\u65b9\u6821\u9a8c",children:["8.12 \u96c6\u6210 ",(0,r.jsx)(n.code,{children:"FluentValidation"})," \u7b2c\u4e09\u65b9\u6821\u9a8c"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u5185\u7f6e\u7684\u9a8c\u8bc1\u5df2\u7ecf\u53ef\u4ee5\u6ee1\u8db3\u7edd\u5927\u591a\u6570\u6821\u9a8c\u60c5\u51b5\uff0c\u4f46\u662f\u5bf9\u4e8e ",(0,r.jsx)(n.code,{children:"\u573a\u666f"})," \u9a8c\u8bc1\u76ee\u524d\u6682\u672a\u652f\u6301\u3002\u8fd9\u91cc\u63a8\u8350\u96c6\u6210 ",(0,r.jsx)(n.a,{href:"https://github.com/FluentValidation/FluentValidation",children:(0,r.jsx)(n.code,{children:"FluentValidation"})})," \u7b2c\u4e09\u65b9\u6821\u9a8c\u7ec4\u4ef6\u3002"]}),"\n",(0,r.jsxs)(n.h3,{id:"8121-\u5b89\u88c5-fluentvalidationaspnetcore-\u62d3\u5c55\u5305",children:["8.12.1 \u5b89\u88c5 ",(0,r.jsx)(n.code,{children:"FluentValidation.AspNetCore"})," \u62d3\u5c55\u5305"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-shell",metastring:"showLineNumbers",children:"dotnet add package FluentValidation.AspNetCore\n"})}),"\n",(0,r.jsxs)(n.h3,{id:"8122-\u5728-startupcs-\u4e2d\u6ce8\u518c",children:["8.12.2 \u5728 ",(0,r.jsx)(n.code,{children:"Startup.cs"})," \u4e2d\u6ce8\u518c"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2}",children:"services.AddControllers()\r\n .AddFluentValidation(fv => {\r\n fv.RegisterValidatorsFromAssemblies(App.Assemblies);\r\n });\n"})}),"\n",(0,r.jsx)(n.h3,{id:"8123-\u4f7f\u7528\u4f8b\u5b50",children:"8.12.3 \u4f7f\u7528\u4f8b\u5b50"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"public class Person {\r\n\tpublic int Id { get; set; }\r\n\tpublic string Name { get; set; }\r\n\tpublic string Email { get; set; }\r\n\tpublic int Age { get; set; }\r\n}\r\n\r\npublic class PersonValidator : AbstractValidator<Person> {\r\n\tpublic PersonValidator() {\r\n\t\tRuleFor(x => x.Id).NotNull();\r\n\t\tRuleFor(x => x.Name).Length(0, 10);\r\n\t\tRuleFor(x => x.Email).EmailAddress();\r\n\t\tRuleFor(x => x.Age).InclusiveBetween(18, 60);\r\n\t}\r\n}\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["\u5728\u63a7\u5236\u5668\u4e2d\u4f7f\u7528\u65e0\u9700\u624b\u52a8\u8c03\u7528 ",(0,r.jsx)(n.code,{children:"ModelState.IsValid"})," \u8fdb\u884c\u5224\u65ad\uff0c",(0,r.jsx)(n.code,{children:"Furion"})," \u4f1a\u81ea\u52a8\u6267\u884c\u8be5\u64cd\u4f5c\u3002"]})}),"\n",(0,r.jsxs)(n.p,{children:["\u5982\u9700\u4e86\u89e3\u66f4\u591a ",(0,r.jsx)(n.code,{children:"FluentValidation"})," \u77e5\u8bc6\u53ef\u67e5\u9605\u5b98\u65b9\u6587\u6863\uff1a",(0,r.jsx)(n.a,{href:"https://fluentvalidation.net/",children:"https://fluentvalidation.net/"})]}),"\n",(0,r.jsx)(n.h2,{id:"813-\u53cd\u9988\u4e0e\u5efa\u8bae",children:"8.13 \u53cd\u9988\u4e0e\u5efa\u8bae"}),"\n",(0,r.jsx)(n.admonition,{title:"\u4e0e\u6211\u4eec\u4ea4\u6d41",type:"note",children:(0,r.jsxs)(n.p,{children:["\u7ed9 Furion \u63d0 ",(0,r.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/new?issue",children:"Issue"}),"\u3002"]})})]})}function p(e={}){const{wrapper:n}={...(0,s.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},5162:(e,n,i)=>{i.d(n,{Z:()=>d});i(7294);var r=i(4334);const s={tabItem:"tabItem_Ymn6"};var l=i(5893);function d(e){let{children:n,hidden:i,className:d}=e;return(0,l.jsx)("div",{role:"tabpanel",className:(0,r.Z)(s.tabItem,d),hidden:i,children:n})}},4866:(e,n,i)=>{i.d(n,{Z:()=>f});var r=i(7294),s=i(4334),l=i(2466),d=i(6550),t=i(469),c=i(1980),a=i(7392),o=i(12);function h(e){return r.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function x(e){const{values:n,children:i}=e;return(0,r.useMemo)((()=>{const e=n??function(e){return h(e).map((e=>{let{props:{value:n,label:i,attributes:r,default:s}}=e;return{value:n,label:i,attributes:r,default:s}}))}(i);return function(e){const n=(0,a.l)(e,((e,n)=>e.value===n.value));if(n.length>0)throw new Error(`Docusaurus error: Duplicate values "${n.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[n,i])}function j(e){let{value:n,tabValues:i}=e;return i.some((e=>e.value===n))}function u(e){let{queryString:n=!1,groupId:i}=e;const s=(0,d.k6)(),l=function(e){let{queryString:n=!1,groupId:i}=e;if("string"==typeof n)return n;if(!1===n)return null;if(!0===n&&!i)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return i??null}({queryString:n,groupId:i});return[(0,c._X)(l),(0,r.useCallback)((e=>{if(!l)return;const n=new URLSearchParams(s.location.search);n.set(l,e),s.replace({...s.location,search:n.toString()})}),[l,s])]}function p(e){const{defaultValue:n,queryString:i=!1,groupId:s}=e,l=x(e),[d,c]=(0,r.useState)((()=>function(e){let{defaultValue:n,tabValues:i}=e;if(0===i.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(n){if(!j({value:n,tabValues:i}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${n}" but none of its children has the corresponding value. Available values are: ${i.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return n}const r=i.find((e=>e.default))??i[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:n,tabValues:l}))),[a,h]=u({queryString:i,groupId:s}),[p,g]=function(e){let{groupId:n}=e;const i=function(e){return e?`docusaurus.tab.${e}`:null}(n),[s,l]=(0,o.Nk)(i);return[s,(0,r.useCallback)((e=>{i&&l.set(e)}),[i,l])]}({groupId:s}),m=(()=>{const e=a??p;return j({value:e,tabValues:l})?e:null})();(0,t.Z)((()=>{m&&c(m)}),[m]);return{selectedValue:d,selectValue:(0,r.useCallback)((e=>{if(!j({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);c(e),h(e),g(e)}),[h,g,l]),tabValues:l}}var g=i(2389);const m={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var v=i(5893);function y(e){let{className:n,block:i,selectedValue:r,selectValue:d,tabValues:t}=e;const c=[],{blockElementScrollPositionUntilNextRender:a}=(0,l.o5)(),o=e=>{const n=e.currentTarget,i=c.indexOf(n),s=t[i].value;s!==r&&(a(n),d(s))},h=e=>{let n=null;switch(e.key){case"Enter":o(e);break;case"ArrowRight":{const i=c.indexOf(e.currentTarget)+1;n=c[i]??c[0];break}case"ArrowLeft":{const i=c.indexOf(e.currentTarget)-1;n=c[i]??c[c.length-1];break}}n?.focus()};return(0,v.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":i},n),children:t.map((e=>{let{value:n,label:i,attributes:l}=e;return(0,v.jsx)("li",{role:"tab",tabIndex:r===n?0:-1,"aria-selected":r===n,ref:e=>c.push(e),onKeyDown:h,onClick:o,...l,className:(0,s.Z)("tabs__item",m.tabItem,l?.className,{"tabs__item--active":r===n}),children:i??n},n)}))})}function b(e){let{lazy:n,children:i,selectedValue:s}=e;const l=(Array.isArray(i)?i:[i]).filter(Boolean);if(n){const e=l.find((e=>e.props.value===s));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return(0,v.jsx)("div",{className:"margin-top--md",children:l.map(((e,n)=>(0,r.cloneElement)(e,{key:n,hidden:e.props.value!==s})))})}function V(e){const n=p(e);return(0,v.jsxs)("div",{className:(0,s.Z)("tabs-container",m.tabList),children:[(0,v.jsx)(y,{...e,...n}),(0,v.jsx)(b,{...e,...n})]})}function f(e){const n=(0,g.Z)();return(0,v.jsx)(V,{...e,children:h(e.children)},String(n))}},510:(e,n,i)=>{i.d(n,{Z:()=>_});i(7294);const r=(e,n,i)=>e?"string"==typeof e?e:e[n]||i:i;var s=i(5893);const l={display:"block"},d=e=>{let{size:n,color:i,style:d,...t}=e;const c=d?{...l,...d}:l;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:c,...t,children:(0,s.jsx)("path",{d:"M856.4 292.8c-63.3-63.6-126.6-127.1-190.2-190.3-15.3-15.2-32.7-16.1-48.1-0.8-64.3 63.6-128.1 127.6-191.8 191.9-14 14.2-16.3 31.6-1.7 46 14.8 14.7 31.5 10.6 46.1-2.7 5.1-4.6 9.8-9.7 14.7-14.7 39.2-39.7 78.5-79.5 122.8-124.4 0 170 3 332.2-1.1 494-2.4 96.4-91.2 174.6-187.4 176.6-110.6 2.3-198.6-84.4-199-197.4-0.6-136.3-0.2-272.6-0.1-408.9 0-21.8-7.9-37.4-31.2-39.9-18.9-2-33.2 13.2-33.1 37.5 0 145.8-3.4 291.7 2.4 437.2 6 152.1 160.4 263.5 309.5 230.5C591.8 900 672.8 797.2 673.6 664.6c0.8-144 0.2-288.1 0.2-432.1v-33.3c11.2 10.2 17.6 15.4 23.3 21.3 38.5 38.4 76.7 77 115.3 115.2 14.8 14.6 32.2 19.2 47.8 2.9 13.8-14.8 10.3-31.7-3.8-45.8z",fill:r(i,0,"#333333")})})};d.defaultProps={size:18};const t=d,c={display:"block"},a=e=>{let{size:n,color:i,style:l,...d}=e;const t=l?{...c,...l}:c;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...d,children:[(0,s.jsx)("path",{d:"M143.872 768a51.2 51.2 0 0 1-15.36-2.56 51.2 51.2 0 0 1-35.328-51.2V283.136a148.992 148.992 0 0 1 141.824-153.6h450.56a148.992 148.992 0 0 1 141.824 153.6V512a148.992 148.992 0 0 1-141.824 153.6H244.224l-60.928 80.896a51.2 51.2 0 0 1-39.424 21.504zM235.008 180.224a97.792 97.792 0 0 0-90.624 102.4v430.592L218.624 614.4h466.944a97.792 97.792 0 0 0 90.624-102.4V283.136a97.792 97.792 0 0 0-90.624-102.4z",fill:r(i,0,"#333333")}),(0,s.jsx)("path",{d:"M880.128 875.52a51.2 51.2 0 0 1-39.424-20.48l-60.928-80.896h-243.2a25.6 25.6 0 0 1 0-51.2h268.8l76.288 102.4v-295.936a25.6 25.6 0 0 1 25.6-25.6 25.6 25.6 0 0 1 25.6 25.6v293.888a51.2 51.2 0 0 1-51.2 51.2z",fill:r(i,1,"#333333")})]})};a.defaultProps={size:18};const o=a,h={display:"block"},x=e=>{let{size:n,color:i,style:l,...d}=e;const t=l?{...h,...l}:h;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...d,children:[(0,s.jsx)("path",{d:"M223.425605 449.2744l161.632237 0 0 253.65714c0 16.954137 13.745049 30.699186 30.699186 30.699186 16.95516 0 30.699186-13.745049 30.699186-30.699186l0-284.356326c0-16.95516-13.744026-30.699186-30.699186-30.699186L291.035446 387.876028l217.23665-248.51605L733.039255 387.580293 607.104031 387.580293c-16.954137 0-30.699186 13.745049-30.699186 30.699186l0 284.652062c0 16.954137 13.745049 30.699186 30.699186 30.699186s30.699186-13.745049 30.699186-30.699186L637.803217 448.978664l164.448376 0c12.140505 0 23.140023-7.154957 28.063149-18.251689 4.922103-11.097756 2.841721-24.053835-5.307889-33.05279L530.62315 72.570829c-5.881964-6.495948-14.273075-10.134825-23.024389-10.091846-8.763594 0.076748-17.076934 3.895727-22.844288 10.494005L200.312188 398.371056c-7.92653 9.067516-9.818623 21.931498-4.839215 32.896224S211.383338 449.2744 223.425605 449.2744z",fill:r(i,0,"#333333")}),(0,s.jsx)("path",{d:"M222.354204 829.113381l581.732178 0c16.954137 0 30.699186-13.745049 30.699186-30.699186s-13.745049-30.699186-30.699186-30.699186L222.354204 767.715009c-16.954137 0-30.699186 13.745049-30.699186 30.699186S205.400067 829.113381 222.354204 829.113381z",fill:r(i,1,"#333333")}),(0,s.jsx)("path",{d:"M804.086381 896.729361 222.354204 896.729361c-16.954137 0-30.699186 13.745049-30.699186 30.699186s13.745049 30.699186 30.699186 30.699186l581.732178 0c16.954137 0 30.699186-13.745049 30.699186-30.699186S821.041542 896.729361 804.086381 896.729361z",fill:r(i,2,"#333333")})]})};x.defaultProps={size:18};const j=x,u={display:"block"},p=e=>{let{size:n,color:i,style:l,...d}=e;const t=l?{...u,...l}:u;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...d,children:(0,s.jsx)("path",{d:"M380.15463648 874.54223633c0 18.12744166-14.83154297 32.95898463-32.95898463 32.95898463s-32.95898463-14.83154297-32.95898462-32.95898463V228.9152832L172.71078883 370.86962865a33.04467773 33.04467773 0 0 1-46.60400416 0 33.04467773 33.04467773 0 0 1 0-46.6040034l197.55615234-198.14941406A32.76782227 32.76782227 0 0 1 347.0967749 116.52514674c0.03295924 0 0.06591772-0.03295924 0.09887695-0.03295924 1.54907201 0 2.90039088 0.69213867 4.41650366 0.88989258 2.66967773 0.39550781 5.40527318 0.59326172 7.94311548 1.61499049 12.03002904 4.94384766 20.59936549 16.71020508 20.59936549 30.45410156v725.0910642z m320.15698192 23.34155248a32.85351537 32.85351537 0 0 1-23.43383789 9.59106445c-0.03295924 0-0.06591772 0.03295924-0.09887696 0.03295924-1.54907201 0-2.90039088-0.69213867-4.41650365-0.92285182-2.70263697-0.36254857-5.40527318-0.56030248-7.94311549-1.61498972-12.03002904-4.91088842-20.59936549-16.67724584-20.59936473-30.42114309V149.45776367c0-18.12744166 14.83154297-32.95898463 32.95898387-32.95898463s32.95898463 14.83154297 32.95898463 32.95898463v645.60058619l141.52587916-141.92138697c12.81445313-12.82104467 33.81591797-12.82104467 46.63037109 0 12.78808619 12.81445313 12.78808619 33.77636719 0 46.60400416L700.3116184 897.88378881z",fill:r(i,0,"#333333")})})};p.defaultProps={size:18};const g=p,m={display:"block"},v=e=>{let{size:n,color:i,style:l,...d}=e;const t=l?{...m,...l}:m;return(0,s.jsx)("svg",{viewBox:"0 0 1172 1024",width:n+"px",height:n+"px",style:t,...d,children:(0,s.jsx)("path",{d:"M870.0416 250.4704a38.4 38.4 0 0 0-8.96 53.5552c13.056 18.2784 24.4224 37.8368 33.7408 58.112a38.4512 38.4512 0 0 0 50.944 18.8928 38.4512 38.4512 0 0 0 18.8416-50.944 436.0192 436.0192 0 0 0-40.96-70.6048 38.3488 38.3488 0 0 0-53.6064-9.0112zM181.4528 566.016a35.9936 35.9936 0 0 0 25.5488-10.5984L351.7952 410.624a36.096 36.096 0 1 0-51.0976-51.0976L217.6 442.5728C250.0096 278.1184 395.264 153.6 569.1392 153.6c50.7904 0 99.8912 10.3936 145.92 30.9248a38.4 38.4 0 1 0 31.232-70.0928 431.36 431.36 0 0 0-177.152-37.632c-214.6816 0-393.1136 156.416-428.4416 361.216L62.1568 359.4752a36.1984 36.1984 0 0 0-51.0976 51.0976l144.8448 144.7936a36.0448 36.0448 0 0 0 25.5488 10.6496zM978.5344 463.104a36.1984 36.1984 0 0 0-51.0976 0l-144.8448 144.7936a36.096 36.096 0 1 0 51.0976 51.0976l88.6272-88.576C894.3104 740.2496 746.8032 870.4 569.1392 870.4a357.7856 357.7856 0 0 1-325.2736-207.7184 38.4 38.4 0 1 0-69.7344 32.3072 434.3808 434.3808 0 0 0 394.9568 252.2112c215.1936 0 393.984-157.184 428.6464-362.7008l74.496 74.496a35.9936 35.9936 0 0 0 51.0976 0 36.096 36.096 0 0 0 0-51.0976l-144.7936-144.7936z",fill:r(i,0,"#333333")})})};v.defaultProps={size:18};const y=v,b={display:"block"},V=e=>{let{size:n,color:i,style:l,...d}=e;const t=l?{...b,...l}:b;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...d,children:[(0,s.jsx)("path",{d:"M302 332a30 30 0 1 1 0-60h420a30 30 0 0 1 0 60H302zM302 542a30 30 0 0 1 0-60h420a30 30 0 0 1 0 60H302zM302 752a30 30 0 0 1 0-60h120a30 30 0 0 1 0 60H302z",fill:r(i,0,"#333333")}),(0,s.jsx)("path",{d:"M789.47 784.1a30 30 0 0 1 39.36 45.3l-144.24 125.25a30 30 0 0 1-19.68 7.35H214.85C163.4 962 122 919.46 122 867.38V156.62C122 104.54 163.4 62 214.85 62h594.3C860.6 62 902 104.54 902 156.62v529.05a30 30 0 1 1-60 0V156.62C842 137.3 827.09 122 809.15 122H214.85C196.91 122 182 137.3 182 156.62v710.76C182 886.7 196.91 902 214.85 902h438.84l135.78-117.9z",fill:r(i,1,"#333333")}),(0,s.jsx)("path",{d:"M692 931.19a30 30 0 1 1-60 0v-174.6C632 704.57 673.4 662 724.85 662h147.78a30 30 0 0 1 0 60h-147.78c-17.94 0-32.85 15.3-32.85 34.62v174.6z",fill:r(i,2,"#333333")})]})};V.defaultProps={size:18};const f=V,T={display:"block"},N=e=>{let{size:n,color:i,style:l,...d}=e;const t=l?{...T,...l}:T;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...d,children:[(0,s.jsx)("path",{d:"M512 883.2A371.2 371.2 0 1 0 140.8 512 371.2 371.2 0 0 0 512 883.2z m0 64a435.2 435.2 0 1 1 435.2-435.2 435.2 435.2 0 0 1-435.2 435.2z",fill:r(i,0,"#333333")}),(0,s.jsx)("path",{d:"M557.056 512l122.368 122.368a31.744 31.744 0 1 1-45.056 45.056L512 557.056l-122.368 122.368a31.744 31.744 0 1 1-45.056-45.056L466.944 512 344.576 389.632a31.744 31.744 0 1 1 45.056-45.056L512 466.944l122.368-122.368a31.744 31.744 0 1 1 45.056 45.056z",fill:r(i,1,"#333333")})]})};N.defaultProps={size:18};const M=N,C={display:"block"},w=e=>{let{size:n,color:i,style:l,...d}=e;const t=l?{...C,...l}:C;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...d,children:[(0,s.jsx)("path",{d:"M940 512H792V412c76.8 0 139-62.2 139-139 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 34.8-28.2 63-63 63H232c-34.8 0-63-28.2-63-63 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 76.8 62.2 139 139 139v100H84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h148v96c0 6.5 0.2 13 0.7 19.3C164.1 728.6 116 796.7 116 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-44.2 23.9-82.9 59.6-103.7 6 17.2 13.6 33.6 22.7 49 24.3 41.5 59 76.2 100.5 100.5S460.5 960 512 960s99.8-13.9 141.3-38.2c41.5-24.3 76.2-59 100.5-100.5 9.1-15.5 16.7-31.9 22.7-49C812.1 793.1 836 831.8 836 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-79.3-48.1-147.4-116.7-176.7 0.4-6.4 0.7-12.8 0.7-19.3v-96h148c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM716 680c0 36.8-9.7 72-27.8 102.9-17.7 30.3-43 55.6-73.3 73.3-20.1 11.8-42 20-64.9 24.3V484c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v396.5c-22.9-4.3-44.8-12.5-64.9-24.3-30.3-17.7-55.6-43-73.3-73.3C317.7 752 308 716.8 308 680V412h408v268z",fill:r(i,0,"#333333")}),(0,s.jsx)("path",{d:"M304 280h56c4.4 0 8-3.6 8-8 0-28.3 5.9-53.2 17.1-73.5 10.6-19.4 26-34.8 45.4-45.4C450.9 142 475.7 136 504 136h16c28.3 0 53.2 5.9 73.5 17.1 19.4 10.6 34.8 26 45.4 45.4C650 218.9 656 243.7 656 272c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-40-8.8-76.7-25.9-108.1-17.2-31.5-42.5-56.8-74-74C596.7 72.8 560 64 520 64h-16c-40 0-76.7 8.8-108.1 25.9-31.5 17.2-56.8 42.5-74 74C304.8 195.3 296 232 296 272c0 4.4 3.6 8 8 8z",fill:r(i,1,"#333333")})]})};w.defaultProps={size:18};const D=w,A={display:"block"},I=e=>{let{size:n,color:i,style:l,...d}=e;const t=l?{...A,...l}:A;return(0,s.jsxs)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...d,children:[(0,s.jsx)("path",{d:"M512 71.68c-242.688 0-440.32 197.632-440.32 440.32s197.632 440.32 440.32 440.32 440.32-197.632 440.32-440.32-197.632-440.32-440.32-440.32z m0 819.2c-208.896 0-378.88-169.984-378.88-378.88s169.984-378.88 378.88-378.88 378.88 169.984 378.88 378.88-169.984 378.88-378.88 378.88z",fill:r(i,0,"#333333")}),(0,s.jsx)("path",{d:"M542.72 261.12H481.28v220.16H261.12v61.44h220.16v220.16h61.44v-220.16h220.16V481.28h-220.16z",fill:r(i,1,"#333333")})]})};I.defaultProps={size:18};const F=I,P={display:"block"},z=e=>{let{size:n,color:i,style:l,...d}=e;const t=l?{...P,...l}:P;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...d,children:(0,s.jsx)("path",{d:"M384 896h-64v-70.4c0-15.2-10.4-28-24.8-31.2C159.2 768 64 644.8 64 496v-32h64v32c0 118.4 73.6 215.2 179.2 236 44.8 8.8 76.8 48 76.8 94.4v69.6zM704 896h-64v-70.4c0-45.6 32-85.6 76.8-94.4C822.4 711.2 896 614.4 896 496v-32h64v32c0 148.8-95.2 272-231.2 298.4-14.4 3.2-24.8 16-24.8 31.2v70.4zM512.8 640l-41.6-37.6c-147.2-133.6-244-208-244-316.8 0-88 68.8-156.8 156.8-156.8 49.6 0 97.6 23.2 128.8 60C544 152 592 128.8 641.6 128.8c88 0 156.8 68.8 156.8 156.8 0 108-96.8 183.2-244 316.8L512.8 640z",fill:r(i,0,"#333333")})})};z.defaultProps={size:18};const S=z,L={display:"block"},E=e=>{let{size:n,color:i,style:l,...d}=e;const t=l?{...L,...l}:L;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...d,children:(0,s.jsx)("path",{d:"M942.4615936 284.62787926c-14.30911886-14.12709945-37.31996786-14.05468217-51.48229632 0.21920654L517.97142983 661.27810333 139.75544149 286.45003606c-14.30911886-14.16232846-37.31996786-14.05468217-51.51948344 0.21920654-14.16232846 14.30911886-14.05468217 37.35519687 0.21920654 51.51948345l401.99014627 398.34974663c0.61847666 0.61847666 1.41897273 0.76526706 2.03940637 1.34655658 0.14483342 0.14483342 0.18201941 0.32685283 0.32685283 0.47364324 7.09877874 7.02636259 16.38375538 10.55911595 25.63154489 10.55911595 9.35739278 0 18.75001458-3.60516949 25.85075143-10.77636551l398.34974663-401.99014628C956.84312974 321.8382427 956.73548345 298.7921647 942.4615936 284.62787926z",fill:r(i,0,"#333333")})})};E.defaultProps={size:18};const R=E,k={display:"block"},U=e=>{let{size:n,color:i,style:l,...d}=e;const t=l?{...k,...l}:k;return(0,s.jsx)("svg",{viewBox:"0 0 1024 1024",width:n+"px",height:n+"px",style:t,...d,children:(0,s.jsx)("path",{d:"M81.5384064 739.37212074c14.30911886 14.12709945 37.31996786 14.05468217 51.48229632-0.21920654L506.02857017 362.72189667 884.24455851 737.54996394c14.30911886 14.16232846 37.31996786 14.05468217 51.51948344-0.21920654 14.16232846-14.30911886 14.05468217-37.35519687-0.21920654-51.51948345l-401.99014627-398.34974663c-0.61847666-0.61847666-1.41897273-0.76526706-2.03940637-1.34655658-0.14483342-0.14483342-0.18201941-0.32685283-0.32685282-0.47364324-7.09877874-7.02636259-16.38375538-10.55911595-25.6315449-10.55911595-9.35739278 0-18.75001458 3.60516949-25.85075143 10.77636551l-398.34974663 401.99014628C67.15687026 702.1617573 67.26451655 725.2078353 81.5384064 739.37212074z",fill:r(i,0,"#333333")})})};U.defaultProps={size:18};const Z=U,B=e=>{let{name:n,...i}=e;switch(n){case"youhua":return(0,s.jsx)(t,{...i});case"dayi":return(0,s.jsx)(o,{...i});case"shengji":return(0,s.jsx)(j,{...i});case"tiaozheng":return(0,s.jsx)(g,{...i});case"gengxin":return(0,s.jsx)(y,{...i});case"wendang":return(0,s.jsx)(f,{...i});case"shanchu":return(0,s.jsx)(M,{...i});case"bug":return(0,s.jsx)(D,{...i});case"xinzeng":return(0,s.jsx)(F,{...i});case"fuwu":return(0,s.jsx)(S,{...i});case"down":return(0,s.jsx)(R,{...i});case"up":return(0,s.jsx)(Z,{...i})}return null},q={label:"label_p8vM",icon:"icon_knQK"};function _(e){const{children:n}=e,i={"\u65b0\u589e":{icon:"xinzeng",bgColor:"#39b54a"},"\u4fee\u590d":{icon:"bug",bgColor:"#9c26b0"},"\u6587\u6863":{icon:"wendang",bgColor:"rgb(79, 147, 255)"},"\u66f4\u65b0":{icon:"gengxin",bgColor:"#0081ff"},"\u8c03\u6574":{icon:"tiaozheng",bgColor:"#333"},"\u5347\u7ea7":{icon:"shengji",bgColor:"#e03997"},"\u79fb\u9664":{icon:"shanchu",bgColor:"#666"},"\u7b54\u7591":{icon:"dayi",bgColor:"#bbb"},"\u4f18\u5316":{icon:"youhua",bgColor:"#38e550"}};return(0,s.jsxs)("label",{className:q.label,title:n,style:{backgroundColor:i[n].bgColor},children:[(0,s.jsx)(B,{name:i[n].icon,color:"white",size:14,className:q.icon})," ",n]})}},1151:(e,n,i)=>{i.d(n,{Z:()=>t,a:()=>d});var r=i(7294);const s={},l=r.createContext(s);function d(e){const n=r.useContext(l);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function t(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:d(e.components),r.createElement(l.Provider,{value:n},e.children)}}}]);