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

12 months ago
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[9013],{5371:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>d,toc:()=>c});var r=t(5893),i=t(1151);const s={id:"dbcontext-filter",title:"9.24 \u5b9e\u4f53/\u5168\u5c40\u67e5\u8be2\u7b5b\u9009\u5668",sidebar_label:"9.24 \u5b9e\u4f53/\u5168\u5c40\u67e5\u8be2\u7b5b\u9009\u5668"},o=void 0,d={id:"dbcontext-filter",title:"9.24 \u5b9e\u4f53/\u5168\u5c40\u67e5\u8be2\u7b5b\u9009\u5668",description:"9.24.1 \u67e5\u8be2\u7b5b\u9009\u5668",source:"@site/docs/dbcontext-filter.mdx",sourceDirName:".",slug:"/dbcontext-filter",permalink:"/docs/dbcontext-filter",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/dbcontext-filter.mdx",tags:[],version:"current",lastUpdatedBy:"MonkSoul",lastUpdatedAt:1682389320,formattedLastUpdatedAt:"Apr 25, 2023",frontMatter:{id:"dbcontext-filter",title:"9.24 \u5b9e\u4f53/\u5168\u5c40\u67e5\u8be2\u7b5b\u9009\u5668",sidebar_label:"9.24 \u5b9e\u4f53/\u5168\u5c40\u67e5\u8be2\u7b5b\u9009\u5668"},sidebar:"docs",previous:{title:"9.23 \u5ba1\u8ba1\u65e5\u5fd7 (Audit)",permalink:"/docs/dbcontext-audit"},next:{title:"9.25 \u6570\u636e\u5e93\u64cd\u4f5c\u62e6\u622a\u5668",permalink:"/docs/dbcontext-Interceptor"}},l={},c=[{value:"9.24.1 \u67e5\u8be2\u7b5b\u9009\u5668",id:"9241-\u67e5\u8be2\u7b5b\u9009\u5668",level:2},{value:"9.24.2 \u591a\u79cd\u7b5b\u9009\u5668\u914d\u7f6e",id:"9242-\u591a\u79cd\u7b5b\u9009\u5668\u914d\u7f6e",level:2},{value:"9.24.2.1 \u5355\u8868\u7b5b\u9009\u5668",id:"92421-\u5355\u8868\u7b5b\u9009\u5668",level:3},{value:"9.24.2.2 \u5168\u5c40\u7b5b\u9009\u5668",id:"92422-\u5168\u5c40\u7b5b\u9009\u5668",level:3},{value:"9.24.3 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9243-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function a(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"9241-\u67e5\u8be2\u7b5b\u9009\u5668",children:"9.24.1 \u67e5\u8be2\u7b5b\u9009\u5668"}),"\n",(0,r.jsxs)(n.p,{children:["\u901a\u5e38\uff0c\u6211\u4eec\u7cfb\u7edf\u4e2d\u6709\u4e00\u4e9b\u7ef4\u62a4\u5b57\u6bb5\uff0c\u5982 ",(0,r.jsx)(n.code,{children:"IsDeleted"})," \u5b57\u6bb5\uff0c\u8fd9\u4e2a\u5b57\u6bb5\u7528\u6765\u6807\u8bc6\u7528\u6237\u5df2\u7ecf\u5220\u9664\u7684\u6570\u636e\uff0c\u90a3\u4e48\u6211\u4eec\u9700\u8981\u6bcf\u6b21\u67e5\u8be2\u6570\u636e\u7684\u65f6\u5019\u5e26\u4e0a\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u907f\u514d\u67e5\u8be2\u51fa\u4e0d\u8be5\u51fa\u73b0\u7684\u6570\u636e\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"Furion"})," \u63d0\u4f9b\u975e\u5e38\u7075\u6d3b\u65b9\u4fbf\u7684\u5168\u5c40\u67e5\u8be2\u7b5b\u9009\u5668\uff0c\u80fd\u591f\u5e94\u7528\u5230\u6bcf\u4e00\u6b21\u67e5\u8be2\u4e2d\u3002"]}),"\n",(0,r.jsx)(n.h2,{id:"9242-\u591a\u79cd\u7b5b\u9009\u5668\u914d\u7f6e",children:"9.24.2 \u591a\u79cd\u7b5b\u9009\u5668\u914d\u7f6e"}),"\n",(0,r.jsx)(n.h3,{id:"92421-\u5355\u8868\u7b5b\u9009\u5668",children:"9.24.2.1 \u5355\u8868\u7b5b\u9009\u5668"}),"\n",(0,r.jsxs)(n.p,{children:["\u5355\u8868\u7b5b\u9009\u5668\u5c31\u662f\u53ea\u9488\u5bf9\u7279\u5b9a\u5b9e\u4f53\u8fdb\u884c\u7b5b\u9009\u64cd\u4f5c\uff0c\u4f7f\u7528\u7b80\u5355\uff0c\u53ea\u9700\u8981\u5728\u7ee7\u627f ",(0,r.jsx)(n.code,{children:"IEntityTypeBuilder<TEntity>"})," \u63a5\u53e3\u5e76\u5b9e\u73b0\u5373\u53ef\uff0c\u5982\uff1a"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {8,24}",children:"using Furion.DatabaseAccessor;\r\nusing Microsoft.EntityFrameworkCore;\r\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\r\nusing System;\r\n\r\nnamespace Furion.Core\r\n{\r\n public class Person : Entity, IEntityTypeBuilder<Person>\r\n {\r\n public Person()\r\n {\r\n CreatedTime = DateTime.Now;\r\n IsDeleted = false;\r\n }\r\n\r\n public string Name { get; set; }\r\n\r\n public int Age { get; set; }\r\n\r\n