"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[74],{754:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>d,contentTitle:()=>i,default:()=>x,frontMatter:()=>s,metadata:()=>c,toc:()=>l});var t=r(5893),o=r(1151);const s={id:"dbcontext-start",title:"9.1 \u5165\u95e8\u7b80\u8981",sidebar_label:"9.1 \u5165\u95e8\u7b80\u8981 \u2728"},i=void 0,c={id:"dbcontext-start",title:"9.1 \u5165\u95e8\u7b80\u8981",description:"9.1.1 \u5165\u95e8\u51c6\u5907",source:"@site/docs/dbcontext-start.mdx",sourceDirName:".",slug:"/dbcontext-start",permalink:"/docs/dbcontext-start",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/dbcontext-start.mdx",tags:[],version:"current",lastUpdatedBy:"MonkSoul",lastUpdatedAt:1682389320,formattedLastUpdatedAt:"Apr 25, 2023",frontMatter:{id:"dbcontext-start",title:"9.1 \u5165\u95e8\u7b80\u8981",sidebar_label:"9.1 \u5165\u95e8\u7b80\u8981 \u2728"},sidebar:"docs",previous:{title:"9. \u6570\u636e\u5e93\u64cd\u4f5c\u6307\u5357\uff08EFCore\uff09",permalink:"/docs/category/efcore"},next:{title:"9.2 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",permalink:"/docs/dbcontext"}},d={},l=[{value:"9.1.1 \u5165\u95e8\u51c6\u5907",id:"911-\u5165\u95e8\u51c6\u5907",level:2},{value:"9.1.1.1 \u5b89\u88c5\u5bf9\u5e94\u6570\u636e\u5e93\u5305",id:"9111-\u5b89\u88c5\u5bf9\u5e94\u6570\u636e\u5e93\u5305",level:3},{value:"9.1.1.2 \u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"9112-\u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",level:3},{value:"9.1.1.3 \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32",id:"9113-\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32",level:3},{value:"9.1.1.4 \u5404\u7c7b\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u793a\u4f8b",id:"9114-\u5404\u7c7b\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u793a\u4f8b",level:3},{value:"9.1.1.5 \u6ce8\u518c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"9115-\u6ce8\u518c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",level:3},{value:"9.1.1.6 Code First \u8bf4\u660e",id:"9116-code-first-\u8bf4\u660e",level:3},{value:"9.1.2 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"912-\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",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"911-\u5165\u95e8\u51c6\u5907",children:"9.1.1 \u5165\u95e8\u51c6\u5907"}),"\n",(0,t.jsx)(n.admonition,{title:"\u5165\u95e8\u6761\u4ef6",type:"note",children:(0,t.jsxs)(n.p,{children:["\u5bf9 ",(0,t.jsx)(n.code,{children:"EF/EFCore"})," \u6709\u4e00\u5b9a\u57fa\u7840\u4e86\u89e3\uff0c\u8fd8\u672a\u63a5\u89e6\u7684\u53ef\u5148\u770b ",(0,t.jsx)(n.a,{href:"https://docs.microsoft.com/zh-cn/ef/core/",children:"\u3010EFCore \u57fa\u7840\u3011"})]})}),"\n",(0,t.jsx)(n.h3,{id:"9111-\u5b89\u88c5\u5bf9\u5e94\u6570\u636e\u5e93\u5305",children:"9.1.1.1 \u5b89\u88c5\u5bf9\u5e94\u6570\u636e\u5e93\u5305"}),"\n",(0,t.jsx)(n.admonition,{type:"tip",children:(0,t.jsxs)(n.p,{children:["\u5728\u672c\u7ae0\u8282\u6240\u5728\u7684\u7c7b\u522b\u4e2d\uff0c\u6240\u6709\u6570\u636e\u5e93\u64cd\u4f5c\u529f\u80fd\u5747\u9700\u8981\u4f9d\u8d56 ",(0,t.jsx)(n.code,{children:"EntityFramework Core"})," \u6846\u67b6\uff0c\u4f46 ",(0,t.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u5e95\u5c42\u5e76\u672a\u96c6\u6210 ",(0,t.jsx)(n.code,{children:"EntityFramework Core"})," \u5305\uff0c\u800c\u662f\u91c7\u7528\u52a8\u6001\u52a0\u8f7d\u7a0b\u5e8f\u96c6\u65b9\u5f0f\u81ea\u52a8\u8f7d\u5165\u3002"]})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsxs)(n.strong,{children:["\u6240\u4ee5\uff0c\u5982\u9700\u4f7f\u7528\u672c\u5927\u7c7b\u6570\u636e\u5e93\u529f\u80fd\uff0c\u9700\u5b89\u88c5\u5bf9\u5e94\u7684 ",(0,t.jsx)(n.code,{children:"EntityFramework Core"})," \u6570\u636e\u5e93\u5305\uff1a"]})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"SqlServer"}),"\uff1a",(0,t.jsx)(n.code,{children:"Microsoft.EntityFrameworkCore.SqlServer"})," (\u652f\u6301 SqlServer 2005 +)"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"Sqlite"}),"\uff1a",(0,t.jsx)(n.code,{children:"Microsoft.EntityFrameworkCore.Sqlite"})]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"Cosmos"}),"\uff1a",(0,t.jsx)(n.code,{children:"Microsoft.EntityFrameworkCore.Cosmos"})]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"InMemoryDatabase"}),"\uff1a",(0,t.jsx)(n.code,{children:"Microsoft.EntityFrameworkCore.InMemory"})]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"MySql"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"Pomelo.EntityFrameworkCore.MySql"}),"\uff1a(\u652f\u6301 MySql 5.x +)"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"MySql.EntityFrameworkCore"}),"\uff1a\u652f\u6301 (MySql 8.x +)"]}),"\n"]}),"\n"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"PostgreSQL"}),"\uff1a",(0,t.jsx)(n.code,{children:"Npgsql.EntityFrameworkCore.PostgreSQL"})]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"Oracle"}),"\uff1a",(0,t.jsx)(n.code,{children:"Oracle.EntityFrameworkCore"})," \uff08\u652f\u6301 Oracle 10 +\uff09"]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"Firebird"}),"\uff1a",(0,t.jsx)(n.code,{children:"FirebirdSql.EntityFrameworkCore.Firebird"})]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"Dm"}),"\uff1a",(0,t.jsx)(n.code,{children:"Microsoft.EntityFrameworkCore.Dm"})]}),"\n"]}),"\n",(0,t.jsx)(n.admonition,{title:"\u5c0f\u77e5\u8bc6",type:"tip",children:(0,t.jsxs)(n.p,{children:["\u8fd9\u4e9b\u6570\u636e\u5e93\u5305\u5e94\u8be5\u5b89\u88c5\u5728 ",(0,t.jsx)(n.code,{children:"YourProject.EntityFramework.Core"})," \u5c42\u3002\u7279\u6b8a\u60c5\u51b5\u9700\u5b89\u88c5\u5728 ",(0,t.jsx)(n.code,{children:"YourProject.Core"})," \u5c42\u4e2d\uff0c\u5982 ",(0,t.jsx)(n.code,{children:"Mysql"})," ",(0,t.jsx)(n.code,{children:"HasCharset()"})," \u914d\u7f6e\u3002"]})}),"\n",(0,t.jsx)(n.h3,{id:"9112-\u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:"9.1.1.2 \u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {7}",children:'using Furion.DatabaseAccessor;\r\nusing Microsoft.EntityFrameworkCore;\r\n\r\nnamespace Furion.EntityFramework.Core\r\n{\r\n [AppDbContext("Sqlite3ConnectionString", DbProvider.Sqlite)]\r\n public class DefaultDbContext : AppDbContext\r\n {\r\n public DefaultDbContext(DbContextOptions options) : base(options)\r\n {\r\n }\r\n }\r\n}\n'})}),"\n",(0,t.jsxs)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:[(0,t.jsxs)(n.p,{children:["\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u90fd\u9700\u7ee7\u627f ",(0,t.jsx)(n.code,{children:"AppDbContext"})," \u57fa\u7c7b\uff0c\u9ed8\u8ba4\u6570\u636e\u5e93\u7684 ",(0,t.jsx)(n.code,{children:"TDbContextLocator"})," \u4e3a ",(0,t.jsx)(n.code,{children:"MasterDbContextLocator"}),"\uff0c\u65e0\u9700\u663e\u5f0f\u7f16\u5199\u3002"]}),(0,t.jsxs)(n.p,{children:["\u975e\u9ed8\u8ba4\u6570\u636e\u5e93\u5219\u9700\u663e\u5f0f\u7ee7\u627f\u5e76\u7533\u660e\uff0c\u5982\uff1a",(0,t.jsx)(n.code,{children:"AppDbContext"}),"\u3002"]})]}),"\n",(0,t.jsxs)(n.p,{children:["\u60f3\u4e86\u89e3\u66f4\u591a\u53ef\u67e5\u9605 \u3010",(0,t.jsx)(n.a,{href:"./dbcontext-locator",children:"\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668"}),"\u3011 \u7ae0\u8282\u3002"]}),"\n",(0,t.jsx)(n.h3,{id:"9113-\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32",children:"9.1.1.3 \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32"}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u63d0\u4f9b\u591a\u79cd\u65b9\u5f0f\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff1a"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"appsettings.json"})," \u4e2d\u914d\u7f6e"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {2-3}",children:'{\r\n "ConnectionStrings": {\r\n "Sqlite3ConnectionString": "Data Source=./Furion.db"\r\n }\r\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["\u81ea\u5b9a\u4e49 ",(0,t.jsx)(n.code,{children:".json"})," \u6587\u4ef6\u914d\u7f6e"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",metastring:"showLineNumbers {2-3}",children:'{\r\n "ConnectionStrings": {\r\n "Sqlite3ConnectionString": "Data Source=./Furion.db"\r\n }\r\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["\u8be5\u65b9\u5f0f\u548c\u5728 ",(0,t.jsx)(n.code,{children:"appsettings.json"})," \u7684\u533a\u522b\u662f\u81ea\u5b9a\u4e49\u7684 ",(0,t.jsx)(n.code,{children:".json"})," \u6587\u4ef6\u4e0d\u4f1a\u81ea\u52a8\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c",(0,t.jsxs)(n.strong,{children:["\u987b\u5728 ",(0,t.jsx)(n.code,{children:"Visual Studio"})," \u4e2d\u914d\u7f6e ",(0,t.jsx)(n.code,{children:".json"})," \u53f3\u952e\u5c5e\u6027\uff0c\u8bbe\u7f6e ",(0,t.jsx)(n.code,{children:"\u590d\u5236"})," \u8f93\u51fa\u76ee\u5f55\u4e3a ",(0,t.jsx)(n.code,{children:"\u5982\u679c\u8f83\u65b0\u5219\u590d\u5236"}),"\uff0c\u751f\u6210\u64cd\u4f5c\u4e3a\uff1a",(0,t.jsx)(n.code,{children:"\u5185\u5bb9"}),"\u3002"]})]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"[AppDbContext]"})," \u7279\u6027\u914d\u7f6e"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {1}",children:'[AppDbContext("Data Source=./Furion.db", DbProvider.Sqlite)]\r\npublic class DefaultDbContext : AppDbContext\r\n{\r\n}\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"\u5728\u6ce8\u518c\u4e0a\u4e0b\u6587\u65f6\u914d\u7f6e"}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {3-4}",children:'services.AddDatabaseAccessor(options =>\r\n{\r\n // options.AddDb(connectionMetadata: "\u914d\u7f6eKey\u6216\u8fde\u63a5\u5b57\u7b26\u4e32");\r\n options.AddDbPool(connectionMetadata: "\u914d\u7f6eKey\u6216\u8fde\u63a5\u5b57\u7b26\u4e32");\r\n});\n'})}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["\u5728 ",(0,t.jsx)(n.code,{children:"DbContext"})," \u4e2d\u914d\u7f6e"]}),"\n"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {12-14}",children:'using Furion.DatabaseAccessor;\r\nusing Microsoft.EntityFrameworkCore;\r\n\r\nnamespace Furion.EntityFramework.Core\r\n{\r\n public class DefaultDbContext : AppDbContext\r\n {\r\n public DefaultDbContext(DbContextOptions options) : base(options)\r\n {\r\n }\r\n\r\n protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)\r\n {\r\n optionsBuilder.UseSqlite("\u8fde\u63a5\u5b57\u7b26\u4e32");\r\n base.OnConfiguring(optionsBuilder);\r\n }\r\n }\r\n}\n'})}),"\n",(0,t.jsx)(n.h3,{id:"9114-\u5404\u7c7b\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u793a\u4f8b",children:"9.1.1.4 \u5404\u7c7b\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u793a\u4f8b"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"Sqlite"}),"\uff1a",(0,t.jsx)(n.code,{children:"Data Source=./Furion.db"})]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"MySql"}),"\uff1a",(0,t.jsx)(n.code,{children:"Data Source=localhost;Database=Furion;User ID=root;Password=000000;pooling=true;port=3306;sslmode=none;CharSet=utf8;"})]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"SqlServer"}),"\uff1a",(0,t.jsx)(n.code,{children:"Server=localhost;Database=Furion;User=sa;Password=000000;MultipleActiveResultSets=True;Encrypt=True;TrustServerCertificate=True;"})]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"Oracle"}),"\uff1a",(0,t.jsx)(n.code,{children:"User Id=orcl;Password=orcl;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl)))"})]}),"\n",(0,t.jsxs)(n.li,{children:[(0,t.jsx)(n.code,{children:"PostgreSQL"}),"\uff1a",(0,t.jsx)(n.code,{children:"PORT=5432;DATABASE=postgres;HOST=127.0.0.1;PASSWORD=postgres;USER ID=postgres;"})]}),"\n"]}),"\n",(0,t.jsx)(n.h3,{id:"9115-\u6ce8\u518c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:"9.1.1.5 \u6ce8\u518c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:'showLineNumbers {12-19} title="Furion.EntityFramework.Core\\Startup.cs"',children:"using Furion.DependencyInjection;\r\nusing Microsoft.Extensions.DependencyInjection;\r\n\r\nnamespace Furion.EntityFramework.Core\r\n{\r\n [AppStartup(600)]\r\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\r\n {\r\n public void ConfigureServices(IServiceCollection services)\r\n {\r\n // \u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u652f\u6301N\u4e2a\u6570\u636e\u5e93\r\n services.AddDatabaseAccessor(options =>\r\n {\r\n // \u914d\u7f6e\u9ed8\u8ba4\u6570\u636e\u5e93\r\n options.AddDbPool();\r\n\r\n // \u914d\u7f6e\u591a\u4e2a\u6570\u636e\u5e93\uff0c\u591a\u4e2a\u6570\u636e\u5e93\u5fc5\u987b\u6307\u5b9a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\r\n // options.AddDbPool();\r\n });\r\n }\r\n }\r\n}\n"})}),"\n",(0,t.jsx)(n.admonition,{title:"\u4e86\u89e3\u66f4\u591a\u6570\u636e\u5e93\u6570\u636e\u5e93\u6ce8\u518c\u65b9\u5f0f",type:"tip",children:(0,t.jsxs)(n.p,{children:["\u5982\u9700\u4e86\u89e3\u5404\u79cd\u6570\u636e\u5e93\u53ca\u7248\u672c\u6ce8\u518c\u65b9\u5f0f\u53ef\u67e5\u9605 \u3010",(0,t.jsx)(n.a,{href:"/docs/dbcontext-multi-database",children:"9.19 \u591a\u6570\u636e\u5e93\u6ce8\u518c\u7ae0\u8282"}),"\u3011"]})}),"\n",(0,t.jsxs)(n.h3,{id:"9116-code-first-\u8bf4\u660e",children:["9.1.1.6 ",(0,t.jsx)(n.code,{children:"Code First"})," \u8bf4\u660e"]}),"\n",(0,t.jsxs)(n.admonition,{title:"\u7279\u522b\u6ce8\u610f",type:"important",children:[(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"Furion"})," \u6846\u67b6\u9ed8\u8ba4\u6570\u636e\u8fc1\u79fb\u7684\u7a0b\u5e8f\u96c6\u4e3a\uff1a",(0,t.jsx)(n.code,{children:"Furion.Database.Migrations"}),"\uff0c\u6240\u4ee5\u5982\u679c\u60a8\u6539\u4e86\u7a0b\u5e8f\u96c6\u540d\u79f0\u6216\u901a\u8fc7 ",(0,t.jsx)(n.code,{children:"NuGet"})," \u65b9\u5f0f\u5b89\u88c5\u7684 ",(0,t.jsx)(n.code,{children:"Furion"})," \u5305\uff0c\u5219\u9700\u8981\u914d\u7f6e\u8fc1\u79fb\u7a0b\u5e8f\u96c6\u540d\u79f0\uff1a"]}),(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {4}",children:'services.AddDatabaseAccessor(options =>\r\n{\r\n options.AddDbPool(DbProvider.Sqlite);\r\n}, "\u5b58\u653e\u8fc1\u79fb\u6587\u4ef6\u7684\u9879\u76ee\u540d\u79f0");\n'})}),(0,t.jsxs)(n.p,{children:["\u53e6\u5916\uff0c\u5982\u679c\u5e94\u7528\u4e2d\u914d\u7f6e\u4e86\u591a\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u90a3\u4e48\u6240\u6709\u7684 ",(0,t.jsx)(n.code,{children:"\u8fc1\u79fb\u547d\u4ee4"})," \u90fd\u9700\u8981\u6307\u5b9a ",(0,t.jsx)(n.code,{children:"-Context \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u540d\u79f0"})," \u53c2\u6570\u3002\u5982\uff1a"]}),(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-shell",metastring:"showLineNumbers",children:"Add-Migration v1.0.0 -Context DefaultDbContext\n"})})]}),"\n",(0,t.jsx)(n.h2,{id:"912-\u53cd\u9988\u4e0e\u5efa\u8bae",children:"9.1.2 \u53cd\u9988\u4e0e\u5efa\u8bae"}),"\n",(0,t.jsx)(n.admonition,{title:"\u4e0e\u6211\u4eec\u4ea4\u6d41",type:"note",children:(0,t.jsxs)(n.p,{children:["\u7ed9 Furion \u63d0 ",(0,t.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/new?issue",children:"Issue"}),"\u3002"]})})]})}function x(e={}){const{wrapper:n}={...(0,o.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}},1151:(e,n,r)=>{r.d(n,{Z:()=>c,a:()=>i});var t=r(7294);const o={},s=t.createContext(o);function i(e){const n=t.useContext(s);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]);