From 881cf8336193a4bda3ce63b1182fc3ffcbb26497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BE=E5=B0=8F=E5=83=A7?= Date: Tue, 13 Oct 2020 00:09:13 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=81=20update=20documents.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 6 +-- README.md | 6 +-- docs/01a85c17.10420435.js | 1 - docs/01a85c17.755a5885.js | 1 + docs/03ebb857.281807f2.js | 1 + docs/03ebb857.695212d0.js | 1 - docs/0ddd808e.1930f9f7.js | 1 + docs/0ddd808e.cf943861.js | 1 - docs/1.72c59440.js | 1 - docs/1.7bcff63a.js | 1 + docs/17256d0f.0dd677ec.js | 1 - docs/17256d0f.ea03f6fb.js | 1 + docs/1761adf3.0eeb8b92.js | 1 - docs/1761adf3.1568ad36.js | 1 + ...66df9.a5abd77b.js => 17666df9.40158a0a.js} | 2 +- docs/17896441.9aece880.js | 1 - docs/17896441.b0924391.js | 1 + docs/1be78505.572787d1.js | 1 + docs/1be78505.5f3cad14.js | 1 - ...b962e.4baa59fe.js => 1d7b962e.0af032df.js} | 2 +- ...61311.fef4867f.js => 1e961311.8fde9f00.js} | 2 +- docs/1ea356f4.543c45ed.js | 1 + docs/1ea356f4.c545d4f3.js | 1 - docs/2.b29b510d.js | 2 + ....LICENSE.txt => 2.b29b510d.js.LICENSE.txt} | 0 docs/2.da27712d.js | 2 - ...cd402.dad85cd2.js => 24dcd402.2112381e.js} | 2 +- ...2faa0.393c7313.js => 2792faa0.2dbf1923.js} | 2 +- ...cb773.c96e5bb6.js => 2a4cb773.4eabc39a.js} | 2 +- ...73ff4.b4cb8011.js => 2ae73ff4.439f6355.js} | 2 +- ...4a543.9fc467bd.js => 2b04a543.a459a757.js} | 2 +- docs/3.9f5a92b9.js | 1 + docs/3.b6ccd44c.js | 1 - ...20422.bd14d00b.js => 34420422.c3fd76ca.js} | 2 +- ...93c62.d48973ba.js => 36793c62.7d5d0b0d.js} | 2 +- ...dbab2.2beebf2b.js => 3a6dbab2.29e48f17.js} | 2 +- docs/3ab56fdf.08967bbc.js | 1 + docs/3ab56fdf.238047c3.js | 1 - ...69f93.8686d66c.js => 3e869f93.1a6c3c3e.js} | 2 +- docs/404.html | 12 ++--- ...ae89d.0e87c449.js => 408ae89d.edc822b6.js} | 2 +- ...0ce4d.e8539812.js => 4930ce4d.c5b9be77.js} | 2 +- docs/4bfcf3ee.9fd3cf97.js | 1 - docs/4bfcf3ee.bb6afc05.js | 1 + docs/4c30b939.4343bb83.js | 1 + docs/4c30b939.d21427f9.js | 1 - docs/4dbcf072.43551049.js | 1 - docs/4dbcf072.ceefa0fc.js | 1 + ...694ae.befe978c.js => 4e3694ae.8a08238f.js} | 2 +- docs/59d16f51.17fe308b.js | 1 - docs/59d16f51.db2a93e5.js | 1 + ...ee1d6.84f4a477.js => 5c4ee1d6.203043c2.js} | 2 +- ...0ebbd.4ab6a852.js => 5ce0ebbd.ef7d4828.js} | 2 +- docs/5e077782.5c58ae24.js | 1 - docs/5e077782.ad54b8c8.js | 1 + docs/62953dcd.c5d8591d.js | 1 + docs/62953dcd.dc05b734.js | 1 - ...ac364.b869a9ae.js => 654ac364.809adb42.js} | 2 +- docs/6875c492.5589b6a0.js | 1 - docs/6875c492.a75dca0e.js | 1 + ...99f3e.0d9dc710.js => 70699f3e.e08b1731.js} | 0 ...6a0ae.872ee861.js => 7696a0ae.086cf378.js} | 0 ...b163f.4808d427.js => 7b4b163f.15151a0b.js} | 0 ...b3a8a.f2448b6a.js => 7c7b3a8a.2ecfb225.js} | 0 ...779e7.ef765193.js => 7d3779e7.1e9fe094.js} | 0 ...1c802.f5780f8f.js => 8231c802.2ec6250f.js} | 0 docs/85.0018927c.js | 1 - docs/85.7e646109.js | 1 + docs/86.763e07e0.js | 1 + ...f9761.f64cda87.js => 8bbf9761.498ce4f9.js} | 0 ...b7b33.016f2f3a.js => 8e2b7b33.b2e4bfed.js} | 0 ...d8112.665063e4.js => 902d8112.7316b98d.js} | 2 +- ...cf40b.09e071c4.js => 904cf40b.8359e8f3.js} | 0 ...3ef29.22942c40.js => 97c3ef29.dc2fde2b.js} | 0 ...ac8f0.b38ef64e.js => 9bdac8f0.63c881d2.js} | 0 ...3dc31.7638bbc5.js => a133dc31.c0b1f43b.js} | 2 +- ...8d5cc.44b37d46.js => a688d5cc.cb046acd.js} | 0 docs/a6aa9e1f.005e050b.js | 1 + docs/a6aa9e1f.dad92990.js | 1 - ...774ac.19465b58.js => a74774ac.c040e8b1.js} | 0 ...e9b99.0b631e94.js => af3e9b99.5cd3f05b.js} | 2 +- ...e1305.06a3f89a.js => b0be1305.f704cfc2.js} | 0 docs/b30e5fe3.41db337f.js | 1 - docs/b30e5fe3.b1981ed6.js | 1 + ...c29d5.100571d2.js => b80c29d5.051540d5.js} | 0 docs/blog/index.html | 48 ++++++++++------- docs/blog/tags/fur/index.html | 44 ++++++++++------ docs/blog/tags/furos/index.html | 48 ++++++++++------- docs/blog/tags/index.html | 36 ++++++++----- docs/blog/tags/net-5/index.html | 44 ++++++++++------ docs/blog/tags/net/index.html | 44 ++++++++++------ docs/blog/tags/netcore/index.html | 44 ++++++++++------ docs/blog/welcome/index.html | 46 ++++++++++------ ...6980b.530a8035.js => c456980b.bfa3e0aa.js} | 0 ...a942e.ba8927ad.js => cb0a942e.b51b137c.js} | 0 docs/ccc49370.0b963bc5.js | 1 + docs/ccc49370.3426e43a.js | 1 - ...206bc.c82f0f14.js => d3c206bc.8c5ab558.js} | 2 +- ...e75d5.89d8c15a.js => d3ee75d5.44c18a13.js} | 0 ...b3010.eaa01519.js => d43b3010.30d52cd3.js} | 0 ...bb0e0.35e8ea68.js => d80bb0e0.8acf41d2.js} | 0 ...8d2dc.1ab280a0.js => d8c8d2dc.2041bc52.js} | 0 ...92c54.6ec458d9.js => d8f92c54.ddc0a31f.js} | 0 ...0b9c8.92049b15.js => dc10b9c8.05bc6c75.js} | 0 ...2fede.c67f06e6.js => dea2fede.dbba7be7.js} | 2 +- docs/docs/answer/index.html | 50 +++++++++++------- docs/docs/appstartup/index.html | 50 +++++++++++------- docs/docs/auth-control/index.html | 50 +++++++++++------- docs/docs/author/index.html | 50 +++++++++++------- docs/docs/cache/index.html | 50 +++++++++++------- docs/docs/configuration/index.html | 50 +++++++++++------- docs/docs/contribute/index.html | 50 +++++++++++------- docs/docs/cors/index.html | 50 +++++++++++------- docs/docs/data-validation/index.html | 50 +++++++++++------- docs/docs/dbcontext-Interceptor/index.html | 50 +++++++++++------- docs/docs/dbcontext-add-or-update/index.html | 50 +++++++++++------- docs/docs/dbcontext-add/index.html | 50 +++++++++++------- docs/docs/dbcontext-audit/index.html | 50 +++++++++++------- docs/docs/dbcontext-batch/index.html | 50 +++++++++++------- docs/docs/dbcontext-code-first/index.html | 50 +++++++++++------- docs/docs/dbcontext-db-first/index.html | 50 +++++++++++------- docs/docs/dbcontext-delete/index.html | 50 +++++++++++------- docs/docs/dbcontext-filter/index.html | 50 +++++++++++------- docs/docs/dbcontext-function/index.html | 50 +++++++++++------- docs/docs/dbcontext-hight-query/index.html | 50 +++++++++++------- docs/docs/dbcontext-locator/index.html | 50 +++++++++++------- docs/docs/dbcontext-multi-database/index.html | 50 +++++++++++------- docs/docs/dbcontext-proc/index.html | 50 +++++++++++------- docs/docs/dbcontext-query/index.html | 50 +++++++++++------- docs/docs/dbcontext-read-write/index.html | 50 +++++++++++------- docs/docs/dbcontext-repository/index.html | 50 +++++++++++------- docs/docs/dbcontext-seed-data/index.html | 50 +++++++++++------- docs/docs/dbcontext-sql-proxy/index.html | 50 +++++++++++------- docs/docs/dbcontext-sql-template/index.html | 50 +++++++++++------- docs/docs/dbcontext-sql/index.html | 50 +++++++++++------- docs/docs/dbcontext-update/index.html | 50 +++++++++++------- docs/docs/dbcontext-view/index.html | 50 +++++++++++------- docs/docs/dbcontext/index.html | 50 +++++++++++------- docs/docs/dependency-injection/index.html | 50 +++++++++++------- docs/docs/deploy/index.html | 50 +++++++++++------- docs/docs/devops/index.html | 50 +++++++++++------- docs/docs/dynamic-api-controller/index.html | 50 +++++++++++------- docs/docs/entity/index.html | 50 +++++++++++------- docs/docs/errors/index.html | 50 +++++++++++------- docs/docs/event-bus/index.html | 50 +++++++++++------- docs/docs/friendly-exception/index.html | 50 +++++++++++------- docs/docs/get-start/index.html | 50 +++++++++++------- docs/docs/gooduse/index.html | 50 +++++++++++------- docs/docs/grpc/index.html | 50 +++++++++++------- docs/docs/http/index.html | 50 +++++++++++------- docs/docs/index.html | 52 +++++++++++-------- docs/docs/job/index.html | 50 +++++++++++------- docs/docs/local-language/index.html | 50 +++++++++++------- docs/docs/logging/index.html | 50 +++++++++++------- docs/docs/object-mapper/index.html | 50 +++++++++++------- docs/docs/options/index.html | 50 +++++++++++------- docs/docs/performance/index.html | 50 +++++++++++------- docs/docs/process-service/index.html | 50 +++++++++++------- docs/docs/reference/index.html | 50 +++++++++++------- docs/docs/saas/index.html | 50 +++++++++++------- docs/docs/signalr/index.html | 50 +++++++++++------- docs/docs/source/index.html | 50 +++++++++++------- docs/docs/specification-document/index.html | 50 +++++++++++------- docs/docs/split-db/index.html | 50 +++++++++++------- docs/docs/tran/index.html | 50 +++++++++++------- docs/docs/unittest/index.html | 50 +++++++++++------- docs/docs/view-engine/index.html | 50 +++++++++++------- ...78751.32876613.js => e0678751.1b3a8d90.js} | 2 +- ...13ffa.f1e4e3c8.js => e1713ffa.f86c14eb.js} | 2 +- ...e61ad.088b77e2.js => e50e61ad.d35151ac.js} | 0 ...46b20.50623fe1.js => e6346b20.65714baf.js} | 0 ...62f29.d44ea22f.js => e6c62f29.10beb0c1.js} | 2 +- docs/ece76bd1.73422ad5.js | 1 - docs/ece76bd1.9c5d7374.js | 1 + ...53588.bfe4bdd2.js => f9353588.e30dce03.js} | 2 +- ...29204.0f5c487b.js => fa529204.1901aecb.js} | 0 docs/index.html | 36 ++++++++----- docs/main.2cb9d26e.js | 2 - docs/main.91003072.js | 2 + ...CENSE.txt => main.91003072.js.LICENSE.txt} | 0 docs/runtime~main.81a22837.js | 1 + docs/runtime~main.915bd3ad.js | 1 - docs/styles.1af3f57f.js | 1 + docs/styles.8352e18a.js | 1 - framework/.editorconfig | 2 +- framework/Fur/App/App.cs | 2 +- .../Fur/App/Attributes/AppStartupAttribute.cs | 2 +- .../AppApplicationBuilderExtensions.cs | 2 +- .../AppServiceCollectionExtensions.cs | 2 +- .../App/Extensions/Types/ObjectExtensions.cs | 2 +- .../Extensions/WebHostBuilderExtensions.cs | 2 +- framework/Fur/App/Filters/StartupFilter.cs | 2 +- .../Fur/App/Options/AppSettingsOptions.cs | 2 +- framework/Fur/App/Proxies/IDispatchProxy.cs | 2 +- framework/Fur/App/Startups/AppStartup.cs | 2 +- framework/Fur/App/Startups/HostingStartup.cs | 2 +- .../Attributes/AuthorizePolicyAttribute.cs | 2 +- ...uthorizationServiceCollectionExtensions.cs | 2 +- .../Handlers/AuthorizePolicyHandler.cs | 2 +- .../Options/JWTSettingsOptions.cs | 2 +- framework/Fur/Authorization/Penetrates.cs | 2 +- .../Providers/AuthorizePolicyProvider.cs | 2 +- .../AuthorizePolicyRequirement.cs | 2 +- .../Attributes/OptionsSettingsAttribute.cs | 2 +- ...rableOptionsServiceCollectionExtensions.cs | 2 +- .../Options/IConfigurableOptions.cs | 2 +- ...orsAccessorApplicationBuilderExtensions.cs | 2 +- ...CorsAccessorServiceCollectionExtensions.cs | 2 +- .../Options/CorsAccessorSettingsOptions.cs | 2 +- framework/Fur/DataEncryption/AESEncryption.cs | 2 +- .../Fur/DataEncryption/DESCEncryption.cs | 2 +- framework/Fur/DataEncryption/MD5Encryption.cs | 2 +- .../Attributes/DataValidationAttribute.cs | 2 +- .../Attributes/NonValidationAttribute.cs | 2 +- .../ValidationItemMetadataAttribute.cs | 2 +- .../Attributes/ValidationMessageAttribute.cs | 2 +- .../ValidationMessageTypeAttribute.cs | 2 +- .../Attributes/ValidationTypeAttribute.cs | 2 +- .../DataValidation/Enums/ValidationPattern.cs | 2 +- .../DataValidation/Enums/ValidationTypes.cs | 2 +- .../Extensions/DataValidationExtensions.cs | 2 +- ...taValidationServiceCollectionExtensions.cs | 2 +- .../Filters/DataValidationFilter.cs | 2 +- .../Models/DataValidationResult.cs | 2 +- .../ValidationTypeMessageSettingsOptions.cs | 2 +- .../IValidationMessageTypeProvider.cs | 2 +- .../Validators/DataValidator.cs | 2 +- .../Basics/SqlObjectProxyAttribute.cs | 2 +- .../Attributes/Basics/SqlProxyAttribute.cs | 2 +- .../Basics/SqlSentenceProxyAttribute.cs | 2 +- .../Attributes/SqlExecuteAttribute.cs | 2 +- .../Attributes/SqlFunctionAttribute.cs | 2 +- .../Attributes/SqlProcedureAttribute.cs | 2 +- .../Dependencies/ISqlDispatchProxy.cs | 2 +- .../Advances/Models/SqlProxyMethod.cs | 2 +- .../Advances/Proxies/SqlDispatchProxy.cs | 2 +- .../Attributes/DbParameterAttribute.cs | 2 +- .../DatabaseAccessor/Contexts/AppDbContext.cs | 2 +- .../Attributes/AppDbContextAttribute.cs | 2 +- .../Contexts/Builders/AppDbContextBuilder.cs | 2 +- .../Models/DbContextCorrelationType.cs | 2 +- framework/Fur/DatabaseAccessor/Db.cs | 2 +- .../DynamicModelCacheKeyFactory.cs | 2 +- .../DynamicModels/IEntityMutableTable.cs | 2 +- .../Attributes/FakeDeleteAttribute.cs | 2 +- .../Attributes/NonAutomaticAttribute.cs | 2 +- .../Attributes/QueryableFunctionAttribute.cs | 2 +- .../Entities/Configures/IEntitySeedData.cs | 2 +- .../Entities/Configures/IEntityTypeBuilder.cs | 2 +- .../Configures/IModelBuilderFilter.cs | 2 +- .../Configures/IPrivateModelBuilder.cs | 2 +- .../Entities/Dependencies/Entity.cs | 2 +- .../Entities/Dependencies/EntityBase.cs | 2 +- .../Entities/Dependencies/EntityNotKey.cs | 2 +- .../Entities/Dependencies/IEntity.cs | 2 +- .../Entities/Dependencies/IEntityNotKey.cs | 2 +- .../DatabaseAccessor/Enums/DbFunctionType.cs | 2 +- .../DatabaseAccessor/Enums/ManualOptions.cs | 2 +- ...baseAccessorServiceCollectionExtensions.cs | 2 +- .../DatabaseFacade/DbDataConvertExtensions.cs | 2 +- .../DatabaseFacade/DbObjectExtensions.cs | 2 +- .../DatabaseFacade/SqlAdoNetExtensions.cs | 2 +- ...baseProviderServiceCollectionExtensions.cs | 2 +- .../Extensions/DatabaseProvider/Penetrates.cs | 2 +- .../Extensions/PagedQueryableExtensions.cs | 2 +- .../Repositories/IEntityExtensions.cs | 2 +- .../IEntityWithDbContextLocatorExtensions.cs | 2 +- .../Extensions/Repositories/SqlExtensions.cs | 2 +- .../Fur/DatabaseAccessor/Helpers/DbHelpers.cs | 2 +- .../DbContextSaveChangesInterceptor.cs | 2 +- .../SqlCommandProfilerInterceptor.cs | 2 +- .../SqlConnectionProfilerInterceptor.cs | 2 +- .../Locators/IDbContextLocator.cs | 2 +- .../Locators/MasterDbContextLocator.cs | 2 +- .../Fur/DatabaseAccessor/Models/DbProvider.cs | 2 +- .../Fur/DatabaseAccessor/Models/PagedList.cs | 2 +- .../Models/ProcedureOutputResult.cs | 2 +- .../Models/ProcedureOutputValue.cs | 2 +- .../DatabaseAccessor/Models/SqlTemplate.cs | 2 +- .../Models/SqlTemplateParameter.cs | 2 +- .../Dependencies/IMultiTenantOnDatabase.cs | 2 +- .../Dependencies/IMultiTenantOnSchema.cs | 2 +- .../Dependencies/IMultiTenantOnTable.cs | 2 +- .../Dependencies/IPrivateMultiTenant.cs | 2 +- .../MultiTenants/Entities/Tenant.cs | 2 +- .../MultiTenants/Enums/MultiTenantOptions.cs | 2 +- .../Locators/MultiTenantDbContextLocator.cs | 2 +- .../DatabaseAccessor/Pools/DbContextPool.cs | 2 +- .../DatabaseAccessor/Pools/IDbContextPool.cs | 2 +- .../Dependencies/IDeletableRepository.cs | 2 +- .../Dependencies/IInsertableRepository.cs | 2 +- .../Dependencies/IOperableRepository.cs | 2 +- .../Dependencies/IReadableRepository.cs | 2 +- .../Dependencies/IRepositoryDependency.cs | 2 +- .../Dependencies/ISqlExecutableRepository.cs | 2 +- .../Dependencies/ISqlReaderRepository.cs | 2 +- .../Dependencies/IUpdateableRepository.cs | 2 +- .../Dependencies/IWritableRepository.cs | 2 +- .../Repositories/EFCoreRepository.cs | 2 +- .../Repositories/IMSRepository.cs | 2 +- .../Repositories/IRepository.cs | 2 +- .../Repositories/ISqlRepository.cs | 2 +- .../Implantations/DeletableRepository.cs | 2 +- .../Implantations/InsertableRepository.cs | 2 +- .../Implantations/OperableRepository.cs | 2 +- .../Implantations/ReadableRepository.cs | 2 +- .../Implantations/SqlExecutableRepository.cs | 2 +- .../Implantations/SqlReaderRepository.cs | 2 +- .../Implantations/UpdateableRepository.cs | 2 +- .../Implantations/WritableRepository.cs | 2 +- .../Repositories/MSRepository.cs | 2 +- .../Repositories/SqlRepository.cs | 2 +- .../Attributes/NonTransactAttribute.cs | 2 +- .../Attributes/UnitOfWorkAttribute.cs | 2 +- .../UnitOfWork/Filters/UnitOfWorkFilter.cs | 2 +- .../Attributes/InjectionAttribute.cs | 2 +- .../Attributes/SkipScanAttribute.cs | 2 +- .../Dependencies/IPrivateDependency.cs | 2 +- .../Dependencies/IScoped.cs | 2 +- .../Dependencies/ISingleton.cs | 2 +- .../Dependencies/ITransient.cs | 2 +- .../Enums/InjectionActions.cs | 2 +- .../Enums/InjectionPatterns.cs | 2 +- .../DependencyInjection/Enums/RegisterType.cs | 2 +- ...ncyInjectionServiceCollectionExtensions.cs | 2 +- .../Models/ExternalService.cs | 2 +- .../DependencyInjectionSettingsOptions.cs | 2 +- .../ApiDescriptionSettingsAttribute.cs | 2 +- .../Attributes/ApiSeatAttribute.cs | 2 +- .../DynamicApiControllerAttribute.cs | 2 +- ...ApiControllerApplicationModelConvention.cs | 2 +- .../Dependencies/IDynamicApiController.cs | 2 +- .../DynamicApiController/Enums/ApiSeats.cs | 2 +- ...piControllerServiceCollectionExtensions.cs | 2 +- .../Models/ParameterRouteTemplate.cs | 2 +- .../DynamicApiControllerSettingsOptions.cs | 2 +- .../Fur/DynamicApiController/Penetrates.cs | 2 +- .../DynamicApiControllerFeatureProvider.cs | 2 +- .../ErrorCodeItemMetadataAttribute.cs | 2 +- .../Attributes/ErrorCodeTypeAttribute.cs | 2 +- .../Attributes/IfExceptionAttribute.cs | 2 +- ...dlyExceptionServiceCollectionExtensions.cs | 2 +- .../Filters/FriendlyExceptionFilter.cs | 2 +- .../Models/MethodIfException.cs | 2 +- framework/Fur/FriendlyException/Oops.cs | 2 +- .../ErrorCodeMessageSettingsOptions.cs | 2 +- .../Providers/IErrorCodeTypeProvider.cs | 2 +- framework/Fur/Fur.csproj | 2 +- framework/Fur/FurStartup.cs | 2 +- .../LinqBuilder/Builders/LinqExpression.cs | 2 +- .../LinqBuilder/Extensions/LinqExtensions.cs | 2 +- .../ParameterReplaceExpressionVisitor.cs | 2 +- .../Dependencies/IObjectMapper.cs | 2 +- ...ObjectMapperServiceCollectionExtensions.cs | 2 +- .../Builders/SpecificationDocumentBuilder.cs | 2 +- ...ionDocumentApplicationBuilderExtensions.cs | 2 +- ...tionDocumentServiceCollectionExtensions.cs | 2 +- .../Models/GroupOrder.cs | 2 +- .../Models/SpecificationOpenApiInfo.cs | 2 +- ...ificationOpenApiSecurityRequirementItem.cs | 2 +- .../SpecificationOpenApiSecurityScheme.cs | 2 +- .../SpecificationDocumentSettingsOptions.cs | 2 +- .../UnifyResultServiceCollectionExtensions.cs | 2 +- .../Filters/SuccessUnifyResultFilter.cs | 2 +- .../Fur/UnifyResult/Models/RESTfulResult.cs | 2 +- .../Providers/IUnifyResultProvider.cs | 2 +- .../Providers/RESTfulResultProvider.cs | 2 +- .../IViewEngineCompilationOptionsBuilder.cs | 2 +- .../ViewEngineCompilationOptionsBuilder.cs | 2 +- .../ViewEngineCompilationException.cs | 2 +- .../Exceptions/ViewEngineException.cs | 2 +- framework/Fur/ViewEngine/IViewEngine.cs | 2 +- .../ViewEngine/Models/AnonymousTypeWrapper.cs | 2 +- .../Options/ViewEngineCompilationOptions.cs | 2 +- .../Templates/IViewEngineCompiledTemplate.cs | 2 +- .../Templates/IViewEngineTemplate.cs | 2 +- .../Templates/ViewEngineCompiledTemplate.cs | 2 +- .../Templates/ViewEngineTemplate.cs | 2 +- framework/Fur/ViewEngine/ViewEngine.cs | 2 +- handbook/blog/2020-08-19-welcome.mdx | 6 +-- handbook/build/01a85c17.10420435.js | 1 - handbook/build/01a85c17.755a5885.js | 1 + handbook/build/03ebb857.68df0095.js | 1 + handbook/build/03ebb857.bdee66fe.js | 1 - handbook/build/0ddd808e.2c8cd92c.js | 1 + handbook/build/0ddd808e.d77719f9.js | 1 - handbook/build/1.72c59440.js | 1 - handbook/build/1.7bcff63a.js | 1 + handbook/build/17256d0f.24ed78c9.js | 1 + handbook/build/17256d0f.c1719a38.js | 1 - handbook/build/1761adf3.04caff3c.js | 1 + handbook/build/1761adf3.37f331f5.js | 1 - ...66df9.37cd28d0.js => 17666df9.8adabc49.js} | 2 +- handbook/build/17896441.9aece880.js | 1 - handbook/build/17896441.b0924391.js | 1 + handbook/build/1be78505.572787d1.js | 1 + handbook/build/1be78505.5f3cad14.js | 1 - ...b962e.7e7e2e9f.js => 1d7b962e.820f297f.js} | 2 +- ...61311.d7cc7b4c.js => 1e961311.b621d684.js} | 2 +- handbook/build/1ea356f4.20872c32.js | 1 + handbook/build/1ea356f4.65bf0784.js | 1 - handbook/build/2.b29b510d.js | 1 + ....LICENSE.txt => 2.b29b510d.js.LICENSE.txt} | 0 handbook/build/2.da27712d.js | 1 - ...7023c.5c499293.js => 23e7023c.e2a3d6fe.js} | 2 +- ...cd402.931bd557.js => 24dcd402.197c70e3.js} | 2 +- ...2faa0.c8b601b5.js => 2792faa0.a6b91f55.js} | 2 +- ...cb773.949fd694.js => 2a4cb773.5d04da26.js} | 2 +- ...73ff4.074eace3.js => 2ae73ff4.0dc5635e.js} | 2 +- ...4a543.660f2802.js => 2b04a543.e4fcde37.js} | 2 +- handbook/build/3.8b225e2c.js | 1 + handbook/build/3.b6ccd44c.js | 1 - ...20422.f54e4fab.js => 34420422.9d060c20.js} | 2 +- ...93c62.81252910.js => 36793c62.5482922b.js} | 2 +- ...dbab2.89038ec6.js => 3a6dbab2.a1543954.js} | 2 +- handbook/build/3ab56fdf.8fbeb15b.js | 1 - handbook/build/3ab56fdf.de5e8564.js | 1 + ...69f93.305c87c2.js => 3e869f93.fba38820.js} | 2 +- handbook/build/404.html | 12 ++--- ...ae89d.fa344557.js => 408ae89d.10fda153.js} | 2 +- ...819e6.14b77875.js => 409819e6.b31dfeb8.js} | 2 +- ...0ce4d.867af8f3.js => 4930ce4d.c11fc6ee.js} | 2 +- handbook/build/4bfcf3ee.09b86c5e.js | 1 - handbook/build/4bfcf3ee.b3c885ee.js | 1 + handbook/build/4c30b939.5c88910c.js | 1 + handbook/build/4c30b939.f6421a33.js | 1 - handbook/build/4dbcf072.1865a6c7.js | 1 + handbook/build/4dbcf072.86aa2a4d.js | 1 - ...ad03e.7367e18f.js => 4efad03e.c3d32481.js} | 2 +- ...b9089.4330aea1.js => 525b9089.9b02f78b.js} | 2 +- handbook/build/59d16f51.47e86a00.js | 1 - handbook/build/59d16f51.df5c6ffe.js | 1 + ...0ebbd.e81097b1.js => 5ce0ebbd.2139530d.js} | 2 +- handbook/build/5e077782.49e1c594.js | 1 - handbook/build/5e077782.e53c258a.js | 1 + handbook/build/62953dcd.b8dcc3f0.js | 1 + handbook/build/62953dcd.c8565443.js | 1 - ...ac364.56187509.js => 654ac364.7c423e34.js} | 2 +- ...76b72.841838a5.js => 66076b72.5bddb78f.js} | 2 +- handbook/build/6875c492.45df4276.js | 1 - handbook/build/6875c492.bf13b5a4.js | 1 + ...99f3e.ab80af1c.js => 70699f3e.5f2e4588.js} | 0 ...6a0ae.5c74cfa6.js => 7696a0ae.7bda700a.js} | 0 ...b163f.dcdeae35.js => 7b4b163f.0d2f4dd8.js} | 0 ...b3a8a.a8db9a6c.js => 7c7b3a8a.b72235f7.js} | 0 ...779e7.adaf5a3d.js => 7d3779e7.1e72ca3f.js} | 0 ...1c802.e9b1c61b.js => 8231c802.ba31d790.js} | 0 handbook/build/85.0018927c.js | 1 - handbook/build/85.7e646109.js | 1 + handbook/build/86.763e07e0.js | 1 + ...f9761.bb6f6ac0.js => 8bbf9761.3739fdab.js} | 0 ...b7b33.168f86ee.js => 8e2b7b33.3cb1b67f.js} | 0 ...d8112.39ee9bdb.js => 902d8112.5c2ec612.js} | 2 +- ...cf40b.806b2fcf.js => 904cf40b.c90b4fc2.js} | 0 ...3ef29.5e50707c.js => 97c3ef29.7493d2a7.js} | 0 ...ac8f0.aaac8e03.js => 9bdac8f0.9575e08b.js} | 0 ...3dc31.e6723c63.js => a133dc31.e780d5b0.js} | 2 +- ...8d5cc.9eea910c.js => a688d5cc.aee31bf3.js} | 0 handbook/build/a6aa9e1f.7b044f24.js | 1 - handbook/build/a6aa9e1f.90806b14.js | 1 + ...774ac.fc99cc53.js => a74774ac.bd53c3d4.js} | 0 ...e9b99.6400b5bf.js => af3e9b99.d29d718d.js} | 2 +- ...e1305.e0298c3e.js => b0be1305.397c5a43.js} | 0 handbook/build/b30e5fe3.c5b92405.js | 1 + handbook/build/b30e5fe3.f4083332.js | 1 - ...c29d5.ae39c9b4.js => b80c29d5.d17289be.js} | 0 handbook/build/blog/index.html | 48 ++++++++++------- handbook/build/blog/tags/fur/index.html | 48 ++++++++++------- handbook/build/blog/tags/furos/index.html | 44 ++++++++++------ handbook/build/blog/tags/index.html | 36 ++++++++----- handbook/build/blog/tags/net-5/index.html | 48 ++++++++++------- handbook/build/blog/tags/net/index.html | 48 ++++++++++------- handbook/build/blog/tags/netcore/index.html | 48 ++++++++++------- handbook/build/blog/welcome/index.html | 46 ++++++++++------ ...6980b.ea5bf524.js => c456980b.26d249c9.js} | 0 ...a942e.6dfad658.js => cb0a942e.c140ed8a.js} | 0 handbook/build/ccc49370.1215015a.js | 1 + handbook/build/ccc49370.3837ba9b.js | 1 - ...206bc.141c82a3.js => d3c206bc.4991a1c3.js} | 2 +- ...e75d5.b589f955.js => d3ee75d5.97773b12.js} | 0 ...b3010.f67b79ab.js => d43b3010.31cdfe03.js} | 0 ...bb0e0.7f8d0918.js => d80bb0e0.f6c27ef0.js} | 0 ...8d2dc.92db30cc.js => d8c8d2dc.55c6bf42.js} | 0 ...92c54.f93d860e.js => d8f92c54.605641d1.js} | 0 ...0b9c8.f1d42dde.js => dc10b9c8.ef7b4946.js} | 0 ...2fede.13d0ddb5.js => dea2fede.f703b7b4.js} | 2 +- handbook/build/docs/answer/index.html | 50 +++++++++++------- handbook/build/docs/appstartup/index.html | 50 +++++++++++------- handbook/build/docs/auth-control/index.html | 50 +++++++++++------- handbook/build/docs/author/index.html | 50 +++++++++++------- handbook/build/docs/cache/index.html | 50 +++++++++++------- handbook/build/docs/configuration/index.html | 50 +++++++++++------- handbook/build/docs/contribute/index.html | 50 +++++++++++------- handbook/build/docs/cors/index.html | 50 +++++++++++------- .../build/docs/data-validation/index.html | 50 +++++++++++------- .../docs/dbcontext-Interceptor/index.html | 50 +++++++++++------- .../docs/dbcontext-add-or-update/index.html | 50 +++++++++++------- handbook/build/docs/dbcontext-add/index.html | 50 +++++++++++------- .../build/docs/dbcontext-audit/index.html | 50 +++++++++++------- .../build/docs/dbcontext-batch/index.html | 50 +++++++++++------- .../docs/dbcontext-code-first/index.html | 50 +++++++++++------- .../build/docs/dbcontext-db-first/index.html | 50 +++++++++++------- .../build/docs/dbcontext-delete/index.html | 50 +++++++++++------- .../build/docs/dbcontext-filter/index.html | 50 +++++++++++------- .../build/docs/dbcontext-function/index.html | 50 +++++++++++------- .../docs/dbcontext-hight-query/index.html | 50 +++++++++++------- .../build/docs/dbcontext-locator/index.html | 50 +++++++++++------- .../docs/dbcontext-multi-database/index.html | 50 +++++++++++------- handbook/build/docs/dbcontext-proc/index.html | 50 +++++++++++------- .../build/docs/dbcontext-query/index.html | 50 +++++++++++------- .../docs/dbcontext-read-write/index.html | 50 +++++++++++------- .../docs/dbcontext-repository/index.html | 50 +++++++++++------- .../build/docs/dbcontext-seed-data/index.html | 50 +++++++++++------- .../build/docs/dbcontext-sql-proxy/index.html | 50 +++++++++++------- .../docs/dbcontext-sql-template/index.html | 50 +++++++++++------- handbook/build/docs/dbcontext-sql/index.html | 50 +++++++++++------- .../build/docs/dbcontext-update/index.html | 50 +++++++++++------- handbook/build/docs/dbcontext-view/index.html | 50 +++++++++++------- handbook/build/docs/dbcontext/index.html | 50 +++++++++++------- .../docs/dependency-injection/index.html | 50 +++++++++++------- handbook/build/docs/deploy/index.html | 50 +++++++++++------- handbook/build/docs/devops/index.html | 50 +++++++++++------- .../docs/dynamic-api-controller/index.html | 50 +++++++++++------- handbook/build/docs/entity/index.html | 50 +++++++++++------- handbook/build/docs/errors/index.html | 50 +++++++++++------- handbook/build/docs/event-bus/index.html | 50 +++++++++++------- .../build/docs/friendly-exception/index.html | 50 +++++++++++------- handbook/build/docs/get-start/index.html | 50 +++++++++++------- handbook/build/docs/gooduse/index.html | 50 +++++++++++------- handbook/build/docs/grpc/index.html | 50 +++++++++++------- handbook/build/docs/http/index.html | 50 +++++++++++------- handbook/build/docs/index.html | 52 +++++++++++-------- handbook/build/docs/job/index.html | 50 +++++++++++------- handbook/build/docs/local-language/index.html | 50 +++++++++++------- handbook/build/docs/logging/index.html | 50 +++++++++++------- handbook/build/docs/object-mapper/index.html | 50 +++++++++++------- handbook/build/docs/options/index.html | 50 +++++++++++------- handbook/build/docs/performance/index.html | 50 +++++++++++------- .../build/docs/process-service/index.html | 50 +++++++++++------- handbook/build/docs/reference/index.html | 50 +++++++++++------- handbook/build/docs/saas/index.html | 50 +++++++++++------- handbook/build/docs/signalr/index.html | 50 +++++++++++------- handbook/build/docs/source/index.html | 50 +++++++++++------- .../docs/specification-document/index.html | 50 +++++++++++------- handbook/build/docs/split-db/index.html | 50 +++++++++++------- handbook/build/docs/tran/index.html | 50 +++++++++++------- handbook/build/docs/unittest/index.html | 50 +++++++++++------- handbook/build/docs/view-engine/index.html | 50 +++++++++++------- ...78751.edd91af0.js => e0678751.0c64e968.js} | 2 +- ...13ffa.119be035.js => e1713ffa.2e884ad2.js} | 2 +- ...e61ad.ffe07c07.js => e50e61ad.f9899547.js} | 0 ...46b20.a0ca1d5f.js => e6346b20.349d05bf.js} | 0 ...62f29.d1455fa1.js => e6c62f29.079df1d4.js} | 2 +- handbook/build/ece76bd1.73422ad5.js | 1 - handbook/build/ece76bd1.9c5d7374.js | 1 + ...53588.088c672a.js => f9353588.2076aafd.js} | 2 +- ...29204.27cfb9da.js => fa529204.24a877a8.js} | 0 handbook/build/index.html | 36 ++++++++----- handbook/build/main.85005252.js | 2 + ...CENSE.txt => main.85005252.js.LICENSE.txt} | 0 handbook/build/main.c43a60e9.js | 2 - handbook/build/runtime~main.33ba8130.js | 1 + handbook/build/runtime~main.816f64f2.js | 1 - handbook/build/styles.5476b6d8.js | 1 + handbook/build/styles.8352e18a.js | 1 - handbook/docs/introduce.mdx | 6 +-- 566 files changed, 4561 insertions(+), 3103 deletions(-) delete mode 100644 docs/01a85c17.10420435.js create mode 100644 docs/01a85c17.755a5885.js create mode 100644 docs/03ebb857.281807f2.js delete mode 100644 docs/03ebb857.695212d0.js create mode 100644 docs/0ddd808e.1930f9f7.js delete mode 100644 docs/0ddd808e.cf943861.js delete mode 100644 docs/1.72c59440.js create mode 100644 docs/1.7bcff63a.js delete mode 100644 docs/17256d0f.0dd677ec.js create mode 100644 docs/17256d0f.ea03f6fb.js delete mode 100644 docs/1761adf3.0eeb8b92.js create mode 100644 docs/1761adf3.1568ad36.js rename docs/{17666df9.a5abd77b.js => 17666df9.40158a0a.js} (99%) delete mode 100644 docs/17896441.9aece880.js create mode 100644 docs/17896441.b0924391.js create mode 100644 docs/1be78505.572787d1.js delete mode 100644 docs/1be78505.5f3cad14.js rename docs/{1d7b962e.4baa59fe.js => 1d7b962e.0af032df.js} (99%) rename docs/{1e961311.fef4867f.js => 1e961311.8fde9f00.js} (99%) create mode 100644 docs/1ea356f4.543c45ed.js delete mode 100644 docs/1ea356f4.c545d4f3.js create mode 100644 docs/2.b29b510d.js rename docs/{2.da27712d.js.LICENSE.txt => 2.b29b510d.js.LICENSE.txt} (100%) delete mode 100644 docs/2.da27712d.js rename docs/{24dcd402.dad85cd2.js => 24dcd402.2112381e.js} (98%) rename docs/{2792faa0.393c7313.js => 2792faa0.2dbf1923.js} (98%) rename docs/{2a4cb773.c96e5bb6.js => 2a4cb773.4eabc39a.js} (99%) rename docs/{2ae73ff4.b4cb8011.js => 2ae73ff4.439f6355.js} (98%) rename docs/{2b04a543.9fc467bd.js => 2b04a543.a459a757.js} (98%) create mode 100644 docs/3.9f5a92b9.js delete mode 100644 docs/3.b6ccd44c.js rename docs/{34420422.bd14d00b.js => 34420422.c3fd76ca.js} (99%) rename docs/{36793c62.d48973ba.js => 36793c62.7d5d0b0d.js} (98%) rename docs/{3a6dbab2.2beebf2b.js => 3a6dbab2.29e48f17.js} (98%) create mode 100644 docs/3ab56fdf.08967bbc.js delete mode 100644 docs/3ab56fdf.238047c3.js rename docs/{3e869f93.8686d66c.js => 3e869f93.1a6c3c3e.js} (99%) rename docs/{408ae89d.0e87c449.js => 408ae89d.edc822b6.js} (99%) rename docs/{4930ce4d.e8539812.js => 4930ce4d.c5b9be77.js} (99%) delete mode 100644 docs/4bfcf3ee.9fd3cf97.js create mode 100644 docs/4bfcf3ee.bb6afc05.js create mode 100644 docs/4c30b939.4343bb83.js delete mode 100644 docs/4c30b939.d21427f9.js delete mode 100644 docs/4dbcf072.43551049.js create mode 100644 docs/4dbcf072.ceefa0fc.js rename docs/{4e3694ae.befe978c.js => 4e3694ae.8a08238f.js} (68%) delete mode 100644 docs/59d16f51.17fe308b.js create mode 100644 docs/59d16f51.db2a93e5.js rename docs/{5c4ee1d6.84f4a477.js => 5c4ee1d6.203043c2.js} (73%) rename docs/{5ce0ebbd.4ab6a852.js => 5ce0ebbd.ef7d4828.js} (99%) delete mode 100644 docs/5e077782.5c58ae24.js create mode 100644 docs/5e077782.ad54b8c8.js create mode 100644 docs/62953dcd.c5d8591d.js delete mode 100644 docs/62953dcd.dc05b734.js rename docs/{654ac364.b869a9ae.js => 654ac364.809adb42.js} (98%) delete mode 100644 docs/6875c492.5589b6a0.js create mode 100644 docs/6875c492.a75dca0e.js rename docs/{70699f3e.0d9dc710.js => 70699f3e.e08b1731.js} (100%) rename docs/{7696a0ae.872ee861.js => 7696a0ae.086cf378.js} (100%) rename docs/{7b4b163f.4808d427.js => 7b4b163f.15151a0b.js} (100%) rename docs/{7c7b3a8a.f2448b6a.js => 7c7b3a8a.2ecfb225.js} (100%) rename docs/{7d3779e7.ef765193.js => 7d3779e7.1e9fe094.js} (100%) rename docs/{8231c802.f5780f8f.js => 8231c802.2ec6250f.js} (100%) delete mode 100644 docs/85.0018927c.js create mode 100644 docs/85.7e646109.js create mode 100644 docs/86.763e07e0.js rename docs/{8bbf9761.f64cda87.js => 8bbf9761.498ce4f9.js} (100%) rename docs/{8e2b7b33.016f2f3a.js => 8e2b7b33.b2e4bfed.js} (100%) rename docs/{902d8112.665063e4.js => 902d8112.7316b98d.js} (95%) rename docs/{904cf40b.09e071c4.js => 904cf40b.8359e8f3.js} (100%) rename docs/{97c3ef29.22942c40.js => 97c3ef29.dc2fde2b.js} (100%) rename docs/{9bdac8f0.b38ef64e.js => 9bdac8f0.63c881d2.js} (100%) rename docs/{a133dc31.7638bbc5.js => a133dc31.c0b1f43b.js} (95%) rename docs/{a688d5cc.44b37d46.js => a688d5cc.cb046acd.js} (100%) create mode 100644 docs/a6aa9e1f.005e050b.js delete mode 100644 docs/a6aa9e1f.dad92990.js rename docs/{a74774ac.19465b58.js => a74774ac.c040e8b1.js} (100%) rename docs/{af3e9b99.0b631e94.js => af3e9b99.5cd3f05b.js} (95%) rename docs/{b0be1305.06a3f89a.js => b0be1305.f704cfc2.js} (100%) delete mode 100644 docs/b30e5fe3.41db337f.js create mode 100644 docs/b30e5fe3.b1981ed6.js rename docs/{b80c29d5.100571d2.js => b80c29d5.051540d5.js} (100%) rename docs/{c456980b.530a8035.js => c456980b.bfa3e0aa.js} (100%) rename docs/{cb0a942e.ba8927ad.js => cb0a942e.b51b137c.js} (100%) create mode 100644 docs/ccc49370.0b963bc5.js delete mode 100644 docs/ccc49370.3426e43a.js rename docs/{d3c206bc.c82f0f14.js => d3c206bc.8c5ab558.js} (61%) rename docs/{d3ee75d5.89d8c15a.js => d3ee75d5.44c18a13.js} (100%) rename docs/{d43b3010.eaa01519.js => d43b3010.30d52cd3.js} (100%) rename docs/{d80bb0e0.35e8ea68.js => d80bb0e0.8acf41d2.js} (100%) rename docs/{d8c8d2dc.1ab280a0.js => d8c8d2dc.2041bc52.js} (100%) rename docs/{d8f92c54.6ec458d9.js => d8f92c54.ddc0a31f.js} (100%) rename docs/{dc10b9c8.92049b15.js => dc10b9c8.05bc6c75.js} (100%) rename docs/{dea2fede.c67f06e6.js => dea2fede.dbba7be7.js} (53%) rename docs/{e0678751.32876613.js => e0678751.1b3a8d90.js} (87%) rename docs/{e1713ffa.f1e4e3c8.js => e1713ffa.f86c14eb.js} (91%) rename docs/{e50e61ad.088b77e2.js => e50e61ad.d35151ac.js} (100%) rename docs/{e6346b20.50623fe1.js => e6346b20.65714baf.js} (100%) rename docs/{e6c62f29.d44ea22f.js => e6c62f29.10beb0c1.js} (88%) delete mode 100644 docs/ece76bd1.73422ad5.js create mode 100644 docs/ece76bd1.9c5d7374.js rename docs/{f9353588.bfe4bdd2.js => f9353588.e30dce03.js} (94%) rename docs/{fa529204.0f5c487b.js => fa529204.1901aecb.js} (100%) delete mode 100644 docs/main.2cb9d26e.js create mode 100644 docs/main.91003072.js rename docs/{main.2cb9d26e.js.LICENSE.txt => main.91003072.js.LICENSE.txt} (100%) create mode 100644 docs/runtime~main.81a22837.js delete mode 100644 docs/runtime~main.915bd3ad.js create mode 100644 docs/styles.1af3f57f.js delete mode 100644 docs/styles.8352e18a.js delete mode 100644 handbook/build/01a85c17.10420435.js create mode 100644 handbook/build/01a85c17.755a5885.js create mode 100644 handbook/build/03ebb857.68df0095.js delete mode 100644 handbook/build/03ebb857.bdee66fe.js create mode 100644 handbook/build/0ddd808e.2c8cd92c.js delete mode 100644 handbook/build/0ddd808e.d77719f9.js delete mode 100644 handbook/build/1.72c59440.js create mode 100644 handbook/build/1.7bcff63a.js create mode 100644 handbook/build/17256d0f.24ed78c9.js delete mode 100644 handbook/build/17256d0f.c1719a38.js create mode 100644 handbook/build/1761adf3.04caff3c.js delete mode 100644 handbook/build/1761adf3.37f331f5.js rename handbook/build/{17666df9.37cd28d0.js => 17666df9.8adabc49.js} (99%) delete mode 100644 handbook/build/17896441.9aece880.js create mode 100644 handbook/build/17896441.b0924391.js create mode 100644 handbook/build/1be78505.572787d1.js delete mode 100644 handbook/build/1be78505.5f3cad14.js rename handbook/build/{1d7b962e.7e7e2e9f.js => 1d7b962e.820f297f.js} (99%) rename handbook/build/{1e961311.d7cc7b4c.js => 1e961311.b621d684.js} (99%) create mode 100644 handbook/build/1ea356f4.20872c32.js delete mode 100644 handbook/build/1ea356f4.65bf0784.js create mode 100644 handbook/build/2.b29b510d.js rename handbook/build/{2.da27712d.js.LICENSE.txt => 2.b29b510d.js.LICENSE.txt} (100%) delete mode 100644 handbook/build/2.da27712d.js rename handbook/build/{23e7023c.5c499293.js => 23e7023c.e2a3d6fe.js} (68%) rename handbook/build/{24dcd402.931bd557.js => 24dcd402.197c70e3.js} (98%) rename handbook/build/{2792faa0.c8b601b5.js => 2792faa0.a6b91f55.js} (98%) rename handbook/build/{2a4cb773.949fd694.js => 2a4cb773.5d04da26.js} (99%) rename handbook/build/{2ae73ff4.074eace3.js => 2ae73ff4.0dc5635e.js} (98%) rename handbook/build/{2b04a543.660f2802.js => 2b04a543.e4fcde37.js} (98%) create mode 100644 handbook/build/3.8b225e2c.js delete mode 100644 handbook/build/3.b6ccd44c.js rename handbook/build/{34420422.f54e4fab.js => 34420422.9d060c20.js} (99%) rename handbook/build/{36793c62.81252910.js => 36793c62.5482922b.js} (98%) rename handbook/build/{3a6dbab2.89038ec6.js => 3a6dbab2.a1543954.js} (98%) delete mode 100644 handbook/build/3ab56fdf.8fbeb15b.js create mode 100644 handbook/build/3ab56fdf.de5e8564.js rename handbook/build/{3e869f93.305c87c2.js => 3e869f93.fba38820.js} (99%) rename handbook/build/{408ae89d.fa344557.js => 408ae89d.10fda153.js} (99%) rename handbook/build/{409819e6.14b77875.js => 409819e6.b31dfeb8.js} (69%) rename handbook/build/{4930ce4d.867af8f3.js => 4930ce4d.c11fc6ee.js} (99%) delete mode 100644 handbook/build/4bfcf3ee.09b86c5e.js create mode 100644 handbook/build/4bfcf3ee.b3c885ee.js create mode 100644 handbook/build/4c30b939.5c88910c.js delete mode 100644 handbook/build/4c30b939.f6421a33.js create mode 100644 handbook/build/4dbcf072.1865a6c7.js delete mode 100644 handbook/build/4dbcf072.86aa2a4d.js rename handbook/build/{4efad03e.7367e18f.js => 4efad03e.c3d32481.js} (73%) rename handbook/build/{525b9089.4330aea1.js => 525b9089.9b02f78b.js} (68%) delete mode 100644 handbook/build/59d16f51.47e86a00.js create mode 100644 handbook/build/59d16f51.df5c6ffe.js rename handbook/build/{5ce0ebbd.e81097b1.js => 5ce0ebbd.2139530d.js} (99%) delete mode 100644 handbook/build/5e077782.49e1c594.js create mode 100644 handbook/build/5e077782.e53c258a.js create mode 100644 handbook/build/62953dcd.b8dcc3f0.js delete mode 100644 handbook/build/62953dcd.c8565443.js rename handbook/build/{654ac364.56187509.js => 654ac364.7c423e34.js} (98%) rename handbook/build/{66076b72.841838a5.js => 66076b72.5bddb78f.js} (70%) delete mode 100644 handbook/build/6875c492.45df4276.js create mode 100644 handbook/build/6875c492.bf13b5a4.js rename handbook/build/{70699f3e.ab80af1c.js => 70699f3e.5f2e4588.js} (100%) rename handbook/build/{7696a0ae.5c74cfa6.js => 7696a0ae.7bda700a.js} (100%) rename handbook/build/{7b4b163f.dcdeae35.js => 7b4b163f.0d2f4dd8.js} (100%) rename handbook/build/{7c7b3a8a.a8db9a6c.js => 7c7b3a8a.b72235f7.js} (100%) rename handbook/build/{7d3779e7.adaf5a3d.js => 7d3779e7.1e72ca3f.js} (100%) rename handbook/build/{8231c802.e9b1c61b.js => 8231c802.ba31d790.js} (100%) delete mode 100644 handbook/build/85.0018927c.js create mode 100644 handbook/build/85.7e646109.js create mode 100644 handbook/build/86.763e07e0.js rename handbook/build/{8bbf9761.bb6f6ac0.js => 8bbf9761.3739fdab.js} (100%) rename handbook/build/{8e2b7b33.168f86ee.js => 8e2b7b33.3cb1b67f.js} (100%) rename handbook/build/{902d8112.39ee9bdb.js => 902d8112.5c2ec612.js} (97%) rename handbook/build/{904cf40b.806b2fcf.js => 904cf40b.c90b4fc2.js} (100%) rename handbook/build/{97c3ef29.5e50707c.js => 97c3ef29.7493d2a7.js} (100%) rename handbook/build/{9bdac8f0.aaac8e03.js => 9bdac8f0.9575e08b.js} (100%) rename handbook/build/{a133dc31.e6723c63.js => a133dc31.e780d5b0.js} (95%) rename handbook/build/{a688d5cc.9eea910c.js => a688d5cc.aee31bf3.js} (100%) delete mode 100644 handbook/build/a6aa9e1f.7b044f24.js create mode 100644 handbook/build/a6aa9e1f.90806b14.js rename handbook/build/{a74774ac.fc99cc53.js => a74774ac.bd53c3d4.js} (100%) rename handbook/build/{af3e9b99.6400b5bf.js => af3e9b99.d29d718d.js} (95%) rename handbook/build/{b0be1305.e0298c3e.js => b0be1305.397c5a43.js} (100%) create mode 100644 handbook/build/b30e5fe3.c5b92405.js delete mode 100644 handbook/build/b30e5fe3.f4083332.js rename handbook/build/{b80c29d5.ae39c9b4.js => b80c29d5.d17289be.js} (100%) rename handbook/build/{c456980b.ea5bf524.js => c456980b.26d249c9.js} (100%) rename handbook/build/{cb0a942e.6dfad658.js => cb0a942e.c140ed8a.js} (100%) create mode 100644 handbook/build/ccc49370.1215015a.js delete mode 100644 handbook/build/ccc49370.3837ba9b.js rename handbook/build/{d3c206bc.141c82a3.js => d3c206bc.4991a1c3.js} (91%) rename handbook/build/{d3ee75d5.b589f955.js => d3ee75d5.97773b12.js} (100%) rename handbook/build/{d43b3010.f67b79ab.js => d43b3010.31cdfe03.js} (100%) rename handbook/build/{d80bb0e0.7f8d0918.js => d80bb0e0.f6c27ef0.js} (100%) rename handbook/build/{d8c8d2dc.92db30cc.js => d8c8d2dc.55c6bf42.js} (100%) rename handbook/build/{d8f92c54.f93d860e.js => d8f92c54.605641d1.js} (100%) rename handbook/build/{dc10b9c8.f1d42dde.js => dc10b9c8.ef7b4946.js} (100%) rename handbook/build/{dea2fede.13d0ddb5.js => dea2fede.f703b7b4.js} (55%) rename handbook/build/{e0678751.edd91af0.js => e0678751.0c64e968.js} (86%) rename handbook/build/{e1713ffa.119be035.js => e1713ffa.2e884ad2.js} (91%) rename handbook/build/{e50e61ad.ffe07c07.js => e50e61ad.f9899547.js} (100%) rename handbook/build/{e6346b20.a0ca1d5f.js => e6346b20.349d05bf.js} (100%) rename handbook/build/{e6c62f29.d1455fa1.js => e6c62f29.079df1d4.js} (88%) delete mode 100644 handbook/build/ece76bd1.73422ad5.js create mode 100644 handbook/build/ece76bd1.9c5d7374.js rename handbook/build/{f9353588.088c672a.js => f9353588.2076aafd.js} (94%) rename handbook/build/{fa529204.27cfb9da.js => fa529204.24a877a8.js} (100%) create mode 100644 handbook/build/main.85005252.js rename handbook/build/{main.c43a60e9.js.LICENSE.txt => main.85005252.js.LICENSE.txt} (100%) delete mode 100644 handbook/build/main.c43a60e9.js create mode 100644 handbook/build/runtime~main.33ba8130.js delete mode 100644 handbook/build/runtime~main.816f64f2.js create mode 100644 handbook/build/styles.5476b6d8.js delete mode 100644 handbook/build/styles.8352e18a.js diff --git a/README.en.md b/README.en.md index a505ee9a1f7..b48e8e5f3ef 100644 --- a/README.en.md +++ b/README.en.md @@ -81,7 +81,7 @@ - `Docker Hub` 线上镜像 ```shell -docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-2020.10.10 +docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-2020.10.13 ``` - `手动` 打包镜像 @@ -89,13 +89,13 @@ docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-2020.10.10 打开 `CMD/Shell/PowerShell` 进入 `Fur` 项目根目录打包 `Fur` 镜像: ```shell -docker build -t fur:v1.0.0-2020.10.10 . +docker build -t fur:v1.0.0-2020.10.13 . ``` 打包成功后,直接 `docker run`: ```shell -docker run --name fur -p 5000:80 fur:v1.0.0-2020.10.10 +docker run --name fur -p 5000:80 fur:v1.0.0-2020.10.13 ``` ## 🥞 架构设计 diff --git a/README.md b/README.md index a505ee9a1f7..b48e8e5f3ef 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ - `Docker Hub` 线上镜像 ```shell -docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-2020.10.10 +docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-2020.10.13 ``` - `手动` 打包镜像 @@ -89,13 +89,13 @@ docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-2020.10.10 打开 `CMD/Shell/PowerShell` 进入 `Fur` 项目根目录打包 `Fur` 镜像: ```shell -docker build -t fur:v1.0.0-2020.10.10 . +docker build -t fur:v1.0.0-2020.10.13 . ``` 打包成功后,直接 `docker run`: ```shell -docker run --name fur -p 5000:80 fur:v1.0.0-2020.10.10 +docker run --name fur -p 5000:80 fur:v1.0.0-2020.10.13 ``` ## 🥞 架构设计 diff --git a/docs/01a85c17.10420435.js b/docs/01a85c17.10420435.js deleted file mode 100644 index 064d09514a0..00000000000 --- a/docs/01a85c17.10420435.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{154:function(e,a,t){"use strict";var n=t(152);t.d(a,"a",(function(){return n.a}))},55:function(e,a,t){"use strict";t.r(a);var n=t(0),r=t.n(n),c=t(153),l=t(151);a.default=function(e){var a=e.tags,t={};Object.keys(a).forEach((function(e){var a=function(e){return e[0].toUpperCase()}(e);t[a]=t[a]||[],t[a].push(e)}));var n=Object.entries(t).sort((function(e,a){var t=e[0],n=a[0];return t===n?0:t>n?1:-1})).map((function(e){var t=e[0],n=e[1];return r.a.createElement("div",{key:t},r.a.createElement("h3",null,t),n.map((function(e){return r.a.createElement(l.a,{className:"padding-right--md",href:a[e].permalink,key:e},a[e].name," (",a[e].count,")")})),r.a.createElement("hr",null))})).filter((function(e){return null!=e}));return r.a.createElement(c.a,{title:"Tags",description:"Blog Tags"},r.a.createElement("div",{className:"container margin-vert--lg"},r.a.createElement("div",{className:"row"},r.a.createElement("main",{className:"col col--8 col--offset-2"},r.a.createElement("h1",null,"Tags"),r.a.createElement("div",{className:"margin-vert--lg"},n)))))}}}]); \ No newline at end of file diff --git a/docs/01a85c17.755a5885.js b/docs/01a85c17.755a5885.js new file mode 100644 index 00000000000..1bcd8d06f30 --- /dev/null +++ b/docs/01a85c17.755a5885.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[4,11],{154:function(e,a,t){"use strict";var n=t(151);t.d(a,"a",(function(){return n.a}))},58:function(e,a,t){"use strict";t.r(a);var n=t(0),r=t.n(n),c=t(153),l=t(152);a.default=function(e){const{tags:a}=e,t={};Object.keys(a).forEach(e=>{const a=function(e){return e[0].toUpperCase()}(e);t[a]=t[a]||[],t[a].push(e)});const n=Object.entries(t).sort(([e],[a])=>e===a?0:e>a?1:-1).map(([e,t])=>r.a.createElement("div",{key:e},r.a.createElement("h3",null,e),t.map(e=>r.a.createElement(l.a,{className:"padding-right--md",href:a[e].permalink,key:e},a[e].name," (",a[e].count,")")),r.a.createElement("hr",null))).filter(e=>null!=e);return r.a.createElement(c.a,{title:"Tags",description:"Blog Tags"},r.a.createElement("div",{className:"container margin-vert--lg"},r.a.createElement("div",{className:"row"},r.a.createElement("main",{className:"col col--8 col--offset-2"},r.a.createElement("h1",null,"Tags"),r.a.createElement("div",{className:"margin-vert--lg"},n)))))}}}]); \ No newline at end of file diff --git a/docs/03ebb857.281807f2.js b/docs/03ebb857.281807f2.js new file mode 100644 index 00000000000..6cfb889dbbe --- /dev/null +++ b/docs/03ebb857.281807f2.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return j}));var a=n(0),b=n.n(a);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(b[n]=e[n]);return b}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(b[n]=e[n])}return b}var o=b.a.createContext({}),p=function(e){var t=b.a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=p(e.components);return b.a.createElement(o.Provider,{value:t},e.children)},O={inlineCode:"code",wrapper:function(e){var t=e.children;return b.a.createElement(b.a.Fragment,{},t)}},s=b.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,o=l(e,["components","mdxType","originalType","parentName"]),d=p(n),s=a,j=d["".concat(i,".").concat(s)]||d[s]||O[s]||c;return n?b.a.createElement(j,r(r({ref:t},o),{},{components:n})):b.a.createElement(j,r({ref:t},o))}));function j(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,i=new Array(c);i[0]=s;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r.mdxType="string"==typeof e?e:a,i[1]=r;for(var o=2;ofunction(e,t,n,{forcePrependBaseUrl:a=!1,absolute:c=!1}={}){if(!n)return n;if(n.startsWith("#"))return n;if(Object(b.b)(n))return n;if(a)return t+n;const i=n.startsWith(t)?n:t+n.replace(/^\//,"");return c?e+i:i}(t,e,n,a)}}function i(e,t={}){const{withBaseUrl:n}=c();return n(e,t)}},145:function(e,t,n){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function b(e){return void 0!==e&&!a(e)}n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return b}))},59:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return r})),n.d(t,"metadata",(function(){return l})),n.d(t,"rightToc",(function(){return o})),n.d(t,"default",(function(){return d}));var a=n(2),b=n(6),c=(n(0),n(142)),i=n(144),r={id:"split-db",title:"9.27 \u5206\u8868\u5206\u5e93",sidebar_label:"9.27 \u5206\u8868\u5206\u5e93"},l={unversionedId:"split-db",id:"split-db",isDocsHomePage:!1,title:"9.27 \u5206\u8868\u5206\u5e93",description:"\u672c\u7ae0 9.27.2 \u81f3 9.27.5 \u5c0f\u8282\u632a\u7528\u535a\u4e3b\uff1a\u96e8\u70b9\u7684\u540d\u5b57 \u7684 \u5206\u5e93\u5206\u8868 - \u7406\u8bba \u535a\u5ba2\u5185\u5bb9\u3002\u7279\u6b64\u58f0\u660e\u3002",source:"@site/docs\\split-db.mdx",slug:"/split-db",permalink:"/docs/split-db",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/split-db.mdx",version:"current",sidebar_label:"9.27 \u5206\u8868\u5206\u5e93",sidebar:"docs",previous:{title:"9.26 \u8bfb\u5199\u5206\u79bb/\u4e3b\u4ece\u590d\u5236",permalink:"/docs/dbcontext-read-write"},next:{title:"10. SaaS \u591a\u79df\u6237",permalink:"/docs/saas"}},o=[{value:"9.27.1 \u5e94\u7528\u573a\u666f",id:"9271-\u5e94\u7528\u573a\u666f",children:[]},{value:"9.27.2 \u5782\u76f4\u5207\u5206",id:"9272-\u5782\u76f4\u5207\u5206",children:[{value:"9.27.2.1 \u5782\u76f4\u5206\u5e93",id:"92721-\u5782\u76f4\u5206\u5e93",children:[]},{value:"9.27.2.2 \u5782\u76f4\u5206\u8868",id:"92722-\u5782\u76f4\u5206\u8868",children:[]},{value:"9.27.2.3 \u4f18\u7f3a\u70b9",id:"92723-\u4f18\u7f3a\u70b9",children:[]}]},{value:"9.27.3 \u6c34\u5e73\u5207\u5206",id:"9273-\u6c34\u5e73\u5207\u5206",children:[{value:"9.27.3.1 \u6c34\u5e73\u5206\u5e93",id:"92731-\u6c34\u5e73\u5206\u5e93",children:[]},{value:"9.27.3.2 \u6c34\u5e73\u5206\u8868",id:"92732-\u6c34\u5e73\u5206\u8868",children:[]},{value:"9.27.3.3 \u4f18\u7f3a\u70b9",id:"92733-\u4f18\u7f3a\u70b9",children:[]}]},{value:"9.27.4 \u6570\u636e\u5206\u7247\u89c4\u5219",id:"9274-\u6570\u636e\u5206\u7247\u89c4\u5219",children:[{value:"9.27.4.1 Hash \u53d6\u6a21\u5206\u8868",id:"92741-hash-\u53d6\u6a21\u5206\u8868",children:[]},{value:"9.27.4.2 \u6570\u503c Range \u5206\u8868",id:"92742-\u6570\u503c-range-\u5206\u8868",children:[]},{value:"9.27.4.3 \u4e00\u81f4\u6027 Hash \u7b97\u6cd5",id:"92743-\u4e00\u81f4\u6027-hash-\u7b97\u6cd5",children:[]}]},{value:"9.27.5 \u5206\u5e93\u5206\u8868\u5e26\u6765\u7684\u95ee\u9898",id:"9275-\u5206\u5e93\u5206\u8868\u5e26\u6765\u7684\u95ee\u9898",children:[{value:"9.27.5.1 \u5206\u5e03\u5f0f\u4e8b\u52a1\u95ee\u9898",id:"92751-\u5206\u5e03\u5f0f\u4e8b\u52a1\u95ee\u9898",children:[]},{value:"9.27.5.2 \u8de8\u8282\u70b9\u5173\u8054\u67e5\u8be2 Join \u95ee\u9898",id:"92752-\u8de8\u8282\u70b9\u5173\u8054\u67e5\u8be2-join-\u95ee\u9898",children:[]},{value:"9.27.5.3 \u8de8\u8282\u70b9\u5206\u9875\u3001\u6392\u5e8f\u3001\u51fd\u6570\u95ee\u9898",id:"92753-\u8de8\u8282\u70b9\u5206\u9875\u3001\u6392\u5e8f\u3001\u51fd\u6570\u95ee\u9898",children:[]},{value:"9.27.5.4 \u5168\u5c40\u4e3b\u952e\u907f\u91cd\u95ee\u9898",id:"92754-\u5168\u5c40\u4e3b\u952e\u907f\u91cd\u95ee\u9898",children:[]},{value:"9.27.5.5 \u6570\u636e\u8fc1\u79fb\u95ee\u9898",id:"92755-\u6570\u636e\u8fc1\u79fb\u95ee\u9898",children:[]}]},{value:"9.27.6 \u5982\u4f55\u5b9e\u73b0",id:"9276-\u5982\u4f55\u5b9e\u73b0",children:[]},{value:"9.27.7 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9277-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],p={rightToc:o};function d(e){var t=e.components,n=Object(b.a)(e,["components"]);return Object(c.b)("wrapper",Object(a.a)({},p,n,{components:t,mdxType:"MDXLayout"}),Object(c.b)("div",{className:"admonition admonition-important alert alert--info"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u6b64\u58f0\u660e")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u672c\u7ae0 ",Object(c.b)("inlineCode",{parentName:"p"},"9.27.2")," \u81f3 ",Object(c.b)("inlineCode",{parentName:"p"},"9.27.5")," \u5c0f\u8282\u632a\u7528\u535a\u4e3b\uff1a",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://www.cnblogs.com/qdhxhz/"}),"\u96e8\u70b9\u7684\u540d\u5b57")," \u7684 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://www.cnblogs.com/qdhxhz/p/11608222.html"}),"\u5206\u5e93\u5206\u8868 - \u7406\u8bba")," \u535a\u5ba2\u5185\u5bb9\u3002",Object(c.b)("strong",{parentName:"p"},"\u7279\u6b64\u58f0\u660e\u3002")))),Object(c.b)("h2",{id:"9271-\u5e94\u7528\u573a\u666f"},"9.27.1 \u5e94\u7528\u573a\u666f"),Object(c.b)("p",null,"\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u91cf\u4e0d\u4e00\u5b9a\u662f\u53ef\u63a7\u7684\uff0c\u5728\u672a\u8fdb\u884c\u5206\u5e93\u5206\u8868\u7684\u60c5\u51b5\u4e0b\uff0c\u968f\u7740\u65f6\u95f4\u548c\u4e1a\u52a1\u7684\u53d1\u5c55\uff0c\u5e93\u4e2d\u7684\u8868\u4f1a\u8d8a\u6765\u8d8a\u591a\uff0c\u8868\u4e2d\u7684\u6570\u636e\u91cf\u4e5f\u4f1a\u8d8a\u6765\u8d8a\u5927\uff0c\u76f8\u5e94\u5730\uff0c\u6570\u636e\u64cd\u4f5c\u589e\u5220\u6539\u67e5\u7684\u5f00\u9500\u4e5f\u4f1a\u8d8a\u6765\u8d8a\u5927\u3002"),Object(c.b)("p",null,"\u53e6\u5916\uff0c\u7531\u4e8e\u65e0\u6cd5\u8fdb\u884c\u5206\u5e03\u5f0f\u5f0f\u90e8\u7f72\uff0c\u800c\u4e00\u53f0\u670d\u52a1\u5668\u7684\u8d44\u6e90\uff08CPU\u3001\u78c1\u76d8\u3001\u5185\u5b58\u3001IO \u7b49\uff09\u662f\u6709\u9650\u7684\uff0c\u6700\u7ec8\u6570\u636e\u5e93\u6240\u80fd\u627f\u8f7d\u7684\u6570\u636e\u91cf\u3001\u6570\u636e\u5904\u7406\u80fd\u529b\u90fd\u5c06\u906d\u9047\u74f6\u9888\u3002"),Object(c.b)("p",null,"\u8fd9\u4e2a\u65f6\u5019\u5c31\u9700\u8981\u5bf9\u6570\u636e\u5e93\u6216\u6570\u636e\u8868\u8fdb\u884c\u62c6\u5206\u3002"),Object(c.b)("p",null,"\u6570\u636e\u5207\u5206\u53ef\u4ee5\u5206\u4e3a\uff1a",Object(c.b)("inlineCode",{parentName:"p"},"\u5782\u76f4\u5207\u5206")," \u548c ",Object(c.b)("inlineCode",{parentName:"p"},"\u6c34\u5e73\u5207\u5206"),"\u3002"),Object(c.b)("h2",{id:"9272-\u5782\u76f4\u5207\u5206"},"9.27.2 \u5782\u76f4\u5207\u5206"),Object(c.b)("p",null,"\u5782\u76f4\u5207\u5206\u53c8\u53ef\u4ee5\u5206\u4e3a: \u5782\u76f4\u5206\u5e93\u548c\u5782\u76f4\u5206\u8868\u3002"),Object(c.b)("h3",{id:"92721-\u5782\u76f4\u5206\u5e93"},"9.27.2.1 \u5782\u76f4\u5206\u5e93"),Object(c.b)("p",null,'\u6839\u636e\u4e1a\u52a1\u8026\u5408\u6027\uff0c\u5c06\u5173\u8054\u5ea6\u4f4e\u7684\u4e0d\u540c\u8868\u5b58\u50a8\u5728\u4e0d\u540c\u7684\u6570\u636e\u5e93\u3002\u505a\u6cd5\u4e0e\u5927\u7cfb\u7edf\u62c6\u5206\u4e3a\u591a\u4e2a\u5c0f\u7cfb\u7edf\u7c7b\u4f3c\uff0c\u6309\u4e1a\u52a1\u5206\u7c7b\u8fdb\u884c\u72ec\u7acb\u5212\u5206\u3002\u4e0e"\u5fae\u670d\u52a1\u6cbb\u7406"\u7684\u505a\u6cd5\u76f8\u4f3c\uff0c\u6bcf\u4e2a\u5fae\u670d\u52a1\u4f7f\u7528\u5355\u72ec\u7684\u4e00\u4e2a\u6570\u636e\u5e93\u3002'),Object(c.b)("img",{src:Object(i.a)("img/dbsplit1.jpg")}),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u8bf4\u660e")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u4e00\u5f00\u59cb\u6211\u4eec\u662f\u5355\u4f53\u670d\u52a1\uff0c\u6240\u4ee5\u53ea\u6709\u4e00\u4e2a\u6570\u636e\u5e93\uff0c\u6240\u6709\u7684\u8868\u90fd\u5728\u8fd9\u4e2a\u5e93\u91cc\u3002"),Object(c.b)("p",{parentName:"div"},"\u540e\u6765\u56e0\u4e3a\u4e1a\u52a1\u9700\u6c42,\u5355\u4f53\u670d\u52a1\u53d8\u6210\u5fae\u670d\u52a1\u6cbb\u7406\u3002\u6240\u4ee5\u5c06\u4e4b\u524d\u7684\u4e00\u4e2a\u5546\u54c1\u5e93\uff0c\u62c6\u5206\u6210\u591a\u4e2a\u6570\u636e\u5e93\u3002\u6bcf\u4e2a\u5fae\u670d\u52a1\u5bf9\u4e8e\u4e00\u4e2a\u6570\u636e\u5e93\u3002"))),Object(c.b)("h3",{id:"92722-\u5782\u76f4\u5206\u8868"},"9.27.2.2 \u5782\u76f4\u5206\u8868"),Object(c.b)("p",null,"\u628a\u4e00\u4e2a\u8868\u7684\u591a\u4e2a\u5b57\u6bb5\u5206\u522b\u62c6\u6210\u591a\u4e2a\u8868\uff0c\u4e00\u822c\u6309\u5b57\u6bb5\u7684\u51b7\u70ed\u62c6\u5206\uff0c\u70ed\u5b57\u6bb5\u4e00\u4e2a\u8868\uff0c\u51b7\u5b57\u6bb5\u4e00\u4e2a\u8868\u3002\u4ece\u800c\u63d0\u5347\u4e86\u6570\u636e\u5e93\u6027\u80fd\u3002"),Object(c.b)("img",{src:Object(i.a)("img/dbsplit2.jpg")}),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u8bf4\u660e")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u4e00\u5f00\u59cb\u5546\u54c1\u8868\u4e2d\u5305\u542b\u5546\u54c1\u7684\u6240\u6709\u5b57\u6bb5\uff0c\u4f46\u662f\u6211\u4eec\u53d1\u73b0:"),Object(c.b)("p",{parentName:"div"},"1.\u5546\u54c1\u8be6\u60c5\u548c\u5546\u54c1\u5c5e\u6027\u5b57\u6bb5\u8f83\u957f\u30022.\u5546\u54c1\u5217\u8868\u7684\u65f6\u5019\u6211\u4eec\u662f\u4e0d\u9700\u8981\u663e\u793a\u5546\u54c1\u8be6\u60c5\u548c\u5546\u54c1\u5c5e\u6027\u4fe1\u606f\uff0c\u53ea\u6709\u5728\u70b9\u8fdb\u5546\u54c1\u5546\u54c1\u7684\u65f6\u5019\u624d\u4f1a\u5c55\u793a\u5546\u54c1\u8be6\u60c5\u4fe1\u606f\u3002"),Object(c.b)("p",{parentName:"div"},"\u6240\u4ee5\u53ef\u4ee5\u8003\u8651\u628a\u5546\u54c1\u8be6\u60c5\u548c\u5546\u54c1\u5c5e\u6027\u5355\u72ec\u5207\u5206\u4e00\u5f20\u8868\uff0c\u63d0\u9ad8\u67e5\u8be2\u6548\u7387\u3002"))),Object(c.b)("h3",{id:"92723-\u4f18\u7f3a\u70b9"},"9.27.2.3 \u4f18\u7f3a\u70b9"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(c.b)("ul",{parentName:"li"},Object(c.b)("li",{parentName:"ul"},"\u89e3\u51b3\u4e1a\u52a1\u7cfb\u7edf\u5c42\u9762\u7684\u8026\u5408\uff0c\u4e1a\u52a1\u6e05\u6670"),Object(c.b)("li",{parentName:"ul"},"\u4e0e\u5fae\u670d\u52a1\u7684\u6cbb\u7406\u7c7b\u4f3c\uff0c\u4e5f\u80fd\u5bf9\u4e0d\u540c\u4e1a\u52a1\u7684\u6570\u636e\u8fdb\u884c\u5206\u7ea7\u7ba1\u7406\u3001\u7ef4\u62a4\u3001\u76d1\u63a7\u3001\u6269\u5c55\u7b49"),Object(c.b)("li",{parentName:"ul"},"\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\uff0c\u5782\u76f4\u5207\u5206\u4e00\u5b9a\u7a0b\u5ea6\u7684\u63d0\u5347 IO\u3001\u6570\u636e\u5e93\u8fde\u63a5\u6570\u3001\u5355\u673a\u786c\u4ef6\u8d44\u6e90\u7684\u74f6\u9888"))),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(c.b)("ul",{parentName:"li"},Object(c.b)("li",{parentName:"ul"},"\u5206\u5e93\u540e\u65e0\u6cd5 Join\uff0c\u53ea\u80fd\u901a\u8fc7\u63a5\u53e3\u805a\u5408\u65b9\u5f0f\u89e3\u51b3\uff0c\u63d0\u5347\u4e86\u5f00\u53d1\u7684\u590d\u6742\u5ea6"),Object(c.b)("li",{parentName:"ul"},"\u5206\u5e93\u540e\u5206\u5e03\u5f0f\u4e8b\u52a1\u5904\u7406\u590d\u6742"),Object(c.b)("li",{parentName:"ul"},"\u4f9d\u7136\u5b58\u5728\u5355\u8868\u6570\u636e\u91cf\u8fc7\u5927\u7684\u95ee\u9898\uff08\u9700\u8981\u6c34\u5e73\u5207\u5206\uff09")))),Object(c.b)("h2",{id:"9273-\u6c34\u5e73\u5207\u5206"},"9.27.3 \u6c34\u5e73\u5207\u5206"),Object(c.b)("p",null,"\u5f53\u4e00\u4e2a\u5e94\u7528\u96be\u4ee5\u518d\u7ec6\u7c92\u5ea6\u7684\u5782\u76f4\u5207\u5206\u6216\u5207\u5206\u540e\u6570\u636e\u91cf\u884c\u6570\u5de8\u5927\uff0c\u5b58\u5728\u5355\u5e93\u8bfb\u5199\u3001\u5b58\u50a8\u6027\u80fd\u74f6\u9888\uff0c\u8fd9\u65f6\u5019\u5c31\u9700\u8981\u8fdb\u884c\u6c34\u5e73\u5207\u5206\u4e86\u3002"),Object(c.b)("p",null,"\u6c34\u5e73\u5207\u5206\u4e5f\u53ef\u4ee5\u5206\u4e3a\uff1a\u6c34\u5e73\u5206\u5e93\u548c\u6c34\u5e73\u5206\u8868\u3002"),Object(c.b)("h3",{id:"92731-\u6c34\u5e73\u5206\u5e93"},"9.27.3.1 \u6c34\u5e73\u5206\u5e93"),Object(c.b)("p",null,"\u4e0a\u9762\u867d\u7136\u5df2\u7ecf\u628a\u5546\u54c1\u5e93\u5206\u6210 3 \u4e2a\u5e93\uff0c\u4f46\u662f\u968f\u7740\u4e1a\u52a1\u7684\u589e\u52a0\u4e00\u4e2a\u8ba2\u5355\u5e93\u4e5f\u51fa\u73b0 QPS \u8fc7\u9ad8\uff0c\u6570\u636e\u5e93\u54cd\u5e94\u901f\u5ea6\u6765\u4e0d\u53ca\uff0c\u4e00\u822c mysql \u5355\u673a\u4e5f\u5c31 1000 \u5de6\u53f3\u7684 QPS\uff0c\u5982\u679c\u8d85\u8fc7 1000 \u5c31\u8981\u8003\u8651\u5206\u5e93\u3002"),Object(c.b)("img",{src:Object(i.a)("img/dbsplit3.jpg")}),Object(c.b)("h3",{id:"92732-\u6c34\u5e73\u5206\u8868"},"9.27.3.2 \u6c34\u5e73\u5206\u8868"),Object(c.b)("p",null,"\u4e00\u822c\u6211\u4eec\u4e00\u5f20\u8868\u7684\u6570\u636e\u4e0d\u8981\u8d85\u8fc7 1 \u5343\u4e07,\u5982\u679c\u8868\u6570\u636e\u8d85\u8fc7 1 \u5343\u4e07\uff0c\u5e76\u4e14\u8fd8\u5728\u4e0d\u65ad\u589e\u52a0\u6570\u636e\uff0c\u90a3\u5c31\u53ef\u4ee5\u8003\u8651\u5206\u8868\u3002"),Object(c.b)("img",{src:Object(i.a)("img/dbsplit4.jpg")}),Object(c.b)("h3",{id:"92733-\u4f18\u7f3a\u70b9"},"9.27.3.3 \u4f18\u7f3a\u70b9"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(c.b)("ul",{parentName:"li"},Object(c.b)("li",{parentName:"ul"},"\u4e0d\u5b58\u5728\u5355\u5e93\u6570\u636e\u91cf\u8fc7\u5927\u3001\u9ad8\u5e76\u53d1\u7684\u6027\u80fd\u74f6\u9888\uff0c\u63d0\u5347\u7cfb\u7edf\u7a33\u5b9a\u6027\u548c\u8d1f\u8f7d\u80fd\u529b"),Object(c.b)("li",{parentName:"ul"},"\u5e94\u7528\u7aef\u6539\u9020\u8f83\u5c0f\uff0c\u4e0d\u9700\u8981\u62c6\u5206\u4e1a\u52a1\u6a21\u5757"))),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(c.b)("ul",{parentName:"li"},Object(c.b)("li",{parentName:"ul"},"\u8de8\u5206\u7247\u7684\u4e8b\u52a1\u4e00\u81f4\u6027\u96be\u4ee5\u4fdd\u8bc1"),Object(c.b)("li",{parentName:"ul"},"\u8de8\u5e93\u7684 Join \u5173\u8054\u67e5\u8be2\u6027\u80fd\u8f83\u5dee"),Object(c.b)("li",{parentName:"ul"},"\u6570\u636e\u591a\u6b21\u6269\u5c55\u96be\u5ea6\u548c\u7ef4\u62a4\u91cf\u6781\u5927")))),Object(c.b)("h2",{id:"9274-\u6570\u636e\u5206\u7247\u89c4\u5219"},"9.27.4 \u6570\u636e\u5206\u7247\u89c4\u5219"),Object(c.b)("p",null,"\u6211\u4eec\u8003\u8651\u53bb\u6c34\u5e73\u5207\u5206\u8868\uff0c\u5c06\u4e00\u5f20\u8868\u6c34\u5e73\u5207\u5206\u6210\u591a\u5f20\u8868\uff0c\u8fd9\u5c31\u6d89\u53ca\u5230\u6570\u636e\u5206\u7247\u7684\u89c4\u5219\uff0c\u6bd4\u8f83\u5e38\u89c1\u7684\u6709\uff1aHash \u53d6\u6a21\u5206\u8868\u3001\u6570\u503c Range \u5206\u8868\u3001\u4e00\u81f4\u6027 Hash \u7b97\u6cd5\u5206\u8868\u3002"),Object(c.b)("h3",{id:"92741-hash-\u53d6\u6a21\u5206\u8868"},"9.27.4.1 Hash \u53d6\u6a21\u5206\u8868"),Object(c.b)("p",null,"\u4e00\u822c\u91c7\u7528 Hash \u53d6\u6a21\u7684\u5207\u5206\u65b9\u5f0f\uff0c\u4f8b\u5982\uff1a\u5047\u8bbe\u6309 goods_id \u5206 4 \u5f20\u8868\u3002\uff08goods_id%4 \u53d6\u6574\u786e\u5b9a\u8868\uff09"),Object(c.b)("img",{src:Object(i.a)("img/dbsplit5.jpg")}),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u4f18\u7f3a\u70b9")),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(c.b)("ul",{parentName:"li"},Object(c.b)("li",{parentName:"ul"},"\u6570\u636e\u5206\u7247\u76f8\u5bf9\u6bd4\u8f83\u5747\u5300\uff0c\u4e0d\u5bb9\u6613\u51fa\u73b0\u70ed\u70b9\u548c\u5e76\u53d1\u8bbf\u95ee\u7684\u74f6\u9888\u3002"))),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(c.b)("ul",{parentName:"li"},Object(c.b)("li",{parentName:"ul"},"\u540e\u671f\u5206\u7247\u96c6\u7fa4\u6269\u5bb9\u65f6\uff0c\u9700\u8981\u8fc1\u79fb\u65e7\u7684\u6570\u636e\u5f88\u96be\u3002"),Object(c.b)("li",{parentName:"ul"},"\u5bb9\u6613\u9762\u4e34\u8de8\u5206\u7247\u67e5\u8be2\u7684\u590d\u6742\u95ee\u9898\u3002\u6bd4\u5982\u4e0a\u4f8b\u4e2d\uff0c\u5982\u679c\u9891\u7e41\u7528\u5230\u7684\u67e5\u8be2\u6761\u4ef6\u4e2d\u4e0d\u5e26 goods_id \u65f6\uff0c\u5c06\u4f1a\u5bfc\u81f4\u65e0\u6cd5\u5b9a\u4f4d\u6570\u636e\u5e93\uff0c\u4ece\u800c\u9700\u8981\u540c\u65f6\u5411 4 \u4e2a\u5e93\u53d1\u8d77\u67e5\u8be2\uff0c\n\u518d\u5728\u5185\u5b58\u4e2d\u5408\u5e76\u6570\u636e\uff0c\u53d6\u6700\u5c0f\u96c6\u8fd4\u56de\u7ed9\u5e94\u7528\uff0c\u5206\u5e93\u53cd\u800c\u6210\u4e3a\u62d6\u7d2f\u3002")))),Object(c.b)("h3",{id:"92742-\u6570\u503c-range-\u5206\u8868"},"9.27.4.2 \u6570\u503c Range \u5206\u8868"),Object(c.b)("p",null,"\u6309\u7167\u65f6\u95f4\u533a\u95f4\u6216 ID \u533a\u95f4\u6765\u5207\u5206\u3002\u4f8b\u5982\uff1a\u5c06 goods_id \u4e3a 1-1000 \u7684\u8bb0\u5f55\u5206\u5230\u7b2c\u4e00\u4e2a\u8868\uff0c1000-2000 \u7684\u5206\u5230\u7b2c\u4e8c\u4e2a\u8868\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002"),Object(c.b)("img",{src:Object(i.a)("img/dbsplit6.jpg")}),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u4f18\u7f3a\u70b9")),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(c.b)("ul",{parentName:"li"},Object(c.b)("li",{parentName:"ul"},"\u5355\u8868\u5927\u5c0f\u53ef\u63a7"),Object(c.b)("li",{parentName:"ul"},"\u5929\u7136\u4fbf\u4e8e\u6c34\u5e73\u6269\u5c55\uff0c\u540e\u671f\u5982\u679c\u60f3\u5bf9\u6574\u4e2a\u5206\u7247\u96c6\u7fa4\u6269\u5bb9\u65f6\uff0c\u53ea\u9700\u8981\u6dfb\u52a0\u8282\u70b9\u5373\u53ef\uff0c\u65e0\u9700\u5bf9\u5176\u4ed6\u5206\u7247\u7684\u6570\u636e\u8fdb\u884c\u8fc1\u79fb"),Object(c.b)("li",{parentName:"ul"},"\u4f7f\u7528\u5206\u7247\u5b57\u6bb5\u8fdb\u884c\u8303\u56f4\u67e5\u627e\u65f6\uff0c\u8fde\u7eed\u5206\u7247\u53ef\u5feb\u901f\u5b9a\u4f4d\u5206\u7247\u8fdb\u884c\u5feb\u901f\u67e5\u8be2\uff0c\u6709\u6548\u907f\u514d\u8de8\u5206\u7247\u67e5\u8be2\u7684\u95ee\u9898\u3002"))),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(c.b)("ul",{parentName:"li"},Object(c.b)("li",{parentName:"ul"},"\u70ed\u70b9\u6570\u636e\u6210\u4e3a\u6027\u80fd\u74f6\u9888\u3002\n\u4f8b\u5982\u6309\u65f6\u95f4\u5b57\u6bb5\u5206\u7247\uff0c\u6709\u4e9b\u5206\u7247\u5b58\u50a8\u6700\u8fd1\u65f6\u95f4\u6bb5\u5185\u7684\u6570\u636e\uff0c\u53ef\u80fd\u4f1a\u88ab\u9891\u7e41\u7684\u8bfb\u5199\uff0c\u800c\u6709\u4e9b\u5206\u7247\u5b58\u50a8\u7684\u5386\u53f2\u6570\u636e\uff0c\u5219\u5f88\u5c11\u88ab\u67e5\u8be2")))),Object(c.b)("h3",{id:"92743-\u4e00\u81f4\u6027-hash-\u7b97\u6cd5"},"9.27.4.3 \u4e00\u81f4\u6027 Hash \u7b97\u6cd5"),Object(c.b)("p",null,"\u4e00\u81f4\u6027 Hash \u7b97\u6cd5\u80fd\u5f88\u597d\u7684\u89e3\u51b3\u56e0\u4e3a Hash \u53d6\u6a21\u800c\u4ea7\u751f\u7684\u5206\u7247\u96c6\u7fa4\u6269\u5bb9\u65f6\uff0c\u9700\u8981\u8fc1\u79fb\u65e7\u7684\u6570\u636e\u7684\u96be\u9898\u3002\u5177\u4f53\u539f\u7406\u53ef\u53c2\u8003 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://www.cnblogs.com/duhuo/p/4996105.html"}),"https://www.cnblogs.com/duhuo/p/4996105.html")),Object(c.b)("h2",{id:"9275-\u5206\u5e93\u5206\u8868\u5e26\u6765\u7684\u95ee\u9898"},"9.27.5 \u5206\u5e93\u5206\u8868\u5e26\u6765\u7684\u95ee\u9898"),Object(c.b)("p",null,"\u4efb\u4f55\u4e8b\u60c5\u90fd\u6709\u4e24\u9762\u6027\uff0c\u5206\u5e93\u5206\u8868\u4e5f\u4e0d\u4f8b\u5916\uff0c\u5982\u679c\u91c7\u7528\u5206\u5e93\u5206\u8868\uff0c\u4f1a\u5f15\u5165\u65b0\u7684\u7684\u95ee\u9898\uff1a"),Object(c.b)("h3",{id:"92751-\u5206\u5e03\u5f0f\u4e8b\u52a1\u95ee\u9898"},"9.27.5.1 \u5206\u5e03\u5f0f\u4e8b\u52a1\u95ee\u9898"),Object(c.b)("p",null,"\u4f7f\u7528\u5206\u5e03\u5f0f\u4e8b\u52a1\u4e2d\u95f4\u4ef6\u89e3\u51b3\uff0c\u5177\u4f53\u662f\u901a\u8fc7\u6700\u7ec8\u4e00\u81f4\u6027\u8fd8\u662f\u5f3a\u4e00\u81f4\u6027\u5206\u5e03\u5f0f\u4e8b\u52a1\uff0c\u770b\u4e1a\u52a1\u9700\u6c42\uff0c\u8fd9\u91cc\u5c31\u4e0d\u591a\u8bf4\u3002"),Object(c.b)("h3",{id:"92752-\u8de8\u8282\u70b9\u5173\u8054\u67e5\u8be2-join-\u95ee\u9898"},"9.27.5.2 \u8de8\u8282\u70b9\u5173\u8054\u67e5\u8be2 Join \u95ee\u9898"),Object(c.b)("p",null,"\u5207\u5206\u4e4b\u524d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 Join \u6765\u5b8c\u6210\u3002\u800c\u5207\u5206\u4e4b\u540e\uff0c\u6570\u636e\u53ef\u80fd\u5206\u5e03\u5728\u4e0d\u540c\u7684\u8282\u70b9\u4e0a\uff0c\u6b64\u65f6 Join \u5e26\u6765\u7684\u95ee\u9898\u5c31\u6bd4\u8f83\u9ebb\u70e6\u4e86\uff0c\u8003\u8651\u5230\u6027\u80fd\uff0c\u5c3d\u91cf\u907f\u514d\u4f7f\u7528 Join \u67e5\u8be2\u3002"),Object(c.b)("p",null,"\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u4e00\u4e9b\u65b9\u6cd5\uff1a"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("strong",{parentName:"li"},"\u5168\u5c40\u8868"))),Object(c.b)("p",null,'\u5168\u5c40\u8868\uff0c\u4e5f\u53ef\u770b\u505a\u662f "\u6570\u636e\u5b57\u5178\u8868"\uff0c\u5c31\u662f\u7cfb\u7edf\u4e2d\u6240\u6709\u6a21\u5757\u90fd\u53ef\u80fd\u4f9d\u8d56\u7684\u4e00\u4e9b\u8868\uff0c\u4e3a\u4e86\u907f\u514d\u8de8\u5e93 Join \u67e5\u8be2\uff0c\u53ef\u4ee5\u5c06 \u8fd9\u7c7b\u8868\u5728\u6bcf\u4e2a\u6570\u636e\u5e93\u4e2d\u90fd\u4fdd\u5b58\u4e00\u4efd\u3002\u8fd9\u4e9b\u6570\u636e\u901a\u5e38'),Object(c.b)("p",null,"\u5f88\u5c11\u4f1a\u8fdb\u884c\u4fee\u6539\uff0c\u6240\u4ee5\u4e5f\u4e0d\u62c5\u5fc3\u4e00\u81f4\u6027\u7684\u95ee\u9898\u3002"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("strong",{parentName:"li"},"\u5b57\u6bb5\u5197\u4f59"))),Object(c.b)("p",null,'\u5229\u7528\u7a7a\u95f4\u6362\u65f6\u95f4\uff0c\u4e3a\u4e86\u6027\u80fd\u800c\u907f\u514d join \u67e5\u8be2\u3002\u4f8b\uff1a\u8ba2\u5355\u8868\u4fdd\u5b58 userId \u65f6\u5019,\u4e5f\u5c06 userName \u5197\u4f59\u4fdd\u5b58\u4e00\u4efd\uff0c\u8fd9\u6837\u67e5\u8be2\u8ba2\u5355\u8be6\u60c5\u65f6\u5c31\u4e0d\u9700\u8981\u518d\u53bb\u67e5\u8be2"\u4e70\u5bb6 user \u8868"\u4e86\u3002'),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("strong",{parentName:"li"},"\u6570\u636e\u7ec4\u88c5"))),Object(c.b)("p",null,"\u5728\u7cfb\u7edf\u5c42\u9762\uff0c\u5206\u4e24\u6b21\u67e5\u8be2\u3002\u7b2c\u4e00\u6b21\u67e5\u8be2\u7684\u7ed3\u679c\u96c6\u4e2d\u627e\u51fa\u5173\u8054\u6570\u636e id\uff0c\u7136\u540e\u6839\u636e id \u53d1\u8d77\u7b2c\u4e8c\u6b21\u8bf7\u6c42\u5f97\u5230\u5173\u8054\u6570\u636e\u3002\u6700\u540e\u5c06\u83b7\u5f97\u5230\u7684\u6570\u636e\u8fdb\u884c\u5b57\u6bb5\u62fc\u88c5\u3002"),Object(c.b)("h3",{id:"92753-\u8de8\u8282\u70b9\u5206\u9875\u3001\u6392\u5e8f\u3001\u51fd\u6570\u95ee\u9898"},"9.27.5.3 \u8de8\u8282\u70b9\u5206\u9875\u3001\u6392\u5e8f\u3001\u51fd\u6570\u95ee\u9898"),Object(c.b)("p",null,"\u8de8\u8282\u70b9\u591a\u5e93\u8fdb\u884c\u67e5\u8be2\u65f6\uff0c\u4f1a\u51fa\u73b0 Limit \u5206\u9875\u3001Order by \u6392\u5e8f\u7b49\u95ee\u9898\u3002\u5206\u9875\u9700\u8981\u6309\u7167\u6307\u5b9a\u5b57\u6bb5\u8fdb\u884c\u6392\u5e8f\uff0c\u5f53\u6392\u5e8f\u5b57\u6bb5\u5c31\u662f\u5206\u7247\u5b57\u6bb5\u65f6\uff0c\u901a\u8fc7\u5206\u7247\u89c4\u5219\u5c31\u6bd4\u8f83\u5bb9\u6613\u5b9a\u4f4d\u5230\u6307\u5b9a\u7684\u5206\u7247\uff1b"),Object(c.b)("p",null,"\u5f53\u6392\u5e8f\u5b57\u6bb5\u975e\u5206\u7247\u5b57\u6bb5\u65f6\uff0c\u5c31\u53d8\u5f97\u6bd4\u8f83\u590d\u6742\u4e86\u3002\u9700\u8981\u5148\u5728\u4e0d\u540c\u7684\u5206\u7247\u8282\u70b9\u4e2d\u5c06\u6570\u636e\u8fdb\u884c\u6392\u5e8f\u5e76\u8fd4\u56de\uff0c\u7136\u540e\u5c06\u4e0d\u540c\u5206\u7247\u8fd4\u56de\u7684\u7ed3\u679c\u96c6\u8fdb\u884c\u6c47\u603b\u548c\u518d\u6b21\u6392\u5e8f\uff0c\u6700\u7ec8\u8fd4\u56de\u7ed9\u7528\u6237\u3002"),Object(c.b)("h3",{id:"92754-\u5168\u5c40\u4e3b\u952e\u907f\u91cd\u95ee\u9898"},"9.27.5.4 \u5168\u5c40\u4e3b\u952e\u907f\u91cd\u95ee\u9898"),Object(c.b)("p",null,"\u5982\u679c\u90fd\u7528\u4e3b\u952e\u81ea\u589e\u80af\u5b9a\u4e0d\u5408\u7406\uff0c\u5982\u679c\u7528 UUID \u90a3\u4e48\u65e0\u6cd5\u505a\u5230\u6839\u636e\u4e3b\u952e\u6392\u5e8f\uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u8003\u8651\u901a\u8fc7",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://www.cnblogs.com/qdhxhz/p/11372658.html"}),"\u96ea\u82b1 ID")," \u6765\u4f5c\u4e3a\u6570\u636e\u5e93\u7684\u4e3b\u952e\uff0c"),Object(c.b)("h3",{id:"92755-\u6570\u636e\u8fc1\u79fb\u95ee\u9898"},"9.27.5.5 \u6570\u636e\u8fc1\u79fb\u95ee\u9898"),Object(c.b)("p",null,"\u91c7\u7528\u53cc\u5199\u7684\u65b9\u5f0f\uff0c\u4fee\u6539\u4ee3\u7801\uff0c\u6240\u6709\u6d89\u53ca\u5230\u5206\u5e93\u5206\u8868\u7684\u8868\u7684\u589e\u3001\u5220\u3001\u6539\u7684\u4ee3\u7801\uff0c\u90fd\u8981\u5bf9\u65b0\u5e93\u8fdb\u884c\u589e\u5220\u6539\u3002\u540c\u65f6\uff0c\u518d\u6709\u4e00\u4e2a\u6570\u636e\u62bd\u53d6\u670d\u52a1\uff0c\u4e0d\u65ad\u5730\u4ece\u8001\u5e93\u62bd\u6570\u636e\uff0c\u5f80\u65b0\u5e93\u5199\uff0c"),Object(c.b)("p",null,"\u8fb9\u5199\u8fb9\u6309\u65f6\u95f4\u6bd4\u8f83\u6570\u636e\u662f\u4e0d\u662f\u6700\u65b0\u7684\u3002"),Object(c.b)("h2",{id:"9276-\u5982\u4f55\u5b9e\u73b0"},"9.27.6 \u5982\u4f55\u5b9e\u73b0"),Object(c.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u8bf4\u660e")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u7531\u4e8e\u5206\u8868\u5206\u5e93\u4e0d\u4ec5\u4ec5\u9700\u8981\u5185\u7f6e\u4ee3\u7801\u7684\u652f\u6301\uff0c\u540c\u65f6\u8fd8\u9700\u8981\u96c6\u6210\u6570\u636e\u5e93\u4e2d\u95f4\u4ef6\uff0c\u8fd9\u91cc\u63a8\u8350 ",Object(c.b)("inlineCode",{parentName:"p"},"MyCat")," \u4e2d\u95f4\u4ef6\u3002",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"http://www.mycat.org.cn/"}),"MyCat \u5b98\u65b9\u7f51\u7ad9")))),Object(c.b)("p",null,Object(c.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\u63d0\u4f9b\u4e86\u8f7b\u91cf\u7ea7\u7684 ",Object(c.b)("inlineCode",{parentName:"p"},"\u5206\u8868\u5206\u5e93")," \u652f\u6301\uff1a"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("strong",{parentName:"li"},"\u52a8\u6001\u5207\u6362\u6570\u636e\u5e93"))),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u76f4\u63a5\u6539\u53d8\u6570\u636e\u5e93\nrepository.ChangeDatabase("\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32");\n\n// \u901a\u8fc7\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u5207\u6362\nrepository.Change();\n')),Object(c.b)("p",null,"\u5982\u9700\u8de8\u5e93\u67e5\u8be2\uff0c\u9700\u7528\u5230\u6570\u636e\u5e93\u6280\u672f\uff0c\u5982 ",Object(c.b)("inlineCode",{parentName:"p"},"SqlServer")," \u94fe\u63a5\u670d\u52a1\u5668\u6216\u540c\u4e49\u8bcd\u3002"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("strong",{parentName:"li"},"\u52a8\u6001\u5207\u6362\u6570\u636e\u5e93\u8868"))),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u76f4\u63a5\u6539\u53d8\u8868\uff0c\u4f1a\u6709\u591a\u7ebf\u7a0b\u64cd\u4f5cbug\uff0c\u540c\u65f6\u65e0\u6cd5\u5237\u65b0\u6a21\u578b\nrepository.ChangeTable("\u6570\u636e\u5e93\u8868");\n\n// \u521b\u5efa\u65b0\u7684 DbContext\uff0c\u7136\u540e\u5237\u65b0 OnModelCreating\uff08\u63a8\u8350\u65b9\u5f0f\uff09\nvar dynamicDbContextResolve = App.TransientServices.GetService>();\nvar dynamicDbContext = dynamicDbContextResolve(typeof(MyDbContextLocator), default);\n// \u91cd\u65b0\u8c03\u7528 OnModelCreating\uff0c\u5728 OnModelCreating \u4e2d\u914d\u7f6e ToTable("\u52a8\u6001\u8868") \u5373\u53ef\u3002\nDynamicModelCacheKeyFactory.RebuildModels();\nvar persons= dynamicDbContext.Set();\npersons.Add(new Person{});\n')),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(c.b)("inlineCode",{parentName:"p"},"DynamicModelCacheKeyFactory")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/ef/core/modeling/dynamic-model"}),"EF Core - \u591a\u4e2a\u6a21\u578b\u4e4b\u95f4\u4ea4\u66ff")," \u7ae0\u8282\u3002"))),Object(c.b)("h2",{id:"9277-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.27.7 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/03ebb857.695212d0.js b/docs/03ebb857.695212d0.js deleted file mode 100644 index 9978015484e..00000000000 --- a/docs/03ebb857.695212d0.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{142:function(e,t,a){"use strict";a.d(t,"a",(function(){return d})),a.d(t,"b",(function(){return s}));var n=a(0),b=a.n(n);function c(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function r(e){for(var t=1;t=0||(b[a]=e[a]);return b}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(b[a]=e[a])}return b}var o=b.a.createContext({}),p=function(e){var t=b.a.useContext(o),a=t;return e&&(a="function"==typeof e?e(t):r(r({},t),e)),a},d=function(e){var t=p(e.components);return b.a.createElement(o.Provider,{value:t},e.children)},O={inlineCode:"code",wrapper:function(e){var t=e.children;return b.a.createElement(b.a.Fragment,{},t)}},j=b.a.forwardRef((function(e,t){var a=e.components,n=e.mdxType,c=e.originalType,i=e.parentName,o=l(e,["components","mdxType","originalType","parentName"]),d=p(a),j=n,s=d["".concat(i,".").concat(j)]||d[j]||O[j]||c;return a?b.a.createElement(s,r(r({ref:t},o),{},{components:a})):b.a.createElement(s,r({ref:t},o))}));function s(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var c=a.length,i=new Array(c);i[0]=j;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r.mdxType="string"==typeof e?e:n,i[1]=r;for(var o=2;o();\n')),Object(c.b)("p",null,"\u5982\u9700\u8de8\u5e93\u67e5\u8be2\uff0c\u9700\u7528\u5230\u6570\u636e\u5e93\u6280\u672f\uff0c\u5982 ",Object(c.b)("inlineCode",{parentName:"p"},"SqlServer")," \u94fe\u63a5\u670d\u52a1\u5668\u6216\u540c\u4e49\u8bcd\u3002"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("strong",{parentName:"li"},"\u52a8\u6001\u5207\u6362\u6570\u636e\u5e93\u8868"))),Object(c.b)("pre",null,Object(c.b)("code",Object(n.a)({parentName:"pre"},{className:"language-cs"}),'// \u76f4\u63a5\u6539\u53d8\u8868\uff0c\u4f1a\u6709\u591a\u7ebf\u7a0b\u64cd\u4f5cbug\uff0c\u540c\u65f6\u65e0\u6cd5\u5237\u65b0\u6a21\u578b\nrepository.ChangeTable("\u6570\u636e\u5e93\u8868");\n\n// \u521b\u5efa\u65b0\u7684 DbContext\uff0c\u7136\u540e\u5237\u65b0 OnModelCreating\uff08\u63a8\u8350\u65b9\u5f0f\uff09\nvar dynamicDbContextResolve = App.TransientServices.GetService>();\nvar dynamicDbContext = dynamicDbContextResolve(typeof(MyDbContextLocator), default);\n// \u91cd\u65b0\u8c03\u7528 OnModelCreating\uff0c\u5728 OnModelCreating \u4e2d\u914d\u7f6e ToTable("\u52a8\u6001\u8868") \u5373\u53ef\u3002\nDynamicModelCacheKeyFactory.RebuildModels();\nvar persons= dynamicDbContext.Set();\npersons.Add(new Person{});\n')),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(n.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(n.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(n.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(n.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(c.b)("div",Object(n.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(c.b)("inlineCode",{parentName:"p"},"DynamicModelCacheKeyFactory")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(c.b)("a",Object(n.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/ef/core/modeling/dynamic-model"}),"EF Core - \u591a\u4e2a\u6a21\u578b\u4e4b\u95f4\u4ea4\u66ff")," \u7ae0\u8282\u3002"))),Object(c.b)("h2",{id:"9277-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.27.7 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(n.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(n.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(n.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(n.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(c.b)("div",Object(n.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(c.b)("a",Object(n.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/0ddd808e.1930f9f7.js b/docs/0ddd808e.1930f9f7.js new file mode 100644 index 00000000000..d819645a78b --- /dev/null +++ b/docs/0ddd808e.1930f9f7.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return m})),t.d(n,"b",(function(){return u}));var a=t(0),i=t.n(a);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function b(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function c(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=i.a.createContext({}),o=function(e){var n=i.a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},m=function(e){var n=o(e.components);return i.a.createElement(p.Provider,{value:n},e.children)},s={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},d=i.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,b=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=o(t),d=a,u=m["".concat(b,".").concat(d)]||m[d]||s[d]||r;return t?i.a.createElement(u,c(c({ref:n},p),{},{components:t})):i.a.createElement(u,c({ref:n},p))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,b=new Array(r);b[0]=d;var c={};for(var l in n)hasOwnProperty.call(n,l)&&(c[l]=n[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,b[1]=c;for(var p=2;pfunction(e,n,t,{forcePrependBaseUrl:a=!1,absolute:r=!1}={}){if(!t)return t;if(t.startsWith("#"))return t;if(Object(i.b)(t))return t;if(a)return n+t;const b=t.startsWith(n)?t:n+t.replace(/^\//,"");return r?e+b:b}(n,e,t,a)}}function b(e,n={}){const{withBaseUrl:t}=r();return t(e,n)}},145:function(e,n,t){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function i(e){return void 0!==e&&!a(e)}t.d(n,"b",(function(){return a})),t.d(n,"a",(function(){return i}))},146:function(e,n,t){"use strict";function a(e){var n,t,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;nn.value===e)&&j(e)}const C=e=>{j(e),null!=s&&u(s,e)},v=[],A=e=>{e.metaKey||e.altKey||e.ctrlKey||g(!0)},h=()=>{g(!1)};return Object(a.useEffect)(()=>{window.addEventListener("keydown",A),window.addEventListener("mousedown",h)},[]),i.a.createElement("div",null,i.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(b.a)("tabs",{"tabs--block":n})},m.map(({value:e,label:n})=>i.a.createElement("li",{role:"tab",tabIndex:0,"aria-selected":O===e,className:Object(b.a)("tabs__item",l.a.tabItem,{"tabs__item--active":O===e}),style:N?{}:{outline:"none"},key:e,ref:e=>v.push(e),onKeyDown:e=>{((e,n,t)=>{switch(t.keyCode){case o:((e,n)=>{const t=e.indexOf(n)+1;e[t]?e[t].focus():e[0].focus()})(e,n);break;case p:((e,n)=>{const t=e.indexOf(n)-1;e[t]?e[t].focus():e[e.length-1].focus()})(e,n)}})(v,e.target,e),A(e)},onFocus:()=>C(e),onClick:()=>{C(e),g(!1)},onPointerDown:()=>g(!1)},n))),i.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(t).filter(e=>e.props.value===O)[0]))}},150:function(e,n,t){"use strict";var a=t(0),i=t.n(a);n.a=function(e){return i.a.createElement("div",null,e.children)}},60:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return p})),t.d(n,"metadata",(function(){return o})),t.d(n,"rightToc",(function(){return m})),t.d(n,"default",(function(){return d}));var a=t(2),i=t(6),r=(t(0),t(142)),b=t(144),c=t(149),l=t(150),p={id:"dynamic-api-controller",title:"5. \u52a8\u6001 WebAPI",sidebar_label:"5. \u52a8\u6001 WebAPI"},o={unversionedId:"dynamic-api-controller",id:"dynamic-api-controller",isDocsHomePage:!1,title:"5. \u52a8\u6001 WebAPI",description:"5.1 \u4ec0\u4e48\u662f\u63a7\u5236\u5668",source:"@site/docs\\dynamic-api-controller.mdx",slug:"/dynamic-api-controller",permalink:"/docs/dynamic-api-controller",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/dynamic-api-controller.mdx",version:"current",sidebar_label:"5. \u52a8\u6001 WebAPI",sidebar:"docs",previous:{title:"4.2 \u9009\u9879",permalink:"/docs/options"},next:{title:"6. \u89c4\u8303\u5316\u63a5\u53e3\u6587\u6863",permalink:"/docs/specification-document"}},m=[{value:"5.1 \u4ec0\u4e48\u662f\u63a7\u5236\u5668",id:"51-\u4ec0\u4e48\u662f\u63a7\u5236\u5668",children:[]},{value:"5.2 Mvc \u63a7\u5236\u5668 \u7ea6\u5b9a\u548c\u7f3a\u70b9",id:"52-mvc-\u63a7\u5236\u5668-\u7ea6\u5b9a\u548c\u7f3a\u70b9",children:[{value:"5.2.1 WebAPI \u7ea6\u5b9a",id:"521-webapi-\u7ea6\u5b9a",children:[]},{value:"5.2.2 .NET Core WebAPI \u7f3a\u70b9",id:"522-net-core-webapi-\u7f3a\u70b9",children:[]}]},{value:"5.3 \u52a8\u6001 WebAPI \u63a7\u5236\u5668",id:"53-\u52a8\u6001-webapi-\u63a7\u5236\u5668",children:[]},{value:"5.4 \u6ce8\u518c\u52a8\u6001 WebAPI \u670d\u52a1",id:"54-\u6ce8\u518c\u52a8\u6001-webapi-\u670d\u52a1",children:[]},{value:"5.5 \u7b2c\u4e00\u4e2a\u4f8b\u5b50",id:"55-\u7b2c\u4e00\u4e2a\u4f8b\u5b50",children:[]},{value:"5.6 \u52a8\u6001 WebAPI \u539f\u7406\u89e3\u6790",id:"56-\u52a8\u6001-webapi-\u539f\u7406\u89e3\u6790",children:[{value:"5.6.1 \u63a7\u5236\u5668\u7279\u6027\u63d0\u4f9b\u5668",id:"561-\u63a7\u5236\u5668\u7279\u6027\u63d0\u4f9b\u5668",children:[]},{value:"5.6.2 \u5e94\u7528\u6a21\u578b\u8f6c\u6362\u5668",id:"562-\u5e94\u7528\u6a21\u578b\u8f6c\u6362\u5668",children:[]}]},{value:"5.7 \u52a8\u6001 WebAPI \u914d\u7f6e\u7ea6\u5b9a",id:"57-\u52a8\u6001-webapi-\u914d\u7f6e\u7ea6\u5b9a",children:[{value:"5.7.1 \u63a7\u5236\u5668\u9ed8\u8ba4\u7ea6\u5b9a",id:"571-\u63a7\u5236\u5668\u9ed8\u8ba4\u7ea6\u5b9a",children:[]},{value:"5.7.2 \u52a8\u4f5c\u65b9\u6cd5\u9ed8\u8ba4\u7ea6\u5b9a",id:"572-\u52a8\u4f5c\u65b9\u6cd5\u9ed8\u8ba4\u7ea6\u5b9a",children:[]},{value:"5.7.3 \u8bf7\u6c42\u8c13\u8bcd\u9ed8\u8ba4\u7ea6\u5b9a",id:"573-\u8bf7\u6c42\u8c13\u8bcd\u9ed8\u8ba4\u7ea6\u5b9a",children:[]},{value:"5.7.4 \u8def\u7531\u5730\u5740\u9ed8\u8ba4\u7ea6\u5b9a",id:"574-\u8def\u7531\u5730\u5740\u9ed8\u8ba4\u7ea6\u5b9a",children:[]},{value:"5.7.5 \u5176\u4ed6\u7ea6\u5b9a",id:"575-\u5176\u4ed6\u7ea6\u5b9a",children:[]}]},{value:"5.8 \u66f4\u591a\u4f8b\u5b50",id:"58-\u66f4\u591a\u4f8b\u5b50",children:[{value:"5.8.1 \u591a\u79cd\u8bf7\u6c42\u8c13\u8bcd\u65b9\u6cd5",id:"581-\u591a\u79cd\u8bf7\u6c42\u8c13\u8bcd\u65b9\u6cd5",children:[]},{value:"5.8.2 \u591a\u4e2a\u81ea\u5b9a\u4e49\u52a8\u4f5c\u65b9\u6cd5",id:"582-\u591a\u4e2a\u81ea\u5b9a\u4e49\u52a8\u4f5c\u65b9\u6cd5",children:[]},{value:"5.8.3 \u5e26\u53c2\u6570\u52a8\u4f5c\u65b9\u6cd5",id:"583-\u5e26\u53c2\u6570\u52a8\u4f5c\u65b9\u6cd5",children:[]},{value:"5.8.5 GET/HEAD \u7c7b\u7c7b\u578b\u53c2\u6570",id:"585-gethead-\u7c7b\u7c7b\u578b\u53c2\u6570",children:[]},{value:"5.8.6 \u81ea\u5b9a\u4e49\u53c2\u6570\u4f4d\u7f6e",id:"586-\u81ea\u5b9a\u4e49\u53c2\u6570\u4f4d\u7f6e",children:[]},{value:"5.8.7 \u81ea\u5b9a\u4e49\u8bf7\u6c42\u8c13\u8bcd",id:"587-\u81ea\u5b9a\u4e49\u8bf7\u6c42\u8c13\u8bcd",children:[]},{value:"5.8.8 \u652f\u6301\u591a\u4e2a\u8c13\u8bcd",id:"588-\u652f\u6301\u591a\u4e2a\u8c13\u8bcd",children:[]},{value:"5.8.9 \u652f\u6301\u81ea\u5b9a\u4e49\u8def\u7531",id:"589-\u652f\u6301\u81ea\u5b9a\u4e49\u8def\u7531",children:[]},{value:"5.8.10 \u591a\u8def\u7531\u968f\u610f\u7ec4\u5408",id:"5810-\u591a\u8def\u7531\u968f\u610f\u7ec4\u5408",children:[]},{value:"5.8.11 \u652f\u6301\u7248\u672c\u63a7\u5236",id:"5811-\u652f\u6301\u7248\u672c\u63a7\u5236",children:[]},{value:"5.8.12 \u4e0d\u516c\u5f00\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5",id:"5812-\u4e0d\u516c\u5f00\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5",children:[]}]},{value:"5.9 [ApiDescriptionSettings]",id:"59-apidescriptionsettings",children:[{value:"5.9.1 \u5185\u7f6e\u914d\u7f6e",id:"591-\u5185\u7f6e\u914d\u7f6e",children:[]},{value:"5.9.2 Name \u914d\u7f6e",id:"592-name-\u914d\u7f6e",children:[]},{value:"5.9.3 KeepName \u914d\u7f6e",id:"593-keepname-\u914d\u7f6e",children:[]},{value:"5.9.4 SplitCamelCase \u914d\u7f6e",id:"594-splitcamelcase-\u914d\u7f6e",children:[]},{value:"5.9.5 KeepVerb \u914d\u7f6e",id:"595-keepverb-\u914d\u7f6e",children:[]},{value:"5.9.6 Enabled \u914d\u7f6e",id:"596-enabled-\u914d\u7f6e",children:[]},{value:"5.9.7 Module \u914d\u7f6e",id:"597-module-\u914d\u7f6e",children:[]},{value:"5.9.8 Version \u914d\u7f6e",id:"598-version-\u914d\u7f6e",children:[]},{value:"5.9.9 Groups \u914d\u7f6e",id:"599-groups-\u914d\u7f6e",children:[]},{value:"5.9.10 Tag \u914d\u7f6e",id:"5910-tag-\u914d\u7f6e",children:[]}]},{value:"5.10 DynamicApiControllerSettings \u914d\u7f6e",id:"510-dynamicapicontrollersettings-\u914d\u7f6e",children:[{value:"5.10.1 \u652f\u6301 Mvc \u63a7\u5236\u5668 \u52a8\u6001\u914d\u7f6e",id:"5101-\u652f\u6301-mvc-\u63a7\u5236\u5668-\u52a8\u6001\u914d\u7f6e",children:[]}]},{value:"5.11 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"511-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],s={rightToc:m};function d(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},s,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"51-\u4ec0\u4e48\u662f\u63a7\u5236\u5668"},"5.1 \u4ec0\u4e48\u662f\u63a7\u5236\u5668"),Object(r.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u63a7\u5236\u5668\u662f\u4e00\u4e2a\u627f\u4e0a\u542f\u4e0b\u7684\u4f5c\u7528\uff0c\u6839\u636e\u7528\u6237\u8f93\u5165\uff0c\u6267\u884c\u54cd\u5e94\u884c\u4e3a\uff08\u52a8\u4f5c\u65b9\u6cd5\uff09\uff0c\u540c\u65f6\u5728\u884c\u4e3a\u4e2d\u8c03\u7528\u6a21\u578b\u7684\u4e1a\u52a1\u903b\u8f91\uff0c\u8fd4\u56de\u7ed9\u7528\u6237\u7ed3\u679c\uff08\u89c6\u56fe\uff09\u3002"),Object(r.b)("img",{src:Object(b.a)("img/kzq.png")}),Object(r.b)("p",null),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4e2d\uff0c\u63a7\u5236\u5668\u6709\u4e24\u79cd\u8868\u73b0\u5f62\u5f0f\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Mvc"),"\uff08\u5e26\u89c6\u56fe\uff09"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"WebAPI"),"\uff08RESTful API\uff09")),Object(r.b)(c.a,{defaultValue:"mvc",values:[{label:"Mvc \u63a7\u5236\u5668",value:"mvc"},{label:"WebAPI \u63a7\u5236\u5668",value:"webapi"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"mvc",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,7}","{1,5,7}":!0}),"using Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n public class MvcController : Controller\n {\n public IActionResult Index()\n {\n return View();\n }\n }\n}\n"))),Object(r.b)(l.a,{value:"webapi",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,6,8,9}","{1,5,6,8,9}":!0}),'using Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class WebApiController : ControllerBase\n {\n [HttpGet]\n public IActionResult Get()\n {\n return Content(nameof(Fur));\n }\n }\n}\n')))),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Mvc")," \u63a7\u5236\u5668\u548c ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a7\u5236\u5668\u6700\u5927\u7684\u533a\u522b\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a7\u5236\u5668\u4e0d\u5e26 ",Object(r.b)("strong",{parentName:"p"},"\u89c6\u56fe")," \u548c\u901a\u8fc7 ",Object(r.b)("strong",{parentName:"p"},"\u8bf7\u6c42\u8c13\u8bcd\u548c\u8def\u7531\u5730\u5740\u54cd\u5e94\u884c\u4e3a"),"\u3002"),Object(r.b)("h2",{id:"52-mvc-\u63a7\u5236\u5668-\u7ea6\u5b9a\u548c\u7f3a\u70b9"},"5.2 ",Object(r.b)("inlineCode",{parentName:"h2"},"Mvc \u63a7\u5236\u5668")," \u7ea6\u5b9a\u548c\u7f3a\u70b9"),Object(r.b)("p",null,"\u5728\u5b66\u4e60\u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a7\u5236\u5668\u4e4b\u524d\uff0c\u9996\u5148\u4e86\u89e3 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4e2d ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u7684\u4e00\u4e9b\u7ea6\u5b9a\u548c\u6ce8\u610f\u4e8b\u9879\u3002"),Object(r.b)("h3",{id:"521-webapi-\u7ea6\u5b9a"},"5.2.1 ",Object(r.b)("inlineCode",{parentName:"h3"},"WebAPI")," \u7ea6\u5b9a"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u5e94\u7528\u4e2d\uff0c\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a7\u5236\u5668\u9700\u9075\u5faa\u4ee5\u4e0b\u7ea6\u5b9a\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u63a7\u5236\u5668\u7c7b",Object(r.b)("strong",{parentName:"li"},"\u5fc5\u987b\u7ee7\u627f ",Object(r.b)("inlineCode",{parentName:"strong"},"ControllerBase")," \u6216\u95f4\u63a5\u7ee7\u627f")),Object(r.b)("li",{parentName:"ul"},"\u52a8\u4f5c\u65b9\u6cd5",Object(r.b)("strong",{parentName:"li"},"\u5fc5\u987b\u8d34\u6709 ",Object(r.b)("inlineCode",{parentName:"strong"},"[HttpMethod]")," \u7279\u6027\uff0c\u5982\uff1a",Object(r.b)("inlineCode",{parentName:"strong"},"[HttpGet]"))),Object(r.b)("li",{parentName:"ul"},"\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5",Object(r.b)("strong",{parentName:"li"},"\u81f3\u5c11\u6709\u4e00\u4e2a\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"strong"},"[Route]")," \u7279\u6027")),Object(r.b)("li",{parentName:"ul"},"\u751f\u6210 ",Object(r.b)("inlineCode",{parentName:"li"},"WebAPI")," \u8def\u7531\u5730\u5740\u65f6\u4f1a\u81ea\u52a8\u53bb\u6389\u63a7\u5236\u5668\u540d\u79f0 ",Object(r.b)("inlineCode",{parentName:"li"},"Controller")," \u540e\u7f00\uff0c\u540c\u65f6\u4e5f\u4f1a\u53bb\u6389\u52a8\u4f5c\u65b9\u6cd5\u5339\u914d\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"HttpVerb")," \u8c13\u8bcd\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"li"},"GET\uff0cPOST\uff0cDELETE\uff0cPUT")," \u7b49"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("strong",{parentName:"li"},"\u4e0d\u652f\u6301\u8fd4\u56de\u975e ",Object(r.b)("inlineCode",{parentName:"strong"},"IEnumerable")," \u6cdb\u578b\u5bf9\u8c61")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("strong",{parentName:"li"},"\u4e0d\u652f\u6301\u7c7b\u7c7b\u578b\u53c2\u6570\u5728 ",Object(r.b)("inlineCode",{parentName:"strong"},"GET\uff0cHEAD")," \u8bf7\u6c42\u4e0b\u751f\u6210 ",Object(r.b)("inlineCode",{parentName:"strong"},"Query")," \u53c2\u6570"))),Object(r.b)("p",null,"\u9664\u4e86\u4e0a\u8ff0\u7ea6\u5b9a\u5916\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u8def\u7531\u5730\u5740",Object(r.b)("strong",{parentName:"p"},"\u57fa\u672c\u9760\u624b\u5de5\u5b8c\u6210"),"\uff0c\u4e0d\u5229\u4e8e\u4e66\u5199\uff0c\u4e0d\u5229\u4e8e\u7ef4\u62a4\uff0c\u518d\u8005\uff0c\u5728\u79fb\u52a8\u5e94\u7528\u5bf9\u63a5\u4e2d\u96be\u4ee5\u8fdb\u884c\u591a\u7248\u672c\u63a7\u5236\u3002"),Object(r.b)("h3",{id:"522-net-core-webapi-\u7f3a\u70b9"},"5.2.2 ",Object(r.b)("inlineCode",{parentName:"h3"},".NET Core WebAPI")," \u7f3a\u70b9"),Object(r.b)("p",null,"\u901a\u8fc7\u4e0a\u4e00\u7ae0\u8282\u53ef\u4ee5\u770b\u51fa\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u5e94\u7528\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u9700\u8981\u9075\u5faa\u79cd\u79cd\u7ea6\u5b9a\uff0c\u800c\u4e14\u5bb9\u6613\u51fa\u9519\u3002"),Object(r.b)("p",null,"\u9664\u4e86\u8fd9\u4e9b\u7ea6\u5b9a\uff0c",Object(r.b)("inlineCode",{parentName:"p"},".NET Core WebAPI")," \u6709\u4ee5\u4e0b\u7f3a\u70b9\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u8def\u7531\u5730\u5740\u57fa\u672c\u9760\u624b\u5de5\u5b8c\u6210"),Object(r.b)("li",{parentName:"ul"},"\u5728\u73b0\u5728\u79fb\u52a8\u4e3a\u738b\u7684\u65f6\u4ee3\uff0c\u4e0d\u5229\u4e8e\u8fdb\u884c\u591a\u7248\u672c\u63a7\u5236"),Object(r.b)("li",{parentName:"ul"},"\u5bf9\u63a5 ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger")," \u6587\u6863\u5206\u7ec4\u6bd4\u8f83\u590d\u6742"),Object(r.b)("li",{parentName:"ul"},"\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"li"},"Policy")," \u7b56\u7565\u6388\u6743\u4e5f\u6bd4\u8f83\u590d\u6742"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u63a7\u5236\u5668\u70ed\u62d4\u63d2\u63d2\u4ef6\u5316"),Object(r.b)("li",{parentName:"ul"},"\u96be\u4ee5\u5b9e\u73b0\u590d\u6742\u81ea\u5b9a\u4e49\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"RESTful API")," \u98ce\u683c")),Object(r.b)("h2",{id:"53-\u52a8\u6001-webapi-\u63a7\u5236\u5668"},"5.3 \u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"h2"},"WebAPI")," \u63a7\u5236\u5668"),Object(r.b)("p",null,"\u9488\u5bf9\u4ee5\u4e0a ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u63d0\u4f9b\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u5fc5\u987b\u9075\u5faa\u7684\u7ea6\u5b9a\u548c\u4e0d\u53ef\u907f\u514d\u7684\u7f3a\u70b9\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u521b\u9020\u51fa\u4e00\u79cd\u66f4\u52a0\u7075\u6d3b\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a7\u5236\u5668\u7684\u65b9\u5f0f\u3002"),Object(r.b)("p",null,"\u8fd9\u4e2a\u65b9\u5f0f\u5728\u7ee7\u627f\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core WebAPI")," \u6240\u6709\u4f18\u70b9\uff0c\u540c\u65f6\u8fdb\u884c\u4e86\u5927\u91cf\u62d3\u5c55\u548c\u4f18\u5316\u3002\u4f18\u5316\u540e\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u5177\u6709\u4ee5\u4e0b\u4f18\u70b9\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u5177\u5907\u539f\u6709\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"ControllerBase")," \u6240\u6709\u529f\u80fd"),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301",Object(r.b)("strong",{parentName:"li"},"\u4efb\u610f\u516c\u5f00 \u975e\u9759\u6001 \u975e\u62bd\u8c61 \u975e\u6cdb\u578b\u7c7b"),"\u8f6c\u63a7\u5236\u5668"),Object(r.b)("li",{parentName:"ul"},"\u63d0\u4f9b\u66f4\u52a0\u7075\u6d3b\u65b9\u4fbf\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"IDynamicApiController")," \u7a7a\u63a5\u53e3\u6216 ",Object(r.b)("inlineCode",{parentName:"li"},"[DynamicApiController]")," \u7279\u6027\u66ff\u4ee3 ",Object(r.b)("inlineCode",{parentName:"li"},"ControllerBase")," \u62bd\u8c61\u7c7b"),Object(r.b)("li",{parentName:"ul"},"\u65e0\u9700\u624b\u52a8\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpMethod]")," \u7279\u6027\uff0c\u540c\u65f6\u652f\u6301\u4e00\u4e2a\u52a8\u4f5c\u65b9\u6cd5\u591a\u4e2a ",Object(r.b)("inlineCode",{parentName:"li"},"HttpVerb")),Object(r.b)("li",{parentName:"ul"},"\u65e0\u9700\u624b\u52a8\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"li"},"[Route]")," \u7279\u6027\uff0c\u652f\u6301\u66f4\u52a0\u7075\u6d3b\u7684\u914d\u7f6e\u53ca\u81ea\u52a8\u8def\u7531\u751f\u6210"),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301\u8fd4\u56de\u6cdb\u578b\u63a5\u53e3\uff0c\u6cdb\u578b\u7c7b"),Object(r.b)("li",{parentName:"ul"},"\u548c ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger")," \u6df1\u5ea6\u7ed3\u5408\uff0c\u63d0\u4f9b\u6781\u5176\u65b9\u4fbf\u7684\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger")," \u5206\u7ec4\u914d\u7f6e"),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"li"},"Basic Auth\uff0cJwt\uff0cApiKey")," \u7b49\u591a\u79cd\u6743\u9650\u7075\u6d3b\u914d\u7f6e"),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301\u63a7\u5236\u5668\u3001\u52a8\u4f5c\u65b9\u6cd5",Object(r.b)("strong",{parentName:"li"},"\u7248\u672c\u63a7\u5236"),"\u529f\u80fd"),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"li"},"GET\u3001HEAD")," \u8bf7\u6c42\u81ea\u52a8\u8f6c\u6362 ",Object(r.b)("inlineCode",{parentName:"li"},"\u7c7b\u7c7b\u578b\u53c2\u6570")),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301\u751f\u6210 ",Object(r.b)("inlineCode",{parentName:"li"},"OAS3")," \u63a5\u53e3\u89c4\u8303")),Object(r.b)("h2",{id:"54-\u6ce8\u518c\u52a8\u6001-webapi-\u670d\u52a1"},"5.4 \u6ce8\u518c\u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"h2"},"WebAPI")," \u670d\u52a1"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddControllers()\n .AddDynamicApiControllers();\n }\n }\n}\n")),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},".AddDynamicApiControllers()")," \u5fc5\u987b\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"services.AddControllers()")," \u4e4b\u540e\u6ce8\u518c\u3002"))),Object(r.b)("h2",{id:"55-\u7b2c\u4e00\u4e2a\u4f8b\u5b50"},"5.5 \u7b2c\u4e00\u4e2a\u4f8b\u5b50"),Object(r.b)("p",null,"\u521b\u5efa\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"FurAppService")," \u7c7b\u7ee7\u627f ",Object(r.b)("inlineCode",{parentName:"p"},"IDynamicApiController")," \u63a5\u53e3 \u6216 \u8d34 ",Object(r.b)("inlineCode",{parentName:"p"},"[DynamicApiController]")," \u7279\u6027\uff0c\u5e76\u5728\u8fd9\u4e2a\u7c7b\u4e2d\u7f16\u5199\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"Get")," \u65b9\u6cd5\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("strong",{parentName:"li"},Object(r.b)("inlineCode",{parentName:"strong"},"IDynamicApiController")," \u65b9\u5f0f"))),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,7}","{1,5,7}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return $"Hello {nameof(Fur)}";\n }\n }\n}\n')),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("strong",{parentName:"li"},Object(r.b)("inlineCode",{parentName:"strong"},"[DynamicApiController]")," \u65b9\u5f0f"))),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,8}","{1,5,8}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [DynamicApiController]\n public class FurAppService\n {\n public string Get()\n {\n return $"Hello {nameof(Fur)}";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a5\u53e3\u5c31\u8fd9\u4e48\u751f\u6210\u4e86\u3002"),Object(r.b)("img",{src:Object(b.a)("img/dyglz.gif")}),Object(r.b)("h2",{id:"56-\u52a8\u6001-webapi-\u539f\u7406\u89e3\u6790"},"5.6 \u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"h2"},"WebAPI")," \u539f\u7406\u89e3\u6790"),Object(r.b)("h3",{id:"561-\u63a7\u5236\u5668\u7279\u6027\u63d0\u4f9b\u5668"},"5.6.1 \u63a7\u5236\u5668\u7279\u6027\u63d0\u4f9b\u5668"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4f1a\u5728\u5e94\u7528\u542f\u52a8\u65f6\u6ce8\u518c ",Object(r.b)("inlineCode",{parentName:"p"},"DynamicApiControllerFeatureProvider")," \u63a7\u5236\u5668\u7279\u6027\u63d0\u4f9b\u5668\uff0c\u8be5\u63d0\u4f9b\u5668\u7ee7\u627f\u81ea ",Object(r.b)("inlineCode",{parentName:"p"},"ControllerFeatureProvider")," \u7c7b\u3002"),Object(r.b)("p",null,"\u63a5\u7740\u91cd\u5199 ",Object(r.b)("inlineCode",{parentName:"p"},"bool IsController(TypeInfo typeInfo)")," \u65b9\u6cd5\uff0c\u7528\u6765\u6807\u8bc6\u63a7\u5236\u5668\u7c7b\u578b\u3002\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c",Object(r.b)("strong",{parentName:"p"},"\u7ee7\u627f\u81ea ",Object(r.b)("inlineCode",{parentName:"strong"},"ControllerBase")," \u7c7b\u6216 ",Object(r.b)("inlineCode",{parentName:"strong"},"IDynamicApiController")," \u63a5\u53e3\u6216 ",Object(r.b)("inlineCode",{parentName:"strong"},"[DynamicApiController]")," \u7279\u6027\u90fd\u4f1a\u88ab\u6807\u8bb0\u4e3a\u63a7\u5236\u5668\u7c7b\u578b\u3002")),Object(r.b)("h3",{id:"562-\u5e94\u7528\u6a21\u578b\u8f6c\u6362\u5668"},"5.6.2 \u5e94\u7528\u6a21\u578b\u8f6c\u6362\u5668"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u540c\u65f6\u5728\u5e94\u7528\u542f\u52a8\u65f6\u6ce8\u518c ",Object(r.b)("inlineCode",{parentName:"p"},"DynamicApiControllerApplicationModelConvention")," \u5e94\u7528\u6a21\u578b\u8f6c\u6362\u5668\uff0c\u8be5\u8f6c\u6362\u5668\u7ee7\u627f\u81ea ",Object(r.b)("inlineCode",{parentName:"p"},"IApplicationModelConvention")," \u63a5\u53e3\u3002"),Object(r.b)("p",null,"\u63a5\u7740\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"void Apply(ApplicationModel application)")," \u63a5\u53e3\u65b9\u6cd5\u3002\u5728\u8be5\u65b9\u6cd5\u4e2d\u914d\u7f6e\u63a7\u5236\u5668\u540d\u79f0\u3001\u8def\u7531\u3001\u5bfc\u51fa\u53ef\u89c1\u6027\u53ca\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u3001\u8def\u7531\u3001\u5bfc\u51fa\u53ef\u89c1\u6027\u7b49\u3002"),Object(r.b)("p",null,"\u5b9e\u9645\u4e0a\u8be5\u65b9\u6cd5\u505a\u7684\u5c31\u662f\u6309\u7167 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("a",Object(a.a)({parentName:"strong"},{href:"#521-webapi-%E7%BA%A6%E5%AE%9A"}),"WebAPI \u7ea6\u5b9a"))," \u63d0\u524d\u5e2e\u6211\u4eec\u914d\u7f6e\u597d\u8def\u7531\u3001\u8bf7\u6c42\u8c13\u8bcd\u7b49\u4fe1\u606f\u3002\u907f\u514d\u4e86\u624b\u52a8\u914d\u7f6e\u7684\u540c\u65f6\u8fd8\u589e\u52a0\u4e86\u8bb8\u591a\u65b0\u7279\u6027\uff0c\u5982",Object(r.b)("strong",{parentName:"p"},"\u7248\u672c\u63a7\u5236\u3002")),Object(r.b)("h2",{id:"57-\u52a8\u6001-webapi-\u914d\u7f6e\u7ea6\u5b9a"},"5.7 \u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"h2"},"WebAPI")," \u914d\u7f6e\u7ea6\u5b9a"),Object(r.b)("h3",{id:"571-\u63a7\u5236\u5668\u9ed8\u8ba4\u7ea6\u5b9a"},"5.7.1 \u63a7\u5236\u5668\u9ed8\u8ba4\u7ea6\u5b9a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u751f\u6210\u63a7\u5236\u5668\u540d\u79f0\u9ed8\u8ba4\u53bb\u9664\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"AppServices\uff0cAppService\uff0cApiController\uff0cController\uff0cServices\uff0cService")," \u4f5c\u4e3a\u524d\u540e\u7f00\u7684\u5b57\u7b26\u4e32\u3002\u89c1\u7b2c\u4e00\u4e2a\u4f8b\u5b50\u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"FurAppService -> Fur")," ",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u63a7\u5236\u5668\u540d\u79f0\u5e26 ",Object(r.b)("inlineCode",{parentName:"li"},"V[0-9_]")," \u7ed3\u5c3e\u7684\uff0c\u4f1a\u81ea\u52a8\u751f\u6210\u63a7\u5236\u5668\u7248\u672c\u53f7\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"li"},"FurAppServiceV2 -> Fur@2"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"FurAppServiceV1_1_0 -> Fur@1.1.0"),"\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u7248\u672c\u5206\u9694\u7b26\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u63a7\u5236\u540d\u79f0\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"\u9a86\u9a7c\u547d\u540d\uff08CamelCase\uff09")," \u4f1a\u81ea\u52a8\u5207\u5272\u6210\u591a\u4e2a\u5355\u8bcd ",Object(r.b)("inlineCode",{parentName:"li"},"-")," \u8fde\u63a5\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"))),Object(r.b)("h3",{id:"572-\u52a8\u4f5c\u65b9\u6cd5\u9ed8\u8ba4\u7ea6\u5b9a"},"5.7.2 \u52a8\u4f5c\u65b9\u6cd5\u9ed8\u8ba4\u7ea6\u5b9a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u751f\u6210\u7684\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u9ed8\u8ba4\u53bb\u9664\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Post/Add/Create/Insert/Submit\uff0cGetAll/GetList/Get/Find/Fetch/Query/Search\uff0cPut/Update\uff0cDelete/Remove/Clear\uff0cPatch")," \u5f00\u5934\u7684\u5b57\u7b26\u4e32\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u751f\u6210\u7684\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u9ed8\u8ba4\u53bb\u9664\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Async")," \u4f5c\u4e3a\u524d\u540e\u7f00\u7684\u5b57\u7b26\u4e32\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u5e26 ",Object(r.b)("inlineCode",{parentName:"li"},"V[0-9_]")," \u7ed3\u5c3e\u7684\uff0c\u4f1a\u81ea\u52a8\u751f\u6210\u52a8\u4f5c\u65b9\u6cd5\u7248\u672c\u53f7\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"li"},"ChangePasswordV2 -> ChangePassword@2"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"ChangePasswordV1_1_0 -> ChangePassword@1.1.0"),"\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u7248\u672c\u5206\u9694\u7b26\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"\u9a86\u9a7c\u547d\u540d\uff08CamelCase\uff09")," \u4f1a\u81ea\u52a8\u5207\u5272\u6210\u591a\u4e2a\u5355\u8bcd ",Object(r.b)("inlineCode",{parentName:"li"},"-")," \u8fde\u63a5\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u52a8\u4f5c\u65b9\u6cd5\u53c2\u6570\u5c06\u81ea\u52a8\u8f6c\u4e3a\u5c0f\u5199\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"))),Object(r.b)("h3",{id:"573-\u8bf7\u6c42\u8c13\u8bcd\u9ed8\u8ba4\u7ea6\u5b9a"},"5.7.3 \u8bf7\u6c42\u8c13\u8bcd\u9ed8\u8ba4\u7ea6\u5b9a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u52a8\u4f5c\u65b9\u6cd5\u540d",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Post/Add/Create/Insert/Submit")," \u5f00\u5934\uff0c\u5219\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpPost]")," \u7279\u6027\u3002"),Object(r.b)("li",{parentName:"ul"},"\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"GetAll/GetList/Get/Find/Fetch/Query")," \u5f00\u5934\uff0c\u5219\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpGet]")," \u7279\u6027\u3002"),Object(r.b)("li",{parentName:"ul"},"\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Put/Update")," \u5f00\u5934\uff0c\u5219\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpPut]")," \u7279\u6027\u3002"),Object(r.b)("li",{parentName:"ul"},"\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Delete/Remove/Clear")," \u5f00\u5934\uff0c\u5219\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpDelete]")," \u7279\u6027\u3002"),Object(r.b)("li",{parentName:"ul"},"\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Patch")," \u5f00\u5934\uff0c\u5219\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpPatch]")," \u7279\u6027"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")))),Object(r.b)("li",{parentName:"ul"},"\u5982\u679c\u4e0d\u5728\u4e0a\u9762\u7ea6\u5b9a\u4e2d\uff0c\u5219\u9ed8\u8ba4\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpPost]")," \u7279\u6027\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"))),Object(r.b)("h3",{id:"574-\u8def\u7531\u5730\u5740\u9ed8\u8ba4\u7ea6\u5b9a"},"5.7.4 \u8def\u7531\u5730\u5740\u9ed8\u8ba4\u7ea6\u5b9a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u9ed8\u8ba4\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"api")," \u5f00\u5934\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u9ed8\u8ba4\u8f6c\u6362\u4e3a\u5c0f\u5199\u8def\u7531\u5730\u5740\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u751f\u6210\u63a7\u5236\u5668\u8def\u7531\u6a21\u677f\u683c\u5f0f\u4e3a\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"api/\u524d\u7f6e\u53c2\u6570\u5217\u8868/\u6a21\u5757\u540d\u6216\u9ed8\u8ba4\u533a\u57df\u540d/[controller@\u7248\u672c\u53f7]/\u540e\u7f6e\u53c2\u6570\u5217\u8868")),Object(r.b)("li",{parentName:"ul"},"\u751f\u6210\u52a8\u4f5c\u65b9\u6cd5\u8def\u7531\u6a21\u677f\u683c\u5f0f\u4e3a\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"\u524d\u7f6e\u53c2\u6570\u5217\u8868/\u6a21\u5757\u540d/[action@\u7248\u672c\u53f7]/\u540e\u7f6e\u53c2\u6570\u5217\u8868"))),Object(r.b)("h3",{id:"575-\u5176\u4ed6\u7ea6\u5b9a"},"5.7.5 \u5176\u4ed6\u7ea6\u5b9a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u9ed8\u8ba4\u4e0d\u5904\u7406 ",Object(r.b)("inlineCode",{parentName:"li"},"ControllerBase")," \u63a7\u5236\u5668\u7c7b\u578b\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u9ed8\u8ba4\u4e0d\u5904\u7406 ",Object(r.b)("inlineCode",{parentName:"li"},"GET\uff0cHEAD")," \u8bf7\u6c42\u7684\u5f15\u7528\u7c7b\u578b\u53c2\u6570\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"))),Object(r.b)("h2",{id:"58-\u66f4\u591a\u4f8b\u5b50"},"5.8 \u66f4\u591a\u4f8b\u5b50"),Object(r.b)("h3",{id:"581-\u591a\u79cd\u8bf7\u6c42\u8c13\u8bcd\u65b9\u6cd5"},"5.8.1 \u591a\u79cd\u8bf7\u6c42\u8c13\u8bcd\u65b9\u6cd5"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12,17,22,27}","{7,12,17,22,27}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return $"GET \u8bf7\u6c42";\n }\n\n public string Post()\n {\n return $"POST \u8bf7\u6c42";\n }\n\n public string Delete()\n {\n return $"DELETE \u8bf7\u6c42";\n }\n\n public string Put()\n {\n return $"PUT \u8bf7\u6c42";\n }\n\n public string Patch()\n {\n return $"PATCH \u8bf7\u6c42";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dgqqwc.png")}),Object(r.b)("h3",{id:"582-\u591a\u4e2a\u81ea\u5b9a\u4e49\u52a8\u4f5c\u65b9\u6cd5"},"5.8.2 \u591a\u4e2a\u81ea\u5b9a\u4e49\u52a8\u4f5c\u65b9\u6cd5"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12,17}","{7,12,17}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string GetVersion()\n {\n return $"v1.0.0";\n }\n\n public string ChangeProfile()\n {\n return "\u4fee\u6539\u6210\u529f";\n }\n\n public string DeleteUser()\n {\n return "\u5220\u9664\u6210\u529f";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dzmc.png")}),Object(r.b)("h3",{id:"583-\u5e26\u53c2\u6570\u52a8\u4f5c\u65b9\u6cd5"},"5.8.3 \u5e26\u53c2\u6570\u52a8\u4f5c\u65b9\u6cd5"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12,17}","{7,12,17}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string GetUser(int id)\n {\n return $"{id}";\n }\n\n public string GetUser(int id, string name)\n {\n return $"{id} {name}";\n }\n\n public TestDto Add(TestDto testDto)\n {\n return testDto;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dcsff.gif")}),Object(r.b)("h3",{id:"585-gethead-\u7c7b\u7c7b\u578b\u53c2\u6570"},"5.8.5 ",Object(r.b)("inlineCode",{parentName:"h3"},"GET/HEAD")," \u7c7b\u7c7b\u578b\u53c2\u6570"),Object(r.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4f1a\u5c06 ",Object(r.b)("inlineCode",{parentName:"p"},"GET/HEAD")," \u8bf7\u6c42\u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"\u7c7b\u7c7b\u578b\u53c2\u6570")," \u8bbe\u7f6e\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"[FromBody]")," \u7ed1\u5b9a\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7}","{7}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public TestDto GetTest(TestDto testDto)\n {\n return testDto;\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/getyycs.png")}),Object(r.b)("p",null,"\u4f46\u662f\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"GET\u3001HEAD")," \u8bf7\u6c42\u4e0d\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},"From Body")," \u7ed1\u5b9a\u3002\u6240\u4ee5\u6211\u4eec\u9700\u8981\u8f6c\u6362\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"Query")," \u67e5\u8be2\u53c2\u6570\u3002"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u652f\u6301\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u914d\u7f6e\uff1a"),Object(r.b)(c.a,{defaultValue:"fromquery",values:[{label:"[FromQuery] \u7279\u6027",value:"fromquery"},{label:"\u914d\u7f6e DynamicApiControllerSettings",value:"DynamicApiControllerSettings"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"fromquery",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8}","{2,8}":!0}),"using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public TestDto GetTest([FromQuery] TestDto testDto)\n {\n return testDto;\n }\n }\n}\n"))),Object(r.b)(l.a,{value:"DynamicApiControllerSettings",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-4} title="Fur.Web.Entry/appsettings.json"',"{2-4}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "DynamicApiControllerSettings": {\n "ModelToQuery": true\n }\n }\n}\n')))),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/modeltoquery.png")}),Object(r.b)("h3",{id:"586-\u81ea\u5b9a\u4e49\u53c2\u6570\u4f4d\u7f6e"},"5.8.6 \u81ea\u5b9a\u4e49\u53c2\u6570\u4f4d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u65b9\u4fbf\u7684\u81ea\u5b9a\u4e49\u53c2\u6570\u4f4d\u7f6e\u7684\u7279\u6027 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiSeat]"),"\uff0c\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiSeat]")," \u53ef\u914d\u7f6e\u53c2\u6570\u4f4d\u7f6e\uff0c\u652f\u6301\u4ee5\u4e0b\u56db\u79cd\u4f4d\u7f6e\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ApiSeats.ControllerStart"),"\uff1a\u63a7\u5236\u5668\u4e4b\u524d"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ApiSeats.ControllerEnd"),"\uff1a\u63a7\u5236\u5668\u4e4b\u540e"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ApiSeats.ActionStart"),"\uff1a\u52a8\u4f5c\u65b9\u6cd5\u4e4b\u524d"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ApiSeats.ActionEnd"),"\uff1a\u52a8\u4f5c\u65b9\u6cd5\u4e4b\u540e\u3002",Object(r.b)("strong",{parentName:"li"},"\u9ed8\u8ba4\u503c"))),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{8-9,15-20}","{8-9,15-20}":!0}),'using Fur.DynamicApiController;\nusing System;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n // \u53c2\u6570\u9ed8\u8ba4\u4e3a ApiSeats.ActionEnd\n public string RouteSeat(int id, string name)\n {\n return "\u914d\u7f6e\u8def\u7531\u53c2\u6570\u4f4d\u7f6e";\n }\n\n public string RouteSeat(\n [ApiSeat(ApiSeats.ControllerStart)] int id, // \u63a7\u5236\u5668\u540d\u79f0\u4e4b\u524d\n [ApiSeat(ApiSeats.ControllerEnd)] string name, // \u63a7\u5236\u5668\u540d\u79f0\u4e4b\u540e\n [ApiSeat(ApiSeats.ControllerEnd)] int age, // \u63a7\u5236\u5668\u540d\u79f0\u4e4b\u540e\n [ApiSeat(ApiSeats.ActionStart)] decimal weight, // \u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u4e4b\u524d\n [ApiSeat(ApiSeats.ActionStart)] float height, // \u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u4e4b\u524d\n [ApiSeat(ApiSeats.ActionEnd)] DateTime birthday) // \u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u4e4b\u540e\uff08\u9ed8\u8ba4\u503c\uff09\n {\n return "\u914d\u7f6e\u8def\u7531\u53c2\u6570\u4f4d\u7f6e";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/cswz.png")}),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u6e29\u99a8\u63d0\u793a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u591a\u4e2a ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"\u540c\u4f4d\u7f6e"))," \u914d\u7f6e\u7684\u53c2\u6570\u5c06\u6309\u7167 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"\u5b9a\u4e49\u53c2\u6570\u987a\u5e8f"))," \u8fdb\u884c\u6392\u5e8f\u3002"))),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"[ApiSeat]")," \u53ea\u80fd\u5e94\u7528\u4e8e\u8d34\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"[FromRoute]")," \u7279\u6027\u7684\u53c2\u6570\u6216 ",Object(r.b)("inlineCode",{parentName:"p"},"\u57fa\u5143\u7c7b\u578b\u3001\u503c\u7c7b\u578b\u3001\u53ef\u7a7a\u57fa\u5143\u7c7b\u578b\u548c\u53ef\u7a7a\u503c\u7c7b\u578b"),"\u3002"))),Object(r.b)("h3",{id:"587-\u81ea\u5b9a\u4e49\u8bf7\u6c42\u8c13\u8bcd"},"5.8.7 \u81ea\u5b9a\u4e49\u8bf7\u6c42\u8c13\u8bcd"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8}","{2,8}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [HttpPost]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/zdywc.png")}),Object(r.b)("h3",{id:"588-\u652f\u6301\u591a\u4e2a\u8c13\u8bcd"},"5.8.8 \u652f\u6301\u591a\u4e2a\u8c13\u8bcd"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8}","{2,8}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [HttpPost, HttpGet, AcceptVerbs("PUT", "DELETE")]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dgwc.png")}),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c\u52a8\u4f5c\u65b9\u6cd5\u4e2d\u542b\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"\u7c7b\u7c7b\u578b\u53c2\u6570"),"\uff0c\u4e14\u542b\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"POST/PUT/DELETE")," \u4efb\u610f\u8bf7\u6c42\u8c13\u8bcd\uff0c\u90a3\u4e48\u8be5\u53c2\u6570\u4f1a\u81ea\u52a8\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"p"},"[FromBody]")," \u53c2\u6570\uff0c\u5373\u4f7f\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"GET/HEAD")," \u8bf7\u6c42\u4e2d\u4e0d\u652f\u6301\u3002"))),Object(r.b)("h3",{id:"589-\u652f\u6301\u81ea\u5b9a\u4e49\u8def\u7531"},"5.8.9 \u652f\u6301\u81ea\u5b9a\u4e49\u8def\u7531"),Object(r.b)("p",null,"\u652f\u6301\u63a7\u5236\u5668\u548c\u52a8\u4f5c\u65b9\u6cd5\u81ea\u5b9a\u4e49\u8def\u7531\uff1a"),Object(r.b)(c.a,{defaultValue:"kzqrl",values:[{label:"\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u8def\u7531",value:"kzqrl"},{label:"\u81ea\u5b9a\u4e49\u52a8\u4f5c\u65b9\u6cd5\u8def\u7531",value:"dzffrl"},{label:"\u540c\u65f6\u81ea\u5b9a\u4e49\u8def\u7531",value:"allrl"},{label:"\u8c13\u8bcd\u81ea\u5b9a\u4e49\u8def\u7531",value:"vcrl"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"kzqrl",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,6}","{2,6}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n [Route("customapi/mobile/[controller]")]\n public class FurAppService : IDynamicApiController\n {\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/kzqrl.png")})),Object(r.b)(l.a,{value:"dzffrl",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8}","{2,8}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [Route("customapi/[action]")]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dzffrl.png")})),Object(r.b)(l.a,{value:"allrl",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,6,9}","{2,6,9}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n [Route("customapi/mobile/[controller]")]\n public class FurAppService : IDynamicApiController\n {\n [Route("get/[action]")]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/allrl.png")})),Object(r.b)(l.a,{value:"vcrl",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{9}","{9}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n [Route("api/[controller]")]\n public class FurAppService : IDynamicApiController\n {\n [HttpGet("get/[action]")]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/wcrl.png")}))),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u5c0f\u63d0\u793a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u52a8\u6001\u65b9\u6cd5\u81ea\u5b9a\u4e49\u8def\u7531\u5982\u679c\u4ee5 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"/"))," \u5f00\u5934\uff0c\u5219\u4e0d\u4f1a\u5408\u5e76\u63a7\u5236\u5668\u8def\u7531\u3002"))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u63a8\u8350\u914d\u7f6e")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u81ea\u5b9a\u4e49\u8def\u7531\u5982\u679c\u9700\u8981\u7528\u5230 ",Object(r.b)("strong",{parentName:"p"},"\u63a7\u5236\u5668/\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0"),"\uff0c\u63a8\u8350\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"[controller]")," \u6216 ",Object(r.b)("inlineCode",{parentName:"p"},"[action]")," \u5360\u4f4d\u7b26\uff0c\u56e0\u4e3a\u8be5\u5360\u4f4d\u7b26\u5df2\u7ecf\u81ea\u52a8\u5904\u7406\u4e86 ",Object(r.b)("strong",{parentName:"p"},"\u524d\u540e\u7f00\u3001\u7248\u672c\u53f7\u3001\u6a21\u5757\u540d\u79f0"),"\u7b49\u3002"))),Object(r.b)("h3",{id:"5810-\u591a\u8def\u7531\u968f\u610f\u7ec4\u5408"},"5.8.10 \u591a\u8def\u7531\u968f\u610f\u7ec4\u5408"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u5404\u79cd\u8def\u7531\u7ec4\u5408\u65b9\u5f0f\uff0c\u652f\u6301\u4e00\u5bf9\u591a\uff0c\u591a\u5bf9\u591a\u8def\u7531\u7ec4\u5408\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6-8,11-14}","{6-8,11-14}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n [Route("api/[controller]")]\n [Route("api/[controller]/second")]\n [Route("api/[controller]/three")]\n public class FurAppService : IDynamicApiController\n {\n [HttpGet]\n [HttpGet("get/[action]")]\n [HttpPost]\n [HttpPost("post/cus-version")]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dlrzh.gif")}),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u52a8\u4f5c\u65b9\u6cd5\u4e0d\u80fd\u540c\u65f6\u8d34 ",Object(r.b)("inlineCode",{parentName:"p"},"[Route]")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"[HttpMethod]")," \u7279\u6027\uff0c\u53ea\u80fd\u4e8c\u53d6\u4e00\u3002"))),Object(r.b)("h3",{id:"5811-\u652f\u6301\u7248\u672c\u63a7\u5236"},"5.8.11 \u652f\u6301\u7248\u672c\u63a7\u5236"),Object(r.b)(c.a,{defaultValue:"kzqbb",values:[{label:"\u63a7\u5236\u5668\u7248\u672c",value:"kzqbb"},{label:"\u52a8\u4f5c\u65b9\u6cd5\u7248\u672c",value:"dzffbb"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"kzqbb",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,13,21}","{5,13,21}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppServiceV1 : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n }\n\n public class FurAppServiceV1_2 : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n }\n\n public class FurAppServiceV1_2_1 : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/kzqbb.png")})),Object(r.b)(l.a,{value:"dzffbb",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12,16}","{7,12,16}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public string GetV1()\n {\n return nameof(Fur);\n }\n public string GetV2_1()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dzffbb.png")}))),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7248\u672c\u751f\u6210\u539f\u7406")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"V[0-9_]"))," \u7ed3\u5c3e\u7684\u547d\u540d\u81ea\u52a8\u89e3\u6790\u6210\u7248\u672c\u53f7\uff0c\u5982 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"FurAppServiceV2 -> Fur@2")),"\u3002"))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u7248\u672c\u590d\u5199")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u9664\u4e86\u901a\u8fc7\u7279\u5b9a\u540e\u7f00\u65b9\u5f0f\u4ee5\u5916\uff0c\u7248\u672c\u8fd8\u76f4\u63a5\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDescriptionSettings]")," \u8fdb\u884c\u590d\u5199\u3002\u5982\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,2}","{1,2}":!0}),'[ApiDescriptionSettings(Version = "4.0")]\npublic string GetV1()\n{\n return nameof(Fur);\n}\n')),Object(r.b)("p",{parentName:"div"},"\u8fd9\u65f6\uff0c\u751f\u6210\u7248\u672c\u5c06\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"4.0")," \u66ff\u4ee3 ",Object(r.b)("inlineCode",{parentName:"p"},"1")))),Object(r.b)("h3",{id:"5812-\u4e0d\u516c\u5f00\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5"},"5.8.12 \u4e0d\u516c\u5f00\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5"),Object(r.b)("p",null,"\u6709\u4e9b\u65f6\u5019\uff0c\u6211\u4eec\u65e0\u9700\u5bfc\u51fa\u67d0\u4e2a\u52a8\u4f5c\u65b9\u6cd5\u6216\u63a7\u5236\u5668\uff0c\u53ea\u9700\u8981\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDescriptionSettings(false)]")," \u6216 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiExplorerSettings(IgnoreApi = true)]"),"\u5373\u53ef\u3002"),Object(r.b)("p",null,"\u53e6\u5916\u52a8\u4f5c\u65b9\u6cd5\u8fd8\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},"[NonAction]")," \u6807\u8bb0\u3002"),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u63a8\u8350\u4f7f\u7528")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u63a8\u8350\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5\u8bbe\u7f6e\u4e0d\u5bfc\u51fa\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDescriptionSettings(false)]")," \u7279\u6027\u3002\u8be5\u7279\u6027\u9ed8\u8ba4\u7ee7\u627f\u81ea ",Object(r.b)("inlineCode",{parentName:"p"},"ApiExplorerSettingsAttribute")," \u7c7b\u3002"))),Object(r.b)("h2",{id:"59-apidescriptionsettings"},"5.9 ",Object(r.b)("inlineCode",{parentName:"h2"},"[ApiDescriptionSettings]")),Object(r.b)("p",null,"\u9664\u4e86\u4e0a\u8ff0 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u63d0\u4f9b\u7684\u914d\u7f6e\u5916\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u8fd8\u63d0\u4f9b\u4e86\u975e\u5e38\u5f3a\u5927\u4e14\u7075\u6d3b\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDescriptionSettings]")," \u7279\u6027\u3002"),Object(r.b)("h3",{id:"591-\u5185\u7f6e\u914d\u7f6e"},"5.9.1 \u5185\u7f6e\u914d\u7f6e"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Name"),"\uff1a\u81ea\u5b9a\u4e49\u63a7\u5236\u5668/\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"KeepName"),"\uff1a\u662f\u5426\u4fdd\u6301\u539f\u6709\u540d\u79f0\u4e0d\u5904\u7406\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"SplitCamelCase"),"\uff1a\u5207\u5272\u9a86\u9a7c\u547d\u540d\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"true")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"KeepVerb"),"\uff1a\u662f\u5426\u4fdd\u7559\u52a8\u4f5c\u65b9\u6cd5\u8bf7\u6c42\u8c13\u8bcd\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Enabled"),"\uff1a\u662f\u5426\u5bfc\u51fa\u63a5\u53e3\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"true")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Module"),"\uff1a\u6a21\u5757\u540d\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Version"),"\uff1a\u7248\u672c\u53f7\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Groups"),"\uff1a\u63a5\u53e3\u5206\u7ec4\uff0c\u53ef\u7ed3\u5408 ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger")," \u4e00\u8d77\u4f7f\u7528\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string[]"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Tags"),"\uff1a\u63a5\u53e3\u6807\u7b7e\uff0c\u53ef\u7ed3\u5408 ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger")," \u4e00\u8d77\u4f7f\u7528\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string[]"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"AuthPolicies"),"\uff1a\u6388\u6743\u7b56\u7565\uff0c\u53ef\u7ed3\u5408 ",Object(r.b)("inlineCode",{parentName:"li"},"\u6388\u6743\uff0cJWT")," \u4e00\u8d77\u4f7f\u7528\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string[]"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null"))),Object(r.b)("h3",{id:"592-name-\u914d\u7f6e"},"5.9.2 ",Object(r.b)("inlineCode",{parentName:"h3"},"Name")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Name")," \u53c2\u6570\u53ef\u4ee5\u8986\u76d6\u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u81ea\u52a8\u751f\u6210\u7684\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,8}","{5,8}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Name = "MyFur")]\n public class FurAppService : IDynamicApiController\n {\n [ApiDescriptionSettings(Name = "MyGet")]\n public string Get()\n {\n return nameof(Fur);\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/namepz.png")}),Object(r.b)("h3",{id:"593-keepname-\u914d\u7f6e"},"5.9.3 ",Object(r.b)("inlineCode",{parentName:"h3"},"KeepName")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"KeepName")," \u53c2\u6570\u53ef\u4ee5\u4fdd\u7559\u539f\u6709\u7684\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,8}","{5,8}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(KeepName = true)]\n public class FurAppService : IDynamicApiController\n {\n [ApiDescriptionSettings(KeepName = true)]\n public string Get()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/keepnamepz.png")}),Object(r.b)("h3",{id:"594-splitcamelcase-\u914d\u7f6e"},"5.9.4 ",Object(r.b)("inlineCode",{parentName:"h3"},"SplitCamelCase")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"SplitCamelCase")," \u53c2\u6570\u9ed8\u8ba4\u5c06\u9a86\u9a7c\u547d\u540d\u5207\u5272\u6210\u591a\u4e2a\u5355\u8bcd\u5e76\u901a\u8fc7\u6307\u5b9a ",Object(r.b)("inlineCode",{parentName:"p"},"\u5360\u4f4d\u7b26")," \u8fde\u63a5\u8d77\u6765\u3002\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"p"},"\u5360\u4f4d\u7b26")," \u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"-"),"\u3002\u9ed8\u8ba4\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"true"),"\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,8}","{5,8}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(SplitCamelCase = false)]\n public class MyFurAppService : IDynamicApiController\n {\n [ApiDescriptionSettings(SplitCamelCase = true)]\n public string ChangeUserName()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/splitnamepz.png")}),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"KeepName")," \u4f18\u5148\u7ea7\u9ad8\u4e8e ",Object(r.b)("inlineCode",{parentName:"p"},"SplitCamelCase"),"\uff0c\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"KeepName")," \u8bbe\u7f6e\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"true"),"\uff0c\u5219\u4e0d\u4f1a\u5904\u7406 ",Object(r.b)("inlineCode",{parentName:"p"},"SplitCamelCase")," \u53c2\u6570\u3002"))),Object(r.b)("h3",{id:"595-keepverb-\u914d\u7f6e"},"5.9.5 ",Object(r.b)("inlineCode",{parentName:"h3"},"KeepVerb")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"KeepVerb")," \u53c2\u6570\u4f5c\u7528\u4e8e\u52a8\u4f5c\u65b9\u6cd5\uff0c\u6807\u8bc6\u662f\u5426\u4fdd\u7559\u52a8\u4f5c\u8c13\u8bcd\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7}","{7}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [ApiDescriptionSettings(KeepVerb = true)]\n public string GetVersion()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/keepverbpz.png")}),Object(r.b)("h3",{id:"596-enabled-\u914d\u7f6e"},"5.9.6 ",Object(r.b)("inlineCode",{parentName:"h3"},"Enabled")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Enabled")," \u53c2\u6570\u914d\u7f6e\u63a5\u53e3\u662f\u5426\u5bfc\u51fa\u3002\u901a\u5e38\u7528\u4e8e\u52a8\u4f5c\u65b9\u6cd5\uff0c\u5982\u679c\u7528\u4e8e\u63a7\u5236\u5668\u5b9e\u9645\u4f5c\u7528\u4e0d\u5927\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{12}","{12}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string GetVersion()\n {\n return nameof(Fur);\n }\n\n [ApiDescriptionSettings(false)]\n public string NoExport()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/enablepz.png")}),Object(r.b)("h3",{id:"597-module-\u914d\u7f6e"},"5.9.7 ",Object(r.b)("inlineCode",{parentName:"h3"},"Module")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Module")," \u53c2\u6570\u53ef\u4ee5\u914d\u7f6e\u8def\u7531\u5206\u79bb\uff0c\u7c7b\u4f3c\u4e8e ",Object(r.b)("inlineCode",{parentName:"p"},"Mvc \u533a\u57df")," \u7684\u4f5c\u7528\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,8}","{5,8}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Module = "mobile")]\n public class FurAppService : IDynamicApiController\n {\n [ApiDescriptionSettings(Module = "user")]\n public string GetVersion()\n {\n return nameof(Fur);\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/modulepz.png")}),Object(r.b)("h3",{id:"598-version-\u914d\u7f6e"},"5.9.8 ",Object(r.b)("inlineCode",{parentName:"h3"},"Version")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Version")," \u53c2\u6570\u53ef\u4ee5\u914d\u7f6e\u63a5\u53e3\u7248\u672c\uff0c\u540c\u65f6\u53c8\u53ef\u4ee5\u590d\u5199\u7279\u6b8a\u7248\u672c\u547d\u540d\u914d\u7f6e\u3002\u9ed8\u8ba4\u7248\u672c\u53f7\u5206\u9694\u7b26\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"@"),"\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,9-10}","{5,9-10}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Version = "1.0")]\n public class FurAppService : IDynamicApiController\n {\n // V2.0.0 \u88ab\u590d\u5199\u6210 V2.1.1\n [ApiDescriptionSettings(Version = "2.1.1")]\n public string GetVersionV2_0_0()\n {\n return nameof(Fur);\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/versionpz.png")}),Object(r.b)("h3",{id:"599-groups-\u914d\u7f6e"},"5.9.9 ",Object(r.b)("inlineCode",{parentName:"h3"},"Groups")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Groups")," \u914d\u7f6e\u4e3b\u8981\u7528\u4e8e\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u5206\u7ec4\u4fe1\u606f\u3002"),Object(r.b)("p",null,"\u901a\u8fc7\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"Groups")," \u53c2\u6570\u53ef\u4ee5\u5c06",Object(r.b)("inlineCode",{parentName:"p"},"\u63a7\u5236\u5668\u548c\u52a8\u4f5c\u65b9\u6cd5")," \u8fdb\u884c\u5f52\u7c7b\u548c\u591a\u4e2a\u5206\u7ec4\u76f4\u63a5\u5171\u4eab\u3002\u53ef\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDescriptionSettings(params Groups)]")," \u6784\u9020\u51fd\u6570\u4f20\u5165\u6216\u6307\u5b9a ",Object(r.b)("inlineCode",{parentName:"p"},"Groups")," \u53c2\u6570\u914d\u7f6e\u63a5\u53e3\u662f\u5426\u5bfc\u51fa\u3002\u901a\u5e38\u7528\u4e8e\u52a8\u4f5c\u65b9\u6cd5\uff0c\u5982\u679c\u7528\u4e8e\u63a7\u5236\u5668\u5b9e\u9645\u4f5c\u7528\u4e0d\u5927\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,13}","{5,13}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings("Default", "Common")]\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n [ApiDescriptionSettings("Custom")]\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dfz.gif")}),Object(r.b)("h3",{id:"5910-tag-\u914d\u7f6e"},"5.9.10 ",Object(r.b)("inlineCode",{parentName:"h3"},"Tag")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Tag")," \u914d\u7f6e\u4e3b\u8981\u7528\u4e8e\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u6807\u7b7e\u5206\u7ec4\u4fe1\u606f\u53ca\u5408\u5e76\u6807\u7b7e\u3002\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"\u7ec4\u4e2d\u7ec4"),":"),Object(r.b)(c.a,{defaultValue:"tag1",values:[{label:"\u6807\u7b7e\u547d\u540d",value:"tag1"},{label:"\u5408\u5e76\u6807\u7b7e",value:"tag2"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"tag1",mdxType:"TabItem"},Object(r.b)("h4",{id:"\u672a\u8d34\u6807\u7b7e\u4e4b\u524d"},"\u672a\u8d34\u6807\u7b7e\u4e4b\u524d"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n")),Object(r.b)("h4",{id:"\u8d34\u6807\u7b7e\u4e4b\u540e"},"\u8d34\u6807\u7b7e\u4e4b\u540e"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,19}","{5,19}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Tag = "\u5206\u7ec4\u4e00")]\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n [ApiDescriptionSettings(Tag = "\u5206\u7ec4\u4e8c")]\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/tag1.png")})),Object(r.b)(l.a,{value:"tag2",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,19}","{5,19}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Tag = "\u5408\u5e76\u6240\u6709\u6807\u7b7e")]\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n [ApiDescriptionSettings(Tag = "\u5408\u5e76\u6240\u6709\u6807\u7b7e")]\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/tag2.png")}))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c ",Object(r.b)("inlineCode",{parentName:"p"},"Tag")," \u540d\u5b57\u4e00\u6837\uff0c\u5219\u4f1a\u81ea\u52a8\u5408\u5e76\uff0c\u5426\u5219\u53ea\u662f\u547d\u540d\u3002"))),Object(r.b)("h2",{id:"510-dynamicapicontrollersettings-\u914d\u7f6e"},"5.10 ",Object(r.b)("inlineCode",{parentName:"h2"},"DynamicApiControllerSettings")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u8fd8\u63d0\u4f9b\u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a5\u53e3\u4e00\u4e9b\u5168\u5c40\u914d\u7f6e\u9009\u9879\uff0c\u5982\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DefaultRoutePrefix"),"\uff1a\u9ed8\u8ba4\u8def\u7531\u524d\u7f00\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"api")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DefaultHttpMethod"),"\uff1a\u9ed8\u8ba4\u8bf7\u6c42\u8c13\u8bcd\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"POST")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DefaultModule"),"\uff1a\u9ed8\u8ba4\u6a21\u5757\u540d\u79f0\uff08\u533a\u57df\uff09\uff0c\u53ef\u7528\u4f5c\u63a5\u53e3\u7248\u672c\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"v1")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"LowercaseRoute"),"\uff1a\u5c0f\u5199\u8def\u7531\u683c\u5f0f\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"true")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"KeepVerb"),"\uff1a\u662f\u5426\u4fdd\u7559\u52a8\u4f5c\u8c13\u8bcd\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"CamelCaseSeparator"),"\uff1a\u9a86\u9a7c\u547d\u540d\u5206\u9694\u7b26\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"-")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"VersionSeparator"),"\uff1a\u7248\u672c\u5206\u9694\u7b26\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"@")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ModelToQuery"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"GET/HEAD")," \u8bf7\u6c42\u5c06 ",Object(r.b)("inlineCode",{parentName:"li"},"\u7c7b\u7c7b\u578b\u53c2\u6570\u8f6c\u67e5\u8be2\u53c2\u6570"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"SupportedMvcController"),"\uff1a\u662f\u5426\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"li"},"Mvc Controller")," \u52a8\u6001\u914d\u7f6e\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"AbandonControllerAffixes"),"\uff1a\u9ed8\u8ba4\u53bb\u9664\u63a7\u5236\u5668\u540d\u79f0\u524d\u540e\u7f00\u5217\u8868\u540d\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string[]"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"AppServices")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"AppService")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ApiController")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Controller")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Services")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Service")))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"AbandonActionAffixes"),"\uff1a\u9ed8\u8ba4\u53bb\u9664\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u524d\u540e\u7f00\u5217\u8868\u540d\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string[]"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Async"))))),Object(r.b)("h3",{id:"5101-\u652f\u6301-mvc-\u63a7\u5236\u5668-\u52a8\u6001\u914d\u7f6e"},"5.10.1 \u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"h3"},"Mvc \u63a7\u5236\u5668")," \u52a8\u6001\u914d\u7f6e"),Object(r.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a5\u53e3\u4e0d\u5bf9 ",Object(r.b)("inlineCode",{parentName:"p"},"ControllerBase")," \u7c7b\u578b\u8fdb\u884c\u4efb\u4f55\u5904\u7406\u3002\u5f53\u7136\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u624b\u52a8\u542f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"ControllerBase")," \u652f\u6301\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-4} title="Fur.Web.Entry/appsettings.json"',"{2-4}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "DynamicApiControllerSettings": {\n "SupportedMvcController": true\n }\n }\n}\n')),Object(r.b)("p",null,"\u8bbe\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"SupportedMvcController: true")," \u540e\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Mvc ControllerBase")," \u7c7b\u578b\u4e5f\u80fd\u548c\u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u4e00\u6837\u7684\u7075\u6d3b\u4e86\u3002\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5}","{5}":!0}),"using Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n public class MvcController : ControllerBase\n {\n public string Get()\n {\n return nameof(Fur);\n }\n }\n}\n\n")),Object(r.b)("div",{className:"admonition admonition-warning alert alert--danger"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})))),"\u6ce8\u610f\u4e8b\u9879")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u542f\u7528\u8be5\u914d\u7f6e\u540e\uff0c\u5982\u679c ",Object(r.b)("inlineCode",{parentName:"p"},"Mvc \u63a7\u5236\u5668")," \u6ca1\u6709\u4efb\u4f55 ",Object(r.b)("inlineCode",{parentName:"p"},"[Route]")," \u7279\u6027\uff0c\u4f46\u662f\u8d34\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiController]")," \u7279\u6027\u5c06\u4f1a\u62a5\u9519\u3002\u539f\u56e0\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiController]")," \u7279\u6027\u5185\u90e8\u505a\u4e86\u8def\u7531\u7279\u6027\u68c0\u6d4b\u3002\u6240\u4ee5\u5efa\u8bae\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDataValidation]")," \u4ee3\u66ff\u3002"),Object(r.b)("p",{parentName:"div"},"\u67e5\u770b ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/dotnet/aspnetcore/blob/c565386a3ed135560bc2e9017aa54a950b4e35dd/src/Mvc/Mvc.Core/src/ApplicationModels/ApiBehaviorApplicationModelProvider.cs#L90"}),"ASP.NET Core - ApiBehaviorApplicationModelProvider \u6e90\u7801")))),Object(r.b)("h2",{id:"511-\u53cd\u9988\u4e0e\u5efa\u8bae"},"5.11 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/0ddd808e.cf943861.js b/docs/0ddd808e.cf943861.js deleted file mode 100644 index 973864887ff..00000000000 --- a/docs/0ddd808e.cf943861.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return m})),t.d(n,"b",(function(){return d}));var a=t(0),i=t.n(a);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function b(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function c(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=i.a.createContext({}),o=function(e){var n=i.a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},m=function(e){var n=o(e.components);return i.a.createElement(p.Provider,{value:n},e.children)},s={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},u=i.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,b=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=o(t),u=a,d=m["".concat(b,".").concat(u)]||m[u]||s[u]||r;return t?i.a.createElement(d,c(c({ref:n},p),{},{components:t})):i.a.createElement(d,c({ref:n},p))}));function d(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,b=new Array(r);b[0]=u;var c={};for(var l in n)hasOwnProperty.call(n,l)&&(c[l]=n[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,b[1]=c;for(var p=2;pMvc \u63a7\u5236\u5668 \u7ea6\u5b9a\u548c\u7f3a\u70b9",id:"52-mvc-\u63a7\u5236\u5668-\u7ea6\u5b9a\u548c\u7f3a\u70b9",children:[{value:"5.2.1 WebAPI \u7ea6\u5b9a",id:"521-webapi-\u7ea6\u5b9a",children:[]},{value:"5.2.2 .NET Core WebAPI \u7f3a\u70b9",id:"522-net-core-webapi-\u7f3a\u70b9",children:[]}]},{value:"5.3 \u52a8\u6001 WebAPI \u63a7\u5236\u5668",id:"53-\u52a8\u6001-webapi-\u63a7\u5236\u5668",children:[]},{value:"5.4 \u6ce8\u518c\u52a8\u6001 WebAPI \u670d\u52a1",id:"54-\u6ce8\u518c\u52a8\u6001-webapi-\u670d\u52a1",children:[]},{value:"5.5 \u7b2c\u4e00\u4e2a\u4f8b\u5b50",id:"55-\u7b2c\u4e00\u4e2a\u4f8b\u5b50",children:[]},{value:"5.6 \u52a8\u6001 WebAPI \u539f\u7406\u89e3\u6790",id:"56-\u52a8\u6001-webapi-\u539f\u7406\u89e3\u6790",children:[{value:"5.6.1 \u63a7\u5236\u5668\u7279\u6027\u63d0\u4f9b\u5668",id:"561-\u63a7\u5236\u5668\u7279\u6027\u63d0\u4f9b\u5668",children:[]},{value:"5.6.2 \u5e94\u7528\u6a21\u578b\u8f6c\u6362\u5668",id:"562-\u5e94\u7528\u6a21\u578b\u8f6c\u6362\u5668",children:[]}]},{value:"5.7 \u52a8\u6001 WebAPI \u914d\u7f6e\u7ea6\u5b9a",id:"57-\u52a8\u6001-webapi-\u914d\u7f6e\u7ea6\u5b9a",children:[{value:"5.7.1 \u63a7\u5236\u5668\u9ed8\u8ba4\u7ea6\u5b9a",id:"571-\u63a7\u5236\u5668\u9ed8\u8ba4\u7ea6\u5b9a",children:[]},{value:"5.7.2 \u52a8\u4f5c\u65b9\u6cd5\u9ed8\u8ba4\u7ea6\u5b9a",id:"572-\u52a8\u4f5c\u65b9\u6cd5\u9ed8\u8ba4\u7ea6\u5b9a",children:[]},{value:"5.7.3 \u8bf7\u6c42\u8c13\u8bcd\u9ed8\u8ba4\u7ea6\u5b9a",id:"573-\u8bf7\u6c42\u8c13\u8bcd\u9ed8\u8ba4\u7ea6\u5b9a",children:[]},{value:"5.7.4 \u8def\u7531\u5730\u5740\u9ed8\u8ba4\u7ea6\u5b9a",id:"574-\u8def\u7531\u5730\u5740\u9ed8\u8ba4\u7ea6\u5b9a",children:[]},{value:"5.7.5 \u5176\u4ed6\u7ea6\u5b9a",id:"575-\u5176\u4ed6\u7ea6\u5b9a",children:[]}]},{value:"5.8 \u66f4\u591a\u4f8b\u5b50",id:"58-\u66f4\u591a\u4f8b\u5b50",children:[{value:"5.8.1 \u591a\u79cd\u8bf7\u6c42\u8c13\u8bcd\u65b9\u6cd5",id:"581-\u591a\u79cd\u8bf7\u6c42\u8c13\u8bcd\u65b9\u6cd5",children:[]},{value:"5.8.2 \u591a\u4e2a\u81ea\u5b9a\u4e49\u52a8\u4f5c\u65b9\u6cd5",id:"582-\u591a\u4e2a\u81ea\u5b9a\u4e49\u52a8\u4f5c\u65b9\u6cd5",children:[]},{value:"5.8.3 \u5e26\u53c2\u6570\u52a8\u4f5c\u65b9\u6cd5",id:"583-\u5e26\u53c2\u6570\u52a8\u4f5c\u65b9\u6cd5",children:[]},{value:"5.8.5 GET/HEAD \u7c7b\u7c7b\u578b\u53c2\u6570",id:"585-gethead-\u7c7b\u7c7b\u578b\u53c2\u6570",children:[]},{value:"5.8.6 \u81ea\u5b9a\u4e49\u53c2\u6570\u4f4d\u7f6e",id:"586-\u81ea\u5b9a\u4e49\u53c2\u6570\u4f4d\u7f6e",children:[]},{value:"5.8.7 \u81ea\u5b9a\u4e49\u8bf7\u6c42\u8c13\u8bcd",id:"587-\u81ea\u5b9a\u4e49\u8bf7\u6c42\u8c13\u8bcd",children:[]},{value:"5.8.8 \u652f\u6301\u591a\u4e2a\u8c13\u8bcd",id:"588-\u652f\u6301\u591a\u4e2a\u8c13\u8bcd",children:[]},{value:"5.8.9 \u652f\u6301\u81ea\u5b9a\u4e49\u8def\u7531",id:"589-\u652f\u6301\u81ea\u5b9a\u4e49\u8def\u7531",children:[]},{value:"5.8.10 \u591a\u8def\u7531\u968f\u610f\u7ec4\u5408",id:"5810-\u591a\u8def\u7531\u968f\u610f\u7ec4\u5408",children:[]},{value:"5.8.11 \u652f\u6301\u7248\u672c\u63a7\u5236",id:"5811-\u652f\u6301\u7248\u672c\u63a7\u5236",children:[]},{value:"5.8.12 \u4e0d\u516c\u5f00\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5",id:"5812-\u4e0d\u516c\u5f00\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5",children:[]}]},{value:"5.9 [ApiDescriptionSettings]",id:"59-apidescriptionsettings",children:[{value:"5.9.1 \u5185\u7f6e\u914d\u7f6e",id:"591-\u5185\u7f6e\u914d\u7f6e",children:[]},{value:"5.9.2 Name \u914d\u7f6e",id:"592-name-\u914d\u7f6e",children:[]},{value:"5.9.3 KeepName \u914d\u7f6e",id:"593-keepname-\u914d\u7f6e",children:[]},{value:"5.9.4 SplitCamelCase \u914d\u7f6e",id:"594-splitcamelcase-\u914d\u7f6e",children:[]},{value:"5.9.5 KeepVerb \u914d\u7f6e",id:"595-keepverb-\u914d\u7f6e",children:[]},{value:"5.9.6 Enabled \u914d\u7f6e",id:"596-enabled-\u914d\u7f6e",children:[]},{value:"5.9.7 Module \u914d\u7f6e",id:"597-module-\u914d\u7f6e",children:[]},{value:"5.9.8 Version \u914d\u7f6e",id:"598-version-\u914d\u7f6e",children:[]},{value:"5.9.9 Groups \u914d\u7f6e",id:"599-groups-\u914d\u7f6e",children:[]},{value:"5.9.10 Tag \u914d\u7f6e",id:"5910-tag-\u914d\u7f6e",children:[]}]},{value:"5.10 DynamicApiControllerSettings \u914d\u7f6e",id:"510-dynamicapicontrollersettings-\u914d\u7f6e",children:[{value:"5.10.1 \u652f\u6301 Mvc \u63a7\u5236\u5668 \u52a8\u6001\u914d\u7f6e",id:"5101-\u652f\u6301-mvc-\u63a7\u5236\u5668-\u52a8\u6001\u914d\u7f6e",children:[]}]},{value:"5.11 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"511-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],s={rightToc:m};function u(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},s,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"51-\u4ec0\u4e48\u662f\u63a7\u5236\u5668"},"5.1 \u4ec0\u4e48\u662f\u63a7\u5236\u5668"),Object(r.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u63a7\u5236\u5668\u662f\u4e00\u4e2a\u627f\u4e0a\u542f\u4e0b\u7684\u4f5c\u7528\uff0c\u6839\u636e\u7528\u6237\u8f93\u5165\uff0c\u6267\u884c\u54cd\u5e94\u884c\u4e3a\uff08\u52a8\u4f5c\u65b9\u6cd5\uff09\uff0c\u540c\u65f6\u5728\u884c\u4e3a\u4e2d\u8c03\u7528\u6a21\u578b\u7684\u4e1a\u52a1\u903b\u8f91\uff0c\u8fd4\u56de\u7ed9\u7528\u6237\u7ed3\u679c\uff08\u89c6\u56fe\uff09\u3002"),Object(r.b)("img",{src:Object(b.a)("img/kzq.png")}),Object(r.b)("p",null),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4e2d\uff0c\u63a7\u5236\u5668\u6709\u4e24\u79cd\u8868\u73b0\u5f62\u5f0f\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Mvc"),"\uff08\u5e26\u89c6\u56fe\uff09"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"WebAPI"),"\uff08RESTful API\uff09")),Object(r.b)(c.a,{defaultValue:"mvc",values:[{label:"Mvc \u63a7\u5236\u5668",value:"mvc"},{label:"WebAPI \u63a7\u5236\u5668",value:"webapi"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"mvc",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,7}","{1,5,7}":!0}),"using Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n public class MvcController : Controller\n {\n public IActionResult Index()\n {\n return View();\n }\n }\n}\n"))),Object(r.b)(l.a,{value:"webapi",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,6,8,9}","{1,5,6,8,9}":!0}),'using Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class WebApiController : ControllerBase\n {\n [HttpGet]\n public IActionResult Get()\n {\n return Content(nameof(Fur));\n }\n }\n}\n')))),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Mvc")," \u63a7\u5236\u5668\u548c ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a7\u5236\u5668\u6700\u5927\u7684\u533a\u522b\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a7\u5236\u5668\u4e0d\u5e26 ",Object(r.b)("strong",{parentName:"p"},"\u89c6\u56fe")," \u548c\u901a\u8fc7 ",Object(r.b)("strong",{parentName:"p"},"\u8bf7\u6c42\u8c13\u8bcd\u548c\u8def\u7531\u5730\u5740\u54cd\u5e94\u884c\u4e3a"),"\u3002"),Object(r.b)("h2",{id:"52-mvc-\u63a7\u5236\u5668-\u7ea6\u5b9a\u548c\u7f3a\u70b9"},"5.2 ",Object(r.b)("inlineCode",{parentName:"h2"},"Mvc \u63a7\u5236\u5668")," \u7ea6\u5b9a\u548c\u7f3a\u70b9"),Object(r.b)("p",null,"\u5728\u5b66\u4e60\u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a7\u5236\u5668\u4e4b\u524d\uff0c\u9996\u5148\u4e86\u89e3 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4e2d ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u7684\u4e00\u4e9b\u7ea6\u5b9a\u548c\u6ce8\u610f\u4e8b\u9879\u3002"),Object(r.b)("h3",{id:"521-webapi-\u7ea6\u5b9a"},"5.2.1 ",Object(r.b)("inlineCode",{parentName:"h3"},"WebAPI")," \u7ea6\u5b9a"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u5e94\u7528\u4e2d\uff0c\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a7\u5236\u5668\u9700\u9075\u5faa\u4ee5\u4e0b\u7ea6\u5b9a\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u63a7\u5236\u5668\u7c7b",Object(r.b)("strong",{parentName:"li"},"\u5fc5\u987b\u7ee7\u627f ",Object(r.b)("inlineCode",{parentName:"strong"},"ControllerBase")," \u6216\u95f4\u63a5\u7ee7\u627f")),Object(r.b)("li",{parentName:"ul"},"\u52a8\u4f5c\u65b9\u6cd5",Object(r.b)("strong",{parentName:"li"},"\u5fc5\u987b\u8d34\u6709 ",Object(r.b)("inlineCode",{parentName:"strong"},"[HttpMethod]")," \u7279\u6027\uff0c\u5982\uff1a",Object(r.b)("inlineCode",{parentName:"strong"},"[HttpGet]"))),Object(r.b)("li",{parentName:"ul"},"\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5",Object(r.b)("strong",{parentName:"li"},"\u81f3\u5c11\u6709\u4e00\u4e2a\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"strong"},"[Route]")," \u7279\u6027")),Object(r.b)("li",{parentName:"ul"},"\u751f\u6210 ",Object(r.b)("inlineCode",{parentName:"li"},"WebAPI")," \u8def\u7531\u5730\u5740\u65f6\u4f1a\u81ea\u52a8\u53bb\u6389\u63a7\u5236\u5668\u540d\u79f0 ",Object(r.b)("inlineCode",{parentName:"li"},"Controller")," \u540e\u7f00\uff0c\u540c\u65f6\u4e5f\u4f1a\u53bb\u6389\u52a8\u4f5c\u65b9\u6cd5\u5339\u914d\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"HttpVerb")," \u8c13\u8bcd\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"li"},"GET\uff0cPOST\uff0cDELETE\uff0cPUT")," \u7b49"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("strong",{parentName:"li"},"\u4e0d\u652f\u6301\u8fd4\u56de\u975e ",Object(r.b)("inlineCode",{parentName:"strong"},"IEnumerable")," \u6cdb\u578b\u5bf9\u8c61")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("strong",{parentName:"li"},"\u4e0d\u652f\u6301\u7c7b\u7c7b\u578b\u53c2\u6570\u5728 ",Object(r.b)("inlineCode",{parentName:"strong"},"GET\uff0cHEAD")," \u8bf7\u6c42\u4e0b\u751f\u6210 ",Object(r.b)("inlineCode",{parentName:"strong"},"Query")," \u53c2\u6570"))),Object(r.b)("p",null,"\u9664\u4e86\u4e0a\u8ff0\u7ea6\u5b9a\u5916\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u8def\u7531\u5730\u5740",Object(r.b)("strong",{parentName:"p"},"\u57fa\u672c\u9760\u624b\u5de5\u5b8c\u6210"),"\uff0c\u4e0d\u5229\u4e8e\u4e66\u5199\uff0c\u4e0d\u5229\u4e8e\u7ef4\u62a4\uff0c\u518d\u8005\uff0c\u5728\u79fb\u52a8\u5e94\u7528\u5bf9\u63a5\u4e2d\u96be\u4ee5\u8fdb\u884c\u591a\u7248\u672c\u63a7\u5236\u3002"),Object(r.b)("h3",{id:"522-net-core-webapi-\u7f3a\u70b9"},"5.2.2 ",Object(r.b)("inlineCode",{parentName:"h3"},".NET Core WebAPI")," \u7f3a\u70b9"),Object(r.b)("p",null,"\u901a\u8fc7\u4e0a\u4e00\u7ae0\u8282\u53ef\u4ee5\u770b\u51fa\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u5e94\u7528\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u9700\u8981\u9075\u5faa\u79cd\u79cd\u7ea6\u5b9a\uff0c\u800c\u4e14\u5bb9\u6613\u51fa\u9519\u3002"),Object(r.b)("p",null,"\u9664\u4e86\u8fd9\u4e9b\u7ea6\u5b9a\uff0c",Object(r.b)("inlineCode",{parentName:"p"},".NET Core WebAPI")," \u6709\u4ee5\u4e0b\u7f3a\u70b9\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u8def\u7531\u5730\u5740\u57fa\u672c\u9760\u624b\u5de5\u5b8c\u6210"),Object(r.b)("li",{parentName:"ul"},"\u5728\u73b0\u5728\u79fb\u52a8\u4e3a\u738b\u7684\u65f6\u4ee3\uff0c\u4e0d\u5229\u4e8e\u8fdb\u884c\u591a\u7248\u672c\u63a7\u5236"),Object(r.b)("li",{parentName:"ul"},"\u5bf9\u63a5 ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger")," \u6587\u6863\u5206\u7ec4\u6bd4\u8f83\u590d\u6742"),Object(r.b)("li",{parentName:"ul"},"\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"li"},"Policy")," \u7b56\u7565\u6388\u6743\u4e5f\u6bd4\u8f83\u590d\u6742"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u63a7\u5236\u5668\u70ed\u62d4\u63d2\u63d2\u4ef6\u5316"),Object(r.b)("li",{parentName:"ul"},"\u96be\u4ee5\u5b9e\u73b0\u590d\u6742\u81ea\u5b9a\u4e49\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"RESTful API")," \u98ce\u683c")),Object(r.b)("h2",{id:"53-\u52a8\u6001-webapi-\u63a7\u5236\u5668"},"5.3 \u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"h2"},"WebAPI")," \u63a7\u5236\u5668"),Object(r.b)("p",null,"\u9488\u5bf9\u4ee5\u4e0a ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u63d0\u4f9b\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u5fc5\u987b\u9075\u5faa\u7684\u7ea6\u5b9a\u548c\u4e0d\u53ef\u907f\u514d\u7684\u7f3a\u70b9\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u521b\u9020\u51fa\u4e00\u79cd\u66f4\u52a0\u7075\u6d3b\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a7\u5236\u5668\u7684\u65b9\u5f0f\u3002"),Object(r.b)("p",null,"\u8fd9\u4e2a\u65b9\u5f0f\u5728\u7ee7\u627f\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core WebAPI")," \u6240\u6709\u4f18\u70b9\uff0c\u540c\u65f6\u8fdb\u884c\u4e86\u5927\u91cf\u62d3\u5c55\u548c\u4f18\u5316\u3002\u4f18\u5316\u540e\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u5177\u6709\u4ee5\u4e0b\u4f18\u70b9\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u5177\u5907\u539f\u6709\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"ControllerBase")," \u6240\u6709\u529f\u80fd"),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301",Object(r.b)("strong",{parentName:"li"},"\u4efb\u610f\u516c\u5f00 \u975e\u9759\u6001 \u975e\u62bd\u8c61 \u975e\u6cdb\u578b\u7c7b"),"\u8f6c\u63a7\u5236\u5668"),Object(r.b)("li",{parentName:"ul"},"\u63d0\u4f9b\u66f4\u52a0\u7075\u6d3b\u65b9\u4fbf\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"IDynamicApiController")," \u7a7a\u63a5\u53e3\u6216 ",Object(r.b)("inlineCode",{parentName:"li"},"[DynamicApiController]")," \u7279\u6027\u66ff\u4ee3 ",Object(r.b)("inlineCode",{parentName:"li"},"ControllerBase")," \u62bd\u8c61\u7c7b"),Object(r.b)("li",{parentName:"ul"},"\u65e0\u9700\u624b\u52a8\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpMethod]")," \u7279\u6027\uff0c\u540c\u65f6\u652f\u6301\u4e00\u4e2a\u52a8\u4f5c\u65b9\u6cd5\u591a\u4e2a ",Object(r.b)("inlineCode",{parentName:"li"},"HttpVerb")),Object(r.b)("li",{parentName:"ul"},"\u65e0\u9700\u624b\u52a8\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"li"},"[Route]")," \u7279\u6027\uff0c\u652f\u6301\u66f4\u52a0\u7075\u6d3b\u7684\u914d\u7f6e\u53ca\u81ea\u52a8\u8def\u7531\u751f\u6210"),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301\u8fd4\u56de\u6cdb\u578b\u63a5\u53e3\uff0c\u6cdb\u578b\u7c7b"),Object(r.b)("li",{parentName:"ul"},"\u548c ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger")," \u6df1\u5ea6\u7ed3\u5408\uff0c\u63d0\u4f9b\u6781\u5176\u65b9\u4fbf\u7684\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger")," \u5206\u7ec4\u914d\u7f6e"),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"li"},"Basic Auth\uff0cJwt\uff0cApiKey")," \u7b49\u591a\u79cd\u6743\u9650\u7075\u6d3b\u914d\u7f6e"),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301\u63a7\u5236\u5668\u3001\u52a8\u4f5c\u65b9\u6cd5",Object(r.b)("strong",{parentName:"li"},"\u7248\u672c\u63a7\u5236"),"\u529f\u80fd"),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"li"},"GET\u3001HEAD")," \u8bf7\u6c42\u81ea\u52a8\u8f6c\u6362 ",Object(r.b)("inlineCode",{parentName:"li"},"\u7c7b\u7c7b\u578b\u53c2\u6570")),Object(r.b)("li",{parentName:"ul"},"\u652f\u6301\u751f\u6210 ",Object(r.b)("inlineCode",{parentName:"li"},"OAS3")," \u63a5\u53e3\u89c4\u8303")),Object(r.b)("h2",{id:"54-\u6ce8\u518c\u52a8\u6001-webapi-\u670d\u52a1"},"5.4 \u6ce8\u518c\u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"h2"},"WebAPI")," \u670d\u52a1"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddControllers()\n .AddDynamicApiControllers();\n }\n }\n}\n")),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},".AddDynamicApiControllers()")," \u5fc5\u987b\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"services.AddControllers()")," \u4e4b\u540e\u6ce8\u518c\u3002"))),Object(r.b)("h2",{id:"55-\u7b2c\u4e00\u4e2a\u4f8b\u5b50"},"5.5 \u7b2c\u4e00\u4e2a\u4f8b\u5b50"),Object(r.b)("p",null,"\u521b\u5efa\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"FurAppService")," \u7c7b\u7ee7\u627f ",Object(r.b)("inlineCode",{parentName:"p"},"IDynamicApiController")," \u63a5\u53e3 \u6216 \u8d34 ",Object(r.b)("inlineCode",{parentName:"p"},"[DynamicApiController]")," \u7279\u6027\uff0c\u5e76\u5728\u8fd9\u4e2a\u7c7b\u4e2d\u7f16\u5199\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"Get")," \u65b9\u6cd5\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("strong",{parentName:"li"},Object(r.b)("inlineCode",{parentName:"strong"},"IDynamicApiController")," \u65b9\u5f0f"))),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,7}","{1,5,7}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return $"Hello {nameof(Fur)}";\n }\n }\n}\n')),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("strong",{parentName:"li"},Object(r.b)("inlineCode",{parentName:"strong"},"[DynamicApiController]")," \u65b9\u5f0f"))),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,8}","{1,5,8}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [DynamicApiController]\n public class FurAppService\n {\n public string Get()\n {\n return $"Hello {nameof(Fur)}";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a5\u53e3\u5c31\u8fd9\u4e48\u751f\u6210\u4e86\u3002"),Object(r.b)("img",{src:Object(b.a)("img/dyglz.gif")}),Object(r.b)("h2",{id:"56-\u52a8\u6001-webapi-\u539f\u7406\u89e3\u6790"},"5.6 \u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"h2"},"WebAPI")," \u539f\u7406\u89e3\u6790"),Object(r.b)("h3",{id:"561-\u63a7\u5236\u5668\u7279\u6027\u63d0\u4f9b\u5668"},"5.6.1 \u63a7\u5236\u5668\u7279\u6027\u63d0\u4f9b\u5668"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4f1a\u5728\u5e94\u7528\u542f\u52a8\u65f6\u6ce8\u518c ",Object(r.b)("inlineCode",{parentName:"p"},"DynamicApiControllerFeatureProvider")," \u63a7\u5236\u5668\u7279\u6027\u63d0\u4f9b\u5668\uff0c\u8be5\u63d0\u4f9b\u5668\u7ee7\u627f\u81ea ",Object(r.b)("inlineCode",{parentName:"p"},"ControllerFeatureProvider")," \u7c7b\u3002"),Object(r.b)("p",null,"\u63a5\u7740\u91cd\u5199 ",Object(r.b)("inlineCode",{parentName:"p"},"bool IsController(TypeInfo typeInfo)")," \u65b9\u6cd5\uff0c\u7528\u6765\u6807\u8bc6\u63a7\u5236\u5668\u7c7b\u578b\u3002\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c",Object(r.b)("strong",{parentName:"p"},"\u7ee7\u627f\u81ea ",Object(r.b)("inlineCode",{parentName:"strong"},"ControllerBase")," \u7c7b\u6216 ",Object(r.b)("inlineCode",{parentName:"strong"},"IDynamicApiController")," \u63a5\u53e3\u6216 ",Object(r.b)("inlineCode",{parentName:"strong"},"[DynamicApiController]")," \u7279\u6027\u90fd\u4f1a\u88ab\u6807\u8bb0\u4e3a\u63a7\u5236\u5668\u7c7b\u578b\u3002")),Object(r.b)("h3",{id:"562-\u5e94\u7528\u6a21\u578b\u8f6c\u6362\u5668"},"5.6.2 \u5e94\u7528\u6a21\u578b\u8f6c\u6362\u5668"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u540c\u65f6\u5728\u5e94\u7528\u542f\u52a8\u65f6\u6ce8\u518c ",Object(r.b)("inlineCode",{parentName:"p"},"DynamicApiControllerApplicationModelConvention")," \u5e94\u7528\u6a21\u578b\u8f6c\u6362\u5668\uff0c\u8be5\u8f6c\u6362\u5668\u7ee7\u627f\u81ea ",Object(r.b)("inlineCode",{parentName:"p"},"IApplicationModelConvention")," \u63a5\u53e3\u3002"),Object(r.b)("p",null,"\u63a5\u7740\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"void Apply(ApplicationModel application)")," \u63a5\u53e3\u65b9\u6cd5\u3002\u5728\u8be5\u65b9\u6cd5\u4e2d\u914d\u7f6e\u63a7\u5236\u5668\u540d\u79f0\u3001\u8def\u7531\u3001\u5bfc\u51fa\u53ef\u89c1\u6027\u53ca\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u3001\u8def\u7531\u3001\u5bfc\u51fa\u53ef\u89c1\u6027\u7b49\u3002"),Object(r.b)("p",null,"\u5b9e\u9645\u4e0a\u8be5\u65b9\u6cd5\u505a\u7684\u5c31\u662f\u6309\u7167 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("a",Object(a.a)({parentName:"strong"},{href:"#521-webapi-%E7%BA%A6%E5%AE%9A"}),"WebAPI \u7ea6\u5b9a"))," \u63d0\u524d\u5e2e\u6211\u4eec\u914d\u7f6e\u597d\u8def\u7531\u3001\u8bf7\u6c42\u8c13\u8bcd\u7b49\u4fe1\u606f\u3002\u907f\u514d\u4e86\u624b\u52a8\u914d\u7f6e\u7684\u540c\u65f6\u8fd8\u589e\u52a0\u4e86\u8bb8\u591a\u65b0\u7279\u6027\uff0c\u5982",Object(r.b)("strong",{parentName:"p"},"\u7248\u672c\u63a7\u5236\u3002")),Object(r.b)("h2",{id:"57-\u52a8\u6001-webapi-\u914d\u7f6e\u7ea6\u5b9a"},"5.7 \u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"h2"},"WebAPI")," \u914d\u7f6e\u7ea6\u5b9a"),Object(r.b)("h3",{id:"571-\u63a7\u5236\u5668\u9ed8\u8ba4\u7ea6\u5b9a"},"5.7.1 \u63a7\u5236\u5668\u9ed8\u8ba4\u7ea6\u5b9a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u751f\u6210\u63a7\u5236\u5668\u540d\u79f0\u9ed8\u8ba4\u53bb\u9664\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"AppServices\uff0cAppService\uff0cApiController\uff0cController\uff0cServices\uff0cService")," \u4f5c\u4e3a\u524d\u540e\u7f00\u7684\u5b57\u7b26\u4e32\u3002\u89c1\u7b2c\u4e00\u4e2a\u4f8b\u5b50\u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"FurAppService -> Fur")," ",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u63a7\u5236\u5668\u540d\u79f0\u5e26 ",Object(r.b)("inlineCode",{parentName:"li"},"V[0-9_]")," \u7ed3\u5c3e\u7684\uff0c\u4f1a\u81ea\u52a8\u751f\u6210\u63a7\u5236\u5668\u7248\u672c\u53f7\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"li"},"FurAppServiceV2 -> Fur@2"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"FurAppServiceV1_1_0 -> Fur@1.1.0"),"\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u7248\u672c\u5206\u9694\u7b26\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u63a7\u5236\u540d\u79f0\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"\u9a86\u9a7c\u547d\u540d\uff08CamelCase\uff09")," \u4f1a\u81ea\u52a8\u5207\u5272\u6210\u591a\u4e2a\u5355\u8bcd ",Object(r.b)("inlineCode",{parentName:"li"},"-")," \u8fde\u63a5\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"))),Object(r.b)("h3",{id:"572-\u52a8\u4f5c\u65b9\u6cd5\u9ed8\u8ba4\u7ea6\u5b9a"},"5.7.2 \u52a8\u4f5c\u65b9\u6cd5\u9ed8\u8ba4\u7ea6\u5b9a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u751f\u6210\u7684\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u9ed8\u8ba4\u53bb\u9664\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Post/Add/Create/Insert/Submit\uff0cGetAll/GetList/Get/Find/Fetch/Query/Search\uff0cPut/Update\uff0cDelete/Remove/Clear\uff0cPatch")," \u5f00\u5934\u7684\u5b57\u7b26\u4e32\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u751f\u6210\u7684\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u9ed8\u8ba4\u53bb\u9664\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Async")," \u4f5c\u4e3a\u524d\u540e\u7f00\u7684\u5b57\u7b26\u4e32\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u5e26 ",Object(r.b)("inlineCode",{parentName:"li"},"V[0-9_]")," \u7ed3\u5c3e\u7684\uff0c\u4f1a\u81ea\u52a8\u751f\u6210\u52a8\u4f5c\u65b9\u6cd5\u7248\u672c\u53f7\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"li"},"ChangePasswordV2 -> ChangePassword@2"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"ChangePasswordV1_1_0 -> ChangePassword@1.1.0"),"\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u7248\u672c\u5206\u9694\u7b26\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"\u9a86\u9a7c\u547d\u540d\uff08CamelCase\uff09")," \u4f1a\u81ea\u52a8\u5207\u5272\u6210\u591a\u4e2a\u5355\u8bcd ",Object(r.b)("inlineCode",{parentName:"li"},"-")," \u8fde\u63a5\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u52a8\u4f5c\u65b9\u6cd5\u53c2\u6570\u5c06\u81ea\u52a8\u8f6c\u4e3a\u5c0f\u5199\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"))),Object(r.b)("h3",{id:"573-\u8bf7\u6c42\u8c13\u8bcd\u9ed8\u8ba4\u7ea6\u5b9a"},"5.7.3 \u8bf7\u6c42\u8c13\u8bcd\u9ed8\u8ba4\u7ea6\u5b9a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u52a8\u4f5c\u65b9\u6cd5\u540d",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Post/Add/Create/Insert/Submit")," \u5f00\u5934\uff0c\u5219\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpPost]")," \u7279\u6027\u3002"),Object(r.b)("li",{parentName:"ul"},"\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"GetAll/GetList/Get/Find/Fetch/Query")," \u5f00\u5934\uff0c\u5219\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpGet]")," \u7279\u6027\u3002"),Object(r.b)("li",{parentName:"ul"},"\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Put/Update")," \u5f00\u5934\uff0c\u5219\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpPut]")," \u7279\u6027\u3002"),Object(r.b)("li",{parentName:"ul"},"\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Delete/Remove/Clear")," \u5f00\u5934\uff0c\u5219\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpDelete]")," \u7279\u6027\u3002"),Object(r.b)("li",{parentName:"ul"},"\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"Patch")," \u5f00\u5934\uff0c\u5219\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpPatch]")," \u7279\u6027"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")))),Object(r.b)("li",{parentName:"ul"},"\u5982\u679c\u4e0d\u5728\u4e0a\u9762\u7ea6\u5b9a\u4e2d\uff0c\u5219\u9ed8\u8ba4\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"li"},"[HttpPost]")," \u7279\u6027\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"))),Object(r.b)("h3",{id:"574-\u8def\u7531\u5730\u5740\u9ed8\u8ba4\u7ea6\u5b9a"},"5.7.4 \u8def\u7531\u5730\u5740\u9ed8\u8ba4\u7ea6\u5b9a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u9ed8\u8ba4\u4ee5 ",Object(r.b)("inlineCode",{parentName:"li"},"api")," \u5f00\u5934\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u9ed8\u8ba4\u8f6c\u6362\u4e3a\u5c0f\u5199\u8def\u7531\u5730\u5740\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u751f\u6210\u63a7\u5236\u5668\u8def\u7531\u6a21\u677f\u683c\u5f0f\u4e3a\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"api/\u524d\u7f6e\u53c2\u6570\u5217\u8868/\u6a21\u5757\u540d\u6216\u9ed8\u8ba4\u533a\u57df\u540d/[controller@\u7248\u672c\u53f7]/\u540e\u7f6e\u53c2\u6570\u5217\u8868")),Object(r.b)("li",{parentName:"ul"},"\u751f\u6210\u52a8\u4f5c\u65b9\u6cd5\u8def\u7531\u6a21\u677f\u683c\u5f0f\u4e3a\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"\u524d\u7f6e\u53c2\u6570\u5217\u8868/\u6a21\u5757\u540d/[action@\u7248\u672c\u53f7]/\u540e\u7f6e\u53c2\u6570\u5217\u8868"))),Object(r.b)("h3",{id:"575-\u5176\u4ed6\u7ea6\u5b9a"},"5.7.5 \u5176\u4ed6\u7ea6\u5b9a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u9ed8\u8ba4\u4e0d\u5904\u7406 ",Object(r.b)("inlineCode",{parentName:"li"},"ControllerBase")," \u63a7\u5236\u5668\u7c7b\u578b\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},"\u9ed8\u8ba4\u4e0d\u5904\u7406 ",Object(r.b)("inlineCode",{parentName:"li"},"GET\uff0cHEAD")," \u8bf7\u6c42\u7684\u5f15\u7528\u7c7b\u578b\u53c2\u6570\u3002",Object(r.b)("strong",{parentName:"li"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"))),Object(r.b)("h2",{id:"58-\u66f4\u591a\u4f8b\u5b50"},"5.8 \u66f4\u591a\u4f8b\u5b50"),Object(r.b)("h3",{id:"581-\u591a\u79cd\u8bf7\u6c42\u8c13\u8bcd\u65b9\u6cd5"},"5.8.1 \u591a\u79cd\u8bf7\u6c42\u8c13\u8bcd\u65b9\u6cd5"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12,17,22,27}","{7,12,17,22,27}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return $"GET \u8bf7\u6c42";\n }\n\n public string Post()\n {\n return $"POST \u8bf7\u6c42";\n }\n\n public string Delete()\n {\n return $"DELETE \u8bf7\u6c42";\n }\n\n public string Put()\n {\n return $"PUT \u8bf7\u6c42";\n }\n\n public string Patch()\n {\n return $"PATCH \u8bf7\u6c42";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dgqqwc.png")}),Object(r.b)("h3",{id:"582-\u591a\u4e2a\u81ea\u5b9a\u4e49\u52a8\u4f5c\u65b9\u6cd5"},"5.8.2 \u591a\u4e2a\u81ea\u5b9a\u4e49\u52a8\u4f5c\u65b9\u6cd5"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12,17}","{7,12,17}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string GetVersion()\n {\n return $"v1.0.0";\n }\n\n public string ChangeProfile()\n {\n return "\u4fee\u6539\u6210\u529f";\n }\n\n public string DeleteUser()\n {\n return "\u5220\u9664\u6210\u529f";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dzmc.png")}),Object(r.b)("h3",{id:"583-\u5e26\u53c2\u6570\u52a8\u4f5c\u65b9\u6cd5"},"5.8.3 \u5e26\u53c2\u6570\u52a8\u4f5c\u65b9\u6cd5"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12,17}","{7,12,17}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string GetUser(int id)\n {\n return $"{id}";\n }\n\n public string GetUser(int id, string name)\n {\n return $"{id} {name}";\n }\n\n public TestDto Add(TestDto testDto)\n {\n return testDto;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dcsff.gif")}),Object(r.b)("h3",{id:"585-gethead-\u7c7b\u7c7b\u578b\u53c2\u6570"},"5.8.5 ",Object(r.b)("inlineCode",{parentName:"h3"},"GET/HEAD")," \u7c7b\u7c7b\u578b\u53c2\u6570"),Object(r.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4f1a\u5c06 ",Object(r.b)("inlineCode",{parentName:"p"},"GET/HEAD")," \u8bf7\u6c42\u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"\u7c7b\u7c7b\u578b\u53c2\u6570")," \u8bbe\u7f6e\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"[FromBody]")," \u7ed1\u5b9a\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7}","{7}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public TestDto GetTest(TestDto testDto)\n {\n return testDto;\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/getyycs.png")}),Object(r.b)("p",null,"\u4f46\u662f\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"GET\u3001HEAD")," \u8bf7\u6c42\u4e0d\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},"From Body")," \u7ed1\u5b9a\u3002\u6240\u4ee5\u6211\u4eec\u9700\u8981\u8f6c\u6362\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"Query")," \u67e5\u8be2\u53c2\u6570\u3002"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u652f\u6301\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u914d\u7f6e\uff1a"),Object(r.b)(c.a,{defaultValue:"fromquery",values:[{label:"[FromQuery] \u7279\u6027",value:"fromquery"},{label:"\u914d\u7f6e DynamicApiControllerSettings",value:"DynamicApiControllerSettings"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"fromquery",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8}","{2,8}":!0}),"using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public TestDto GetTest([FromQuery] TestDto testDto)\n {\n return testDto;\n }\n }\n}\n"))),Object(r.b)(l.a,{value:"DynamicApiControllerSettings",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-4} title="Fur.Web.Entry/appsettings.json"',"{2-4}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "DynamicApiControllerSettings": {\n "ModelToQuery": true\n }\n }\n}\n')))),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/modeltoquery.png")}),Object(r.b)("h3",{id:"586-\u81ea\u5b9a\u4e49\u53c2\u6570\u4f4d\u7f6e"},"5.8.6 \u81ea\u5b9a\u4e49\u53c2\u6570\u4f4d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u65b9\u4fbf\u7684\u81ea\u5b9a\u4e49\u53c2\u6570\u4f4d\u7f6e\u7684\u7279\u6027 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiSeat]"),"\uff0c\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiSeat]")," \u53ef\u914d\u7f6e\u53c2\u6570\u4f4d\u7f6e\uff0c\u652f\u6301\u4ee5\u4e0b\u56db\u79cd\u4f4d\u7f6e\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ApiSeats.ControllerStart"),"\uff1a\u63a7\u5236\u5668\u4e4b\u524d"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ApiSeats.ControllerEnd"),"\uff1a\u63a7\u5236\u5668\u4e4b\u540e"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ApiSeats.ActionStart"),"\uff1a\u52a8\u4f5c\u65b9\u6cd5\u4e4b\u524d"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ApiSeats.ActionEnd"),"\uff1a\u52a8\u4f5c\u65b9\u6cd5\u4e4b\u540e\u3002",Object(r.b)("strong",{parentName:"li"},"\u9ed8\u8ba4\u503c"))),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{8-9,15-20}","{8-9,15-20}":!0}),'using Fur.DynamicApiController;\nusing System;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n // \u53c2\u6570\u9ed8\u8ba4\u4e3a ApiSeats.ActionEnd\n public string RouteSeat(int id, string name)\n {\n return "\u914d\u7f6e\u8def\u7531\u53c2\u6570\u4f4d\u7f6e";\n }\n\n public string RouteSeat(\n [ApiSeat(ApiSeats.ControllerStart)] int id, // \u63a7\u5236\u5668\u540d\u79f0\u4e4b\u524d\n [ApiSeat(ApiSeats.ControllerEnd)] string name, // \u63a7\u5236\u5668\u540d\u79f0\u4e4b\u540e\n [ApiSeat(ApiSeats.ControllerEnd)] int age, // \u63a7\u5236\u5668\u540d\u79f0\u4e4b\u540e\n [ApiSeat(ApiSeats.ActionStart)] decimal weight, // \u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u4e4b\u524d\n [ApiSeat(ApiSeats.ActionStart)] float height, // \u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u4e4b\u524d\n [ApiSeat(ApiSeats.ActionEnd)] DateTime birthday) // \u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u4e4b\u540e\uff08\u9ed8\u8ba4\u503c\uff09\n {\n return "\u914d\u7f6e\u8def\u7531\u53c2\u6570\u4f4d\u7f6e";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/cswz.png")}),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u6e29\u99a8\u63d0\u793a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u591a\u4e2a ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"\u540c\u4f4d\u7f6e"))," \u914d\u7f6e\u7684\u53c2\u6570\u5c06\u6309\u7167 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"\u5b9a\u4e49\u53c2\u6570\u987a\u5e8f"))," \u8fdb\u884c\u6392\u5e8f\u3002"))),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"[ApiSeat]")," \u53ea\u80fd\u5e94\u7528\u4e8e\u8d34\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"[FromRoute]")," \u7279\u6027\u7684\u53c2\u6570\u6216 ",Object(r.b)("inlineCode",{parentName:"p"},"\u57fa\u5143\u7c7b\u578b\u3001\u503c\u7c7b\u578b\u3001\u53ef\u7a7a\u57fa\u5143\u7c7b\u578b\u548c\u53ef\u7a7a\u503c\u7c7b\u578b"),"\u3002"))),Object(r.b)("h3",{id:"587-\u81ea\u5b9a\u4e49\u8bf7\u6c42\u8c13\u8bcd"},"5.8.7 \u81ea\u5b9a\u4e49\u8bf7\u6c42\u8c13\u8bcd"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8}","{2,8}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [HttpPost]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/zdywc.png")}),Object(r.b)("h3",{id:"588-\u652f\u6301\u591a\u4e2a\u8c13\u8bcd"},"5.8.8 \u652f\u6301\u591a\u4e2a\u8c13\u8bcd"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8}","{2,8}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [HttpPost, HttpGet, AcceptVerbs("PUT", "DELETE")]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dgwc.png")}),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c\u52a8\u4f5c\u65b9\u6cd5\u4e2d\u542b\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"\u7c7b\u7c7b\u578b\u53c2\u6570"),"\uff0c\u4e14\u542b\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"POST/PUT/DELETE")," \u4efb\u610f\u8bf7\u6c42\u8c13\u8bcd\uff0c\u90a3\u4e48\u8be5\u53c2\u6570\u4f1a\u81ea\u52a8\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"p"},"[FromBody]")," \u53c2\u6570\uff0c\u5373\u4f7f\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"GET/HEAD")," \u8bf7\u6c42\u4e2d\u4e0d\u652f\u6301\u3002"))),Object(r.b)("h3",{id:"589-\u652f\u6301\u81ea\u5b9a\u4e49\u8def\u7531"},"5.8.9 \u652f\u6301\u81ea\u5b9a\u4e49\u8def\u7531"),Object(r.b)("p",null,"\u652f\u6301\u63a7\u5236\u5668\u548c\u52a8\u4f5c\u65b9\u6cd5\u81ea\u5b9a\u4e49\u8def\u7531\uff1a"),Object(r.b)(c.a,{defaultValue:"kzqrl",values:[{label:"\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u8def\u7531",value:"kzqrl"},{label:"\u81ea\u5b9a\u4e49\u52a8\u4f5c\u65b9\u6cd5\u8def\u7531",value:"dzffrl"},{label:"\u540c\u65f6\u81ea\u5b9a\u4e49\u8def\u7531",value:"allrl"},{label:"\u8c13\u8bcd\u81ea\u5b9a\u4e49\u8def\u7531",value:"vcrl"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"kzqrl",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,6}","{2,6}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n [Route("customapi/mobile/[controller]")]\n public class FurAppService : IDynamicApiController\n {\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/kzqrl.png")})),Object(r.b)(l.a,{value:"dzffrl",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8}","{2,8}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [Route("customapi/[action]")]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dzffrl.png")})),Object(r.b)(l.a,{value:"allrl",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,6,9}","{2,6,9}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n [Route("customapi/mobile/[controller]")]\n public class FurAppService : IDynamicApiController\n {\n [Route("get/[action]")]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/allrl.png")})),Object(r.b)(l.a,{value:"vcrl",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{9}","{9}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n [Route("api/[controller]")]\n public class FurAppService : IDynamicApiController\n {\n [HttpGet("get/[action]")]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/wcrl.png")}))),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u5c0f\u63d0\u793a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u52a8\u6001\u65b9\u6cd5\u81ea\u5b9a\u4e49\u8def\u7531\u5982\u679c\u4ee5 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"/"))," \u5f00\u5934\uff0c\u5219\u4e0d\u4f1a\u5408\u5e76\u63a7\u5236\u5668\u8def\u7531\u3002"))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u63a8\u8350\u914d\u7f6e")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u81ea\u5b9a\u4e49\u8def\u7531\u5982\u679c\u9700\u8981\u7528\u5230 ",Object(r.b)("strong",{parentName:"p"},"\u63a7\u5236\u5668/\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0"),"\uff0c\u63a8\u8350\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"[controller]")," \u6216 ",Object(r.b)("inlineCode",{parentName:"p"},"[action]")," \u5360\u4f4d\u7b26\uff0c\u56e0\u4e3a\u8be5\u5360\u4f4d\u7b26\u5df2\u7ecf\u81ea\u52a8\u5904\u7406\u4e86 ",Object(r.b)("strong",{parentName:"p"},"\u524d\u540e\u7f00\u3001\u7248\u672c\u53f7\u3001\u6a21\u5757\u540d\u79f0"),"\u7b49\u3002"))),Object(r.b)("h3",{id:"5810-\u591a\u8def\u7531\u968f\u610f\u7ec4\u5408"},"5.8.10 \u591a\u8def\u7531\u968f\u610f\u7ec4\u5408"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u5404\u79cd\u8def\u7531\u7ec4\u5408\u65b9\u5f0f\uff0c\u652f\u6301\u4e00\u5bf9\u591a\uff0c\u591a\u5bf9\u591a\u8def\u7531\u7ec4\u5408\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6-8,11-14}","{6-8,11-14}":!0}),'using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n [Route("api/[controller]")]\n [Route("api/[controller]/second")]\n [Route("api/[controller]/three")]\n public class FurAppService : IDynamicApiController\n {\n [HttpGet]\n [HttpGet("get/[action]")]\n [HttpPost]\n [HttpPost("post/cus-version")]\n public string GetVersion()\n {\n return "1.0.0";\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dlrzh.gif")}),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u52a8\u4f5c\u65b9\u6cd5\u4e0d\u80fd\u540c\u65f6\u8d34 ",Object(r.b)("inlineCode",{parentName:"p"},"[Route]")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"[HttpMethod]")," \u7279\u6027\uff0c\u53ea\u80fd\u4e8c\u53d6\u4e00\u3002"))),Object(r.b)("h3",{id:"5811-\u652f\u6301\u7248\u672c\u63a7\u5236"},"5.8.11 \u652f\u6301\u7248\u672c\u63a7\u5236"),Object(r.b)(c.a,{defaultValue:"kzqbb",values:[{label:"\u63a7\u5236\u5668\u7248\u672c",value:"kzqbb"},{label:"\u52a8\u4f5c\u65b9\u6cd5\u7248\u672c",value:"dzffbb"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"kzqbb",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,13,21}","{5,13,21}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppServiceV1 : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n }\n\n public class FurAppServiceV1_2 : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n }\n\n public class FurAppServiceV1_2_1 : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/kzqbb.png")})),Object(r.b)(l.a,{value:"dzffbb",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12,16}","{7,12,16}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public string GetV1()\n {\n return nameof(Fur);\n }\n public string GetV2_1()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dzffbb.png")}))),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7248\u672c\u751f\u6210\u539f\u7406")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"V[0-9_]"))," \u7ed3\u5c3e\u7684\u547d\u540d\u81ea\u52a8\u89e3\u6790\u6210\u7248\u672c\u53f7\uff0c\u5982 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"FurAppServiceV2 -> Fur@2")),"\u3002"))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u7248\u672c\u590d\u5199")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u9664\u4e86\u901a\u8fc7\u7279\u5b9a\u540e\u7f00\u65b9\u5f0f\u4ee5\u5916\uff0c\u7248\u672c\u8fd8\u76f4\u63a5\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDescriptionSettings]")," \u8fdb\u884c\u590d\u5199\u3002\u5982\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,2}","{1,2}":!0}),'[ApiDescriptionSettings(Version = "4.0")]\npublic string GetV1()\n{\n return nameof(Fur);\n}\n')),Object(r.b)("p",{parentName:"div"},"\u8fd9\u65f6\uff0c\u751f\u6210\u7248\u672c\u5c06\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"4.0")," \u66ff\u4ee3 ",Object(r.b)("inlineCode",{parentName:"p"},"1")))),Object(r.b)("h3",{id:"5812-\u4e0d\u516c\u5f00\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5"},"5.8.12 \u4e0d\u516c\u5f00\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5"),Object(r.b)("p",null,"\u6709\u4e9b\u65f6\u5019\uff0c\u6211\u4eec\u65e0\u9700\u5bfc\u51fa\u67d0\u4e2a\u52a8\u4f5c\u65b9\u6cd5\u6216\u63a7\u5236\u5668\uff0c\u53ea\u9700\u8981\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDescriptionSettings(false)]")," \u6216 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiExplorerSettings(IgnoreApi = true)]"),"\u5373\u53ef\u3002"),Object(r.b)("p",null,"\u53e6\u5916\u52a8\u4f5c\u65b9\u6cd5\u8fd8\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},"[NonAction]")," \u6807\u8bb0\u3002"),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u63a8\u8350\u4f7f\u7528")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u63a8\u8350\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5\u8bbe\u7f6e\u4e0d\u5bfc\u51fa\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDescriptionSettings(false)]")," \u7279\u6027\u3002\u8be5\u7279\u6027\u9ed8\u8ba4\u7ee7\u627f\u81ea ",Object(r.b)("inlineCode",{parentName:"p"},"ApiExplorerSettingsAttribute")," \u7c7b\u3002"))),Object(r.b)("h2",{id:"59-apidescriptionsettings"},"5.9 ",Object(r.b)("inlineCode",{parentName:"h2"},"[ApiDescriptionSettings]")),Object(r.b)("p",null,"\u9664\u4e86\u4e0a\u8ff0 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u63d0\u4f9b\u7684\u914d\u7f6e\u5916\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u8fd8\u63d0\u4f9b\u4e86\u975e\u5e38\u5f3a\u5927\u4e14\u7075\u6d3b\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDescriptionSettings]")," \u7279\u6027\u3002"),Object(r.b)("h3",{id:"591-\u5185\u7f6e\u914d\u7f6e"},"5.9.1 \u5185\u7f6e\u914d\u7f6e"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Name"),"\uff1a\u81ea\u5b9a\u4e49\u63a7\u5236\u5668/\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"KeepName"),"\uff1a\u662f\u5426\u4fdd\u6301\u539f\u6709\u540d\u79f0\u4e0d\u5904\u7406\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"SplitCamelCase"),"\uff1a\u5207\u5272\u9a86\u9a7c\u547d\u540d\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"true")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"KeepVerb"),"\uff1a\u662f\u5426\u4fdd\u7559\u52a8\u4f5c\u65b9\u6cd5\u8bf7\u6c42\u8c13\u8bcd\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Enabled"),"\uff1a\u662f\u5426\u5bfc\u51fa\u63a5\u53e3\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"true")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Module"),"\uff1a\u6a21\u5757\u540d\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Version"),"\uff1a\u7248\u672c\u53f7\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Groups"),"\uff1a\u63a5\u53e3\u5206\u7ec4\uff0c\u53ef\u7ed3\u5408 ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger")," \u4e00\u8d77\u4f7f\u7528\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string[]"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Tags"),"\uff1a\u63a5\u53e3\u6807\u7b7e\uff0c\u53ef\u7ed3\u5408 ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger")," \u4e00\u8d77\u4f7f\u7528\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string[]"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"AuthPolicies"),"\uff1a\u6388\u6743\u7b56\u7565\uff0c\u53ef\u7ed3\u5408 ",Object(r.b)("inlineCode",{parentName:"li"},"\u6388\u6743\uff0cJWT")," \u4e00\u8d77\u4f7f\u7528\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string[]"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"null"))),Object(r.b)("h3",{id:"592-name-\u914d\u7f6e"},"5.9.2 ",Object(r.b)("inlineCode",{parentName:"h3"},"Name")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Name")," \u53c2\u6570\u53ef\u4ee5\u8986\u76d6\u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u81ea\u52a8\u751f\u6210\u7684\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,8}","{5,8}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Name = "MyFur")]\n public class FurAppService : IDynamicApiController\n {\n [ApiDescriptionSettings(Name = "MyGet")]\n public string Get()\n {\n return nameof(Fur);\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/namepz.png")}),Object(r.b)("h3",{id:"593-keepname-\u914d\u7f6e"},"5.9.3 ",Object(r.b)("inlineCode",{parentName:"h3"},"KeepName")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"KeepName")," \u53c2\u6570\u53ef\u4ee5\u4fdd\u7559\u539f\u6709\u7684\u63a7\u5236\u5668\u6216\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,8}","{5,8}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(KeepName = true)]\n public class FurAppService : IDynamicApiController\n {\n [ApiDescriptionSettings(KeepName = true)]\n public string Get()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/keepnamepz.png")}),Object(r.b)("h3",{id:"594-splitcamelcase-\u914d\u7f6e"},"5.9.4 ",Object(r.b)("inlineCode",{parentName:"h3"},"SplitCamelCase")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"SplitCamelCase")," \u53c2\u6570\u9ed8\u8ba4\u5c06\u9a86\u9a7c\u547d\u540d\u5207\u5272\u6210\u591a\u4e2a\u5355\u8bcd\u5e76\u901a\u8fc7\u6307\u5b9a ",Object(r.b)("inlineCode",{parentName:"p"},"\u5360\u4f4d\u7b26")," \u8fde\u63a5\u8d77\u6765\u3002\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"p"},"\u5360\u4f4d\u7b26")," \u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"-"),"\u3002\u9ed8\u8ba4\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"true"),"\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,8}","{5,8}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(SplitCamelCase = false)]\n public class MyFurAppService : IDynamicApiController\n {\n [ApiDescriptionSettings(SplitCamelCase = true)]\n public string ChangeUserName()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/splitnamepz.png")}),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"KeepName")," \u4f18\u5148\u7ea7\u9ad8\u4e8e ",Object(r.b)("inlineCode",{parentName:"p"},"SplitCamelCase"),"\uff0c\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"KeepName")," \u8bbe\u7f6e\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"true"),"\uff0c\u5219\u4e0d\u4f1a\u5904\u7406 ",Object(r.b)("inlineCode",{parentName:"p"},"SplitCamelCase")," \u53c2\u6570\u3002"))),Object(r.b)("h3",{id:"595-keepverb-\u914d\u7f6e"},"5.9.5 ",Object(r.b)("inlineCode",{parentName:"h3"},"KeepVerb")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"KeepVerb")," \u53c2\u6570\u4f5c\u7528\u4e8e\u52a8\u4f5c\u65b9\u6cd5\uff0c\u6807\u8bc6\u662f\u5426\u4fdd\u7559\u52a8\u4f5c\u8c13\u8bcd\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7}","{7}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [ApiDescriptionSettings(KeepVerb = true)]\n public string GetVersion()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/keepverbpz.png")}),Object(r.b)("h3",{id:"596-enabled-\u914d\u7f6e"},"5.9.6 ",Object(r.b)("inlineCode",{parentName:"h3"},"Enabled")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Enabled")," \u53c2\u6570\u914d\u7f6e\u63a5\u53e3\u662f\u5426\u5bfc\u51fa\u3002\u901a\u5e38\u7528\u4e8e\u52a8\u4f5c\u65b9\u6cd5\uff0c\u5982\u679c\u7528\u4e8e\u63a7\u5236\u5668\u5b9e\u9645\u4f5c\u7528\u4e0d\u5927\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{12}","{12}":!0}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string GetVersion()\n {\n return nameof(Fur);\n }\n\n [ApiDescriptionSettings(false)]\n public string NoExport()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/enablepz.png")}),Object(r.b)("h3",{id:"597-module-\u914d\u7f6e"},"5.9.7 ",Object(r.b)("inlineCode",{parentName:"h3"},"Module")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Module")," \u53c2\u6570\u53ef\u4ee5\u914d\u7f6e\u8def\u7531\u5206\u79bb\uff0c\u7c7b\u4f3c\u4e8e ",Object(r.b)("inlineCode",{parentName:"p"},"Mvc \u533a\u57df")," \u7684\u4f5c\u7528\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,8}","{5,8}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Module = "mobile")]\n public class FurAppService : IDynamicApiController\n {\n [ApiDescriptionSettings(Module = "user")]\n public string GetVersion()\n {\n return nameof(Fur);\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/modulepz.png")}),Object(r.b)("h3",{id:"598-version-\u914d\u7f6e"},"5.9.8 ",Object(r.b)("inlineCode",{parentName:"h3"},"Version")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Version")," \u53c2\u6570\u53ef\u4ee5\u914d\u7f6e\u63a5\u53e3\u7248\u672c\uff0c\u540c\u65f6\u53c8\u53ef\u4ee5\u590d\u5199\u7279\u6b8a\u7248\u672c\u547d\u540d\u914d\u7f6e\u3002\u9ed8\u8ba4\u7248\u672c\u53f7\u5206\u9694\u7b26\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"@"),"\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,9-10}","{5,9-10}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Version = "1.0")]\n public class FurAppService : IDynamicApiController\n {\n // V2.0.0 \u88ab\u590d\u5199\u6210 V2.1.1\n [ApiDescriptionSettings(Version = "2.1.1")]\n public string GetVersionV2_0_0()\n {\n return nameof(Fur);\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/versionpz.png")}),Object(r.b)("h3",{id:"599-groups-\u914d\u7f6e"},"5.9.9 ",Object(r.b)("inlineCode",{parentName:"h3"},"Groups")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Groups")," \u914d\u7f6e\u4e3b\u8981\u7528\u4e8e\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u5206\u7ec4\u4fe1\u606f\u3002"),Object(r.b)("p",null,"\u901a\u8fc7\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"Groups")," \u53c2\u6570\u53ef\u4ee5\u5c06",Object(r.b)("inlineCode",{parentName:"p"},"\u63a7\u5236\u5668\u548c\u52a8\u4f5c\u65b9\u6cd5")," \u8fdb\u884c\u5f52\u7c7b\u548c\u591a\u4e2a\u5206\u7ec4\u76f4\u63a5\u5171\u4eab\u3002\u53ef\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDescriptionSettings(params Groups)]")," \u6784\u9020\u51fd\u6570\u4f20\u5165\u6216\u6307\u5b9a ",Object(r.b)("inlineCode",{parentName:"p"},"Groups")," \u53c2\u6570\u914d\u7f6e\u63a5\u53e3\u662f\u5426\u5bfc\u51fa\u3002\u901a\u5e38\u7528\u4e8e\u52a8\u4f5c\u65b9\u6cd5\uff0c\u5982\u679c\u7528\u4e8e\u63a7\u5236\u5668\u5b9e\u9645\u4f5c\u7528\u4e0d\u5927\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,13}","{5,13}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings("Default", "Common")]\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n [ApiDescriptionSettings("Custom")]\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/dfz.gif")}),Object(r.b)("h3",{id:"5910-tag-\u914d\u7f6e"},"5.9.10 ",Object(r.b)("inlineCode",{parentName:"h3"},"Tag")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Tag")," \u914d\u7f6e\u4e3b\u8981\u7528\u4e8e\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u6807\u7b7e\u5206\u7ec4\u4fe1\u606f\u53ca\u5408\u5e76\u6807\u7b7e\u3002\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"\u7ec4\u4e2d\u7ec4"),":"),Object(r.b)(c.a,{defaultValue:"tag1",values:[{label:"\u6807\u7b7e\u547d\u540d",value:"tag1"},{label:"\u5408\u5e76\u6807\u7b7e",value:"tag2"}],mdxType:"Tabs"},Object(r.b)(l.a,{value:"tag1",mdxType:"TabItem"},Object(r.b)("h4",{id:"\u672a\u8d34\u6807\u7b7e\u4e4b\u524d"},"\u672a\u8d34\u6807\u7b7e\u4e4b\u524d"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n")),Object(r.b)("h4",{id:"\u8d34\u6807\u7b7e\u4e4b\u540e"},"\u8d34\u6807\u7b7e\u4e4b\u540e"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,19}","{5,19}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Tag = "\u5206\u7ec4\u4e00")]\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n [ApiDescriptionSettings(Tag = "\u5206\u7ec4\u4e8c")]\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/tag1.png")})),Object(r.b)(l.a,{value:"tag2",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,19}","{5,19}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Tag = "\u5408\u5e76\u6240\u6709\u6807\u7b7e")]\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n [ApiDescriptionSettings(Tag = "\u5408\u5e76\u6240\u6709\u6807\u7b7e")]\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(b.a)("img/tag2.png")}))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c ",Object(r.b)("inlineCode",{parentName:"p"},"Tag")," \u540d\u5b57\u4e00\u6837\uff0c\u5219\u4f1a\u81ea\u52a8\u5408\u5e76\uff0c\u5426\u5219\u53ea\u662f\u547d\u540d\u3002"))),Object(r.b)("h2",{id:"510-dynamicapicontrollersettings-\u914d\u7f6e"},"5.10 ",Object(r.b)("inlineCode",{parentName:"h2"},"DynamicApiControllerSettings")," \u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u8fd8\u63d0\u4f9b\u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a5\u53e3\u4e00\u4e9b\u5168\u5c40\u914d\u7f6e\u9009\u9879\uff0c\u5982\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DefaultRoutePrefix"),"\uff1a\u9ed8\u8ba4\u8def\u7531\u524d\u7f00\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"api")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DefaultHttpMethod"),"\uff1a\u9ed8\u8ba4\u8bf7\u6c42\u8c13\u8bcd\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"POST")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DefaultModule"),"\uff1a\u9ed8\u8ba4\u6a21\u5757\u540d\u79f0\uff08\u533a\u57df\uff09\uff0c\u53ef\u7528\u4f5c\u63a5\u53e3\u7248\u672c\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"v1")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"LowercaseRoute"),"\uff1a\u5c0f\u5199\u8def\u7531\u683c\u5f0f\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"true")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"KeepVerb"),"\uff1a\u662f\u5426\u4fdd\u7559\u52a8\u4f5c\u8c13\u8bcd\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"CamelCaseSeparator"),"\uff1a\u9a86\u9a7c\u547d\u540d\u5206\u9694\u7b26\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"-")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"VersionSeparator"),"\uff1a\u7248\u672c\u5206\u9694\u7b26\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"@")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ModelToQuery"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"GET/HEAD")," \u8bf7\u6c42\u5c06 ",Object(r.b)("inlineCode",{parentName:"li"},"\u7c7b\u7c7b\u578b\u53c2\u6570\u8f6c\u67e5\u8be2\u53c2\u6570"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"SupportedMvcController"),"\uff1a\u662f\u5426\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"li"},"Mvc Controller")," \u52a8\u6001\u914d\u7f6e\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"AbandonControllerAffixes"),"\uff1a\u9ed8\u8ba4\u53bb\u9664\u63a7\u5236\u5668\u540d\u79f0\u524d\u540e\u7f00\u5217\u8868\u540d\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string[]"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"AppServices")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"AppService")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ApiController")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Controller")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Services")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Service")))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"AbandonActionAffixes"),"\uff1a\u9ed8\u8ba4\u53bb\u9664\u52a8\u4f5c\u65b9\u6cd5\u540d\u79f0\u524d\u540e\u7f00\u5217\u8868\u540d\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string[]"),"\uff0c\u9ed8\u8ba4\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Async"))))),Object(r.b)("h3",{id:"5101-\u652f\u6301-mvc-\u63a7\u5236\u5668-\u52a8\u6001\u914d\u7f6e"},"5.10.1 \u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"h3"},"Mvc \u63a7\u5236\u5668")," \u52a8\u6001\u914d\u7f6e"),Object(r.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u63a5\u53e3\u4e0d\u5bf9 ",Object(r.b)("inlineCode",{parentName:"p"},"ControllerBase")," \u7c7b\u578b\u8fdb\u884c\u4efb\u4f55\u5904\u7406\u3002\u5f53\u7136\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u624b\u52a8\u542f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"ControllerBase")," \u652f\u6301\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-4} title="Fur.Web.Entry/appsettings.json"',"{2-4}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "DynamicApiControllerSettings": {\n "SupportedMvcController": true\n }\n }\n}\n')),Object(r.b)("p",null,"\u8bbe\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"SupportedMvcController: true")," \u540e\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Mvc ControllerBase")," \u7c7b\u578b\u4e5f\u80fd\u548c\u52a8\u6001 ",Object(r.b)("inlineCode",{parentName:"p"},"WebAPI")," \u4e00\u6837\u7684\u7075\u6d3b\u4e86\u3002\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5}","{5}":!0}),"using Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n public class MvcController : ControllerBase\n {\n public string Get()\n {\n return nameof(Fur);\n }\n }\n}\n\n")),Object(r.b)("div",{className:"admonition admonition-warning alert alert--danger"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})))),"\u6ce8\u610f\u4e8b\u9879")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u542f\u7528\u8be5\u914d\u7f6e\u540e\uff0c\u5982\u679c ",Object(r.b)("inlineCode",{parentName:"p"},"Mvc \u63a7\u5236\u5668")," \u6ca1\u6709\u4efb\u4f55 ",Object(r.b)("inlineCode",{parentName:"p"},"[Route]")," \u7279\u6027\uff0c\u4f46\u662f\u8d34\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiController]")," \u7279\u6027\u5c06\u4f1a\u62a5\u9519\u3002\u539f\u56e0\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiController]")," \u7279\u6027\u5185\u90e8\u505a\u4e86\u8def\u7531\u7279\u6027\u68c0\u6d4b\u3002\u6240\u4ee5\u5efa\u8bae\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"[ApiDataValidation]")," \u4ee3\u66ff\u3002"),Object(r.b)("p",{parentName:"div"},"\u67e5\u770b ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/dotnet/aspnetcore/blob/c565386a3ed135560bc2e9017aa54a950b4e35dd/src/Mvc/Mvc.Core/src/ApplicationModels/ApiBehaviorApplicationModelProvider.cs#L90"}),"ASP.NET Core - ApiBehaviorApplicationModelProvider \u6e90\u7801")))),Object(r.b)("h2",{id:"511-\u53cd\u9988\u4e0e\u5efa\u8bae"},"5.11 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/1.72c59440.js b/docs/1.72c59440.js deleted file mode 100644 index 7ade974a67f..00000000000 --- a/docs/1.72c59440.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{143:function(t,e,n){"use strict";var r=n(0),o=n(19);e.a=function(){var t=Object(r.useContext)(o.a);if(null===t)throw new Error("Docusaurus context not provided");return t}},144:function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"a",(function(){return a}));var r=n(143),o=n(145);function i(){var t=Object(r.a)().siteConfig,e=(t=void 0===t?{}:t).baseUrl,n=void 0===e?"/":e,i=t.url;return{withBaseUrl:function(t,e){return function(t,e,n,r){var i=void 0===r?{}:r,a=i.forcePrependBaseUrl,u=void 0!==a&&a,c=i.absolute,s=void 0!==c&&c;if(!n)return n;if(n.startsWith("#"))return n;if(Object(o.b)(n))return n;if(u)return e+n;var f=n.startsWith(e)?n:e+n.replace(/^\//,"");return s?t+f:f}(i,n,t,e)}}}function a(t,e){return void 0===e&&(e={}),(0,i().withBaseUrl)(t,e)}},145:function(t,e,n){"use strict";function r(t){return!0===/^(\w*:|\/\/)/.test(t)}function o(t){return void 0!==t&&!r(t)}n.d(e,"b",(function(){return r})),n.d(e,"a",(function(){return o}))},146:function(t,e,n){"use strict";function r(t){var e,n,o="";if("string"==typeof t||"number"==typeof t)o+=t;else if("object"==typeof t)if(Array.isArray(t))for(e=0;e0)&&(l.unobserve(e),l.disconnect(),n())}))}))).observe(e))},to:A||""},d&&{activeClassName:v}))}},155:function(t,e,n){"use strict";var r=n(0),o=n.n(r),i=n(169);e.a=function(t){return o.a.createElement(i.a,Object.assign({},t))}},157:function(t,e,n){"use strict";n.r(e);var r=n(13);n.d(e,"MemoryRouter",(function(){return r.d})),n.d(e,"Prompt",(function(){return r.f})),n.d(e,"Redirect",(function(){return r.g})),n.d(e,"Route",(function(){return r.h})),n.d(e,"Router",(function(){return r.i})),n.d(e,"StaticRouter",(function(){return r.j})),n.d(e,"Switch",(function(){return r.k})),n.d(e,"generatePath",(function(){return r.l})),n.d(e,"matchPath",(function(){return r.m})),n.d(e,"useHistory",(function(){return r.n})),n.d(e,"useLocation",(function(){return r.o})),n.d(e,"useParams",(function(){return r.p})),n.d(e,"useRouteMatch",(function(){return r.q})),n.d(e,"withRouter",(function(){return r.r})),n.d(e,"BrowserRouter",(function(){return r.a})),n.d(e,"HashRouter",(function(){return r.b})),n.d(e,"Link",(function(){return r.c})),n.d(e,"NavLink",(function(){return r.e}))},158:function(t,e,n){try{t.exports=n(178)}catch(r){t.exports={}}},169:function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return yt}));var r,o,i,a,u=n(7),c=n.n(u),s=n(170),f=n.n(s),l=n(171),d=n.n(l),p=n(0),h=n.n(p),v=n(21),y=n.n(v),b="bodyAttributes",g="htmlAttributes",m="titleAttributes",w={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title"},T=(Object.keys(w).map((function(t){return w[t]})),"charset"),O="cssText",A="href",C="http-equiv",E="innerHTML",S="itemprop",j="name",P="property",L="rel",k="src",x="target",I={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},D="defaultTitle",R="defer",M="encodeSpecialCharacters",N="onChangeClientState",V="titleTemplate",_=Object.keys(I).reduce((function(t,e){return t[I[e]]=e,t}),{}),B=[w.NOSCRIPT,w.SCRIPT,w.STYLE],H="data-react-helmet",U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},q=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Y=function(){function t(t,e){for(var n=0;n=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},z=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},K=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!1===e?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},J=function(t){var e=Z(t,w.TITLE),n=Z(t,V);if(n&&e)return n.replace(/%s/g,(function(){return Array.isArray(e)?e.join(""):e}));var r=Z(t,D);return e||r||void 0},$=function(t){return Z(t,N)||function(){}},G=function(t,e){return e.filter((function(e){return void 0!==e[t]})).map((function(e){return e[t]})).reduce((function(t,e){return F({},t,e)}),{})},Q=function(t,e){return e.filter((function(t){return void 0!==t[w.BASE]})).map((function(t){return t[w.BASE]})).reverse().reduce((function(e,n){if(!e.length)for(var r=Object.keys(n),o=0;o=0;n--){var r=t[n];if(r.hasOwnProperty(e))return r[e]}return null},tt=(r=Date.now(),function(t){var e=Date.now();e-r>16?(r=e,t(e)):setTimeout((function(){tt(t)}),0)}),et=function(t){return clearTimeout(t)},nt="undefined"!=typeof window?window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||tt:t.requestAnimationFrame||tt,rt="undefined"!=typeof window?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||et:t.cancelAnimationFrame||et,ot=function(t){return console&&"function"==typeof console.warn&&console.warn(t)},it=null,at=function(t,e){var n=t.baseTag,r=t.bodyAttributes,o=t.htmlAttributes,i=t.linkTags,a=t.metaTags,u=t.noscriptTags,c=t.onChangeClientState,s=t.scriptTags,f=t.styleTags,l=t.title,d=t.titleAttributes;st(w.BODY,r),st(w.HTML,o),ct(l,d);var p={baseTag:ft(w.BASE,n),linkTags:ft(w.LINK,i),metaTags:ft(w.META,a),noscriptTags:ft(w.NOSCRIPT,u),scriptTags:ft(w.SCRIPT,s),styleTags:ft(w.STYLE,f)},h={},v={};Object.keys(p).forEach((function(t){var e=p[t],n=e.newTags,r=e.oldTags;n.length&&(h[t]=n),r.length&&(v[t]=p[t].oldTags)})),e&&e(),c(t,h,v)},ut=function(t){return Array.isArray(t)?t.join(""):t},ct=function(t,e){void 0!==t&&document.title!==t&&(document.title=ut(t)),st(w.TITLE,e)},st=function(t,e){var n=document.getElementsByTagName(t)[0];if(n){for(var r=n.getAttribute(H),o=r?r.split(","):[],i=[].concat(o),a=Object.keys(e),u=0;u=0;l--)n.removeAttribute(i[l]);o.length===i.length?n.removeAttribute(H):n.getAttribute(H)!==a.join(",")&&n.setAttribute(H,a.join(","))}},ft=function(t,e){var n=document.head||document.querySelector(w.HEAD),r=n.querySelectorAll(t+"["+"data-react-helmet]"),o=Array.prototype.slice.call(r),i=[],a=void 0;return e&&e.length&&e.forEach((function(e){var n=document.createElement(t);for(var r in e)if(e.hasOwnProperty(r))if(r===E)n.innerHTML=e.innerHTML;else if(r===O)n.styleSheet?n.styleSheet.cssText=e.cssText:n.appendChild(document.createTextNode(e.cssText));else{var u=void 0===e[r]?"":e[r];n.setAttribute(r,u)}n.setAttribute(H,"true"),o.some((function(t,e){return a=e,n.isEqualNode(t)}))?o.splice(a,1):i.push(n)})),o.forEach((function(t){return t.parentNode.removeChild(t)})),i.forEach((function(t){return n.appendChild(t)})),{oldTags:o,newTags:i}},lt=function(t){return Object.keys(t).reduce((function(e,n){var r=void 0!==t[n]?n+'="'+t[n]+'"':""+n;return e?e+" "+r:r}),"")},dt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(t).reduce((function(e,n){return e[I[n]||n]=t[n],e}),e)},pt=function(t,e,n){switch(t){case w.TITLE:return{toComponent:function(){return t=e.title,n=e.titleAttributes,(r={key:t})[H]=!0,o=dt(n,r),[h.a.createElement(w.TITLE,o,t)];var t,n,r,o},toString:function(){return function(t,e,n,r){var o=lt(n),i=ut(e);return o?"<"+t+' data-react-helmet="true" '+o+">"+K(i,r)+"":"<"+t+' data-react-helmet="true">'+K(i,r)+""}(t,e.title,e.titleAttributes,n)}};case b:case g:return{toComponent:function(){return dt(e)},toString:function(){return lt(e)}};default:return{toComponent:function(){return function(t,e){return e.map((function(e,n){var r,o=((r={key:n})[H]=!0,r);return Object.keys(e).forEach((function(t){var n=I[t]||t;if(n===E||n===O){var r=e.innerHTML||e.cssText;o.dangerouslySetInnerHTML={__html:r}}else o[n]=e[t]})),h.a.createElement(t,o)}))}(t,e)},toString:function(){return function(t,e,n){return e.reduce((function(e,r){var o=Object.keys(r).filter((function(t){return!(t===E||t===O)})).reduce((function(t,e){var o=void 0===r[e]?e:e+'="'+K(r[e],n)+'"';return t?t+" "+o:o}),""),i=r.innerHTML||r.cssText||"",a=-1===B.indexOf(t);return e+"<"+t+' data-react-helmet="true" '+o+(a?"/>":">"+i+"")}),"")}(t,e,n)}}}},ht=function(t){var e=t.baseTag,n=t.bodyAttributes,r=t.encode,o=t.htmlAttributes,i=t.linkTags,a=t.metaTags,u=t.noscriptTags,c=t.scriptTags,s=t.styleTags,f=t.title,l=void 0===f?"":f,d=t.titleAttributes;return{base:pt(w.BASE,e,r),bodyAttributes:pt(b,n,r),htmlAttributes:pt(g,o,r),link:pt(w.LINK,i,r),meta:pt(w.META,a,r),noscript:pt(w.NOSCRIPT,u,r),script:pt(w.SCRIPT,c,r),style:pt(w.STYLE,s,r),title:pt(w.TITLE,{title:l,titleAttributes:d},r)}},vt=f()((function(t){return{baseTag:Q([A,x],t),bodyAttributes:G(b,t),defer:Z(t,R),encode:Z(t,M),htmlAttributes:G(g,t),linkTags:X(w.LINK,[L,A],t),metaTags:X(w.META,[j,T,C,P,S],t),noscriptTags:X(w.NOSCRIPT,[E],t),onChangeClientState:$(t),scriptTags:X(w.SCRIPT,[k,E],t),styleTags:X(w.STYLE,[O],t),title:J(t),titleAttributes:G(m,t)}}),(function(t){it&&rt(it),t.defer?it=nt((function(){at(t,(function(){it=null}))})):(at(t),it=null)}),ht)((function(){return null})),yt=(o=vt,a=i=function(t){function e(){return q(this,e),z(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.shouldComponentUpdate=function(t){return!d()(this.props,t)},e.prototype.mapNestedChildrenToProps=function(t,e){if(!e)return null;switch(t.type){case w.SCRIPT:case w.NOSCRIPT:return{innerHTML:e};case w.STYLE:return{cssText:e}}throw new Error("<"+t.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")},e.prototype.flattenArrayTypeChildren=function(t){var e,n=t.child,r=t.arrayTypeChildren,o=t.newChildProps,i=t.nestedChildren;return F({},r,((e={})[n.type]=[].concat(r[n.type]||[],[F({},o,this.mapNestedChildrenToProps(n,i))]),e))},e.prototype.mapObjectTypeChildren=function(t){var e,n,r=t.child,o=t.newProps,i=t.newChildProps,a=t.nestedChildren;switch(r.type){case w.TITLE:return F({},o,((e={})[r.type]=a,e.titleAttributes=F({},i),e));case w.BODY:return F({},o,{bodyAttributes:F({},i)});case w.HTML:return F({},o,{htmlAttributes:F({},i)})}return F({},o,((n={})[r.type]=F({},i),n))},e.prototype.mapArrayTypeChildrenToProps=function(t,e){var n=F({},e);return Object.keys(t).forEach((function(e){var r;n=F({},n,((r={})[e]=t[e],r))})),n},e.prototype.warnOnInvalidChildren=function(t,e){return!0},e.prototype.mapChildrenToProps=function(t,e){var n=this,r={};return h.a.Children.forEach(t,(function(t){if(t&&t.props){var o=t.props,i=o.children,a=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(t).reduce((function(e,n){return e[_[n]||n]=t[n],e}),e)}(W(o,["children"]));switch(n.warnOnInvalidChildren(t,i),t.type){case w.LINK:case w.META:case w.NOSCRIPT:case w.SCRIPT:case w.STYLE:r=n.flattenArrayTypeChildren({child:t,arrayTypeChildren:r,newChildProps:a,nestedChildren:i});break;default:e=n.mapObjectTypeChildren({child:t,newProps:e,newChildProps:a,nestedChildren:i})}}})),e=this.mapArrayTypeChildrenToProps(r,e)},e.prototype.render=function(){var t=this.props,e=t.children,n=W(t,["children"]),r=F({},n);return e&&(r=this.mapChildrenToProps(e,r)),h.a.createElement(o,r)},Y(e,null,[{key:"canUseDOM",set:function(t){o.canUseDOM=t}}]),e}(h.a.Component),i.propTypes={base:c.a.object,bodyAttributes:c.a.object,children:c.a.oneOfType([c.a.arrayOf(c.a.node),c.a.node]),defaultTitle:c.a.string,defer:c.a.bool,encodeSpecialCharacters:c.a.bool,htmlAttributes:c.a.object,link:c.a.arrayOf(c.a.object),meta:c.a.arrayOf(c.a.object),noscript:c.a.arrayOf(c.a.object),onChangeClientState:c.a.func,script:c.a.arrayOf(c.a.object),style:c.a.arrayOf(c.a.object),title:c.a.string,titleAttributes:c.a.object,titleTemplate:c.a.string},i.defaultProps={defer:!0,encodeSpecialCharacters:!0},i.peek=o.peek,i.rewind=function(){var t=o.rewind();return t||(t=ht({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),t},a);yt.renderStatic=yt.rewind}).call(this,n(28))},170:function(t,e,n){"use strict";var r,o=n(0),i=(r=o)&&"object"==typeof r&&"default"in r?r.default:r;function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var u=!("undefined"==typeof window||!window.document||!window.document.createElement);t.exports=function(t,e,n){if("function"!=typeof t)throw new Error("Expected reducePropsToState to be a function.");if("function"!=typeof e)throw new Error("Expected handleStateChangeOnClient to be a function.");if(void 0!==n&&"function"!=typeof n)throw new Error("Expected mapStateOnServer to either be undefined or a function.");return function(r){if("function"!=typeof r)throw new Error("Expected WrappedComponent to be a React component.");var c,s=[];function f(){c=t(s.map((function(t){return t.props}))),l.canUseDOM?e(c):n&&(c=n(c))}var l=function(t){var e,n;function o(){return t.apply(this,arguments)||this}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,o.peek=function(){return c},o.rewind=function(){if(o.canUseDOM)throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");var t=c;return c=void 0,s=[],t};var a=o.prototype;return a.UNSAFE_componentWillMount=function(){s.push(this),f()},a.componentDidUpdate=function(){f()},a.componentWillUnmount=function(){var t=s.indexOf(this);s.splice(t,1),f()},a.render=function(){return i.createElement(r,this.props)},o}(o.PureComponent);return a(l,"displayName","SideEffect("+function(t){return t.displayName||t.name||"Component"}(r)+")"),a(l,"canUseDOM",u),l}}},171:function(t,e){var n="undefined"!=typeof Element,r="function"==typeof Map,o="function"==typeof Set,i="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function a(t,e){if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e){if(t.constructor!==e.constructor)return!1;var u,c,s,f;if(Array.isArray(t)){if((u=t.length)!=e.length)return!1;for(c=u;0!=c--;)if(!a(t[c],e[c]))return!1;return!0}if(r&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(f=t.entries();!(c=f.next()).done;)if(!e.has(c.value[0]))return!1;for(f=t.entries();!(c=f.next()).done;)if(!a(c.value[1],e.get(c.value[0])))return!1;return!0}if(o&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(f=t.entries();!(c=f.next()).done;)if(!e.has(c.value[0]))return!1;return!0}if(i&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if((u=t.length)!=e.length)return!1;for(c=u;0!=c--;)if(t[c]!==e[c])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if((u=(s=Object.keys(t)).length)!==Object.keys(e).length)return!1;for(c=u;0!=c--;)if(!Object.prototype.hasOwnProperty.call(e,s[c]))return!1;if(n&&t instanceof Element)return!1;for(c=u;0!=c--;)if(("_owner"!==s[c]&&"__v"!==s[c]&&"__o"!==s[c]||!t.$$typeof)&&!a(t[s[c]],e[s[c]]))return!1;return!0}return t!=t&&e!=e}t.exports=function(t,e){try{return a(t,e)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}},178:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.useDocVersionSuggestions=e.useActiveDocContext=e.useActiveVersion=e.useLatestVersion=e.useVersions=e.useActivePlugin=void 0;var r=n(157),o=n(179),i=n(180),a=function(t){return o.usePluginData("docusaurus-plugin-content-docs",t)};e.useActivePlugin=function(t){void 0===t&&(t={});var e=o.useAllPluginInstancesData("docusaurus-plugin-content-docs"),n=r.useLocation().pathname;return i.getActivePlugin(e,n,t)},e.useVersions=function(t){return a(t).versions},e.useLatestVersion=function(t){var e=a(t);return i.getLatestVersion(e)},e.useActiveVersion=function(t){var e=a(t),n=r.useLocation().pathname;return i.getActiveVersion(e,n)},e.useActiveDocContext=function(t){var e=a(t),n=r.useLocation().pathname;return i.getActiveDocContext(e,n)},e.useDocVersionSuggestions=function(t){var e=a(t),n=r.useLocation().pathname;return i.getDocVersionSuggestions(e,n)}},179:function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return o})),n.d(e,"useAllPluginInstancesData",(function(){return i})),n.d(e,"usePluginData",(function(){return a}));var r=n(143);function o(){var t=Object(r.a)().globalData;if(!t)throw new Error("Docusaurus global data not found");return t}function i(t){var e=o()[t];if(!e)throw new Error("Docusaurus plugin global data not found for pluginName="+t);return e}function a(t,e){void 0===e&&(e="default");var n=i(t)[e];if(!n)throw new Error("Docusaurus plugin global data not found for pluginName="+t+" and pluginId="+e);return n}},180:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getDocVersionSuggestions=e.getActiveDocContext=e.getActiveVersion=e.getLatestVersion=e.getActivePlugin=void 0;var r=n(157);e.getActivePlugin=function(t,e,n){void 0===n&&(n={});var o=Object.entries(t).find((function(t){t[0];var n=t[1];return!!r.matchPath(e,{path:n.path,exact:!1,strict:!1})})),i=o?{pluginId:o[0],pluginData:o[1]}:void 0;if(!i&&n.failfast)throw new Error("Can't find active docs plugin for pathname="+e+", while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: "+Object.values(t).map((function(t){return t.path})).join(", "));return i},e.getLatestVersion=function(t){return t.versions.find((function(t){return t.isLast}))},e.getActiveVersion=function(t,n){var o=e.getLatestVersion(t);return[].concat(t.versions.filter((function(t){return t!==o})),[o]).find((function(t){return!!r.matchPath(n,{path:t.path,exact:!1,strict:!1})}))},e.getActiveDocContext=function(t,n){var o,i,a=e.getActiveVersion(t,n),u=null==a?void 0:a.docs.find((function(t){return!!r.matchPath(n,{path:t.path,exact:!0,strict:!1})}));return{activeVersion:a,activeDoc:u,alternateDocVersions:u?(o=u.id,i={},t.versions.forEach((function(t){t.docs.forEach((function(e){e.id===o&&(i[t.name]=e)}))})),i):{}}},e.getDocVersionSuggestions=function(t,n){var r=e.getLatestVersion(t),o=e.getActiveDocContext(t,n),i=o.activeVersion!==r;return{latestDocSuggestion:i?null==o?void 0:o.alternateDocVersions[r.name]:void 0,latestVersionSuggestion:i?r:void 0}}}}]); \ No newline at end of file diff --git a/docs/1.7bcff63a.js b/docs/1.7bcff63a.js new file mode 100644 index 00000000000..c0a3d40f37c --- /dev/null +++ b/docs/1.7bcff63a.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{143:function(t,e,n){"use strict";var r=n(0),o=n(19);e.a=function(){const t=Object(r.useContext)(o.a);if(null===t)throw new Error("Docusaurus context not provided");return t}},144:function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"a",(function(){return a}));var r=n(143),o=n(145);function i(){const{siteConfig:{baseUrl:t="/",url:e}={}}=Object(r.a)();return{withBaseUrl:(n,r)=>function(t,e,n,{forcePrependBaseUrl:r=!1,absolute:i=!1}={}){if(!n)return n;if(n.startsWith("#"))return n;if(Object(o.b)(n))return n;if(r)return e+n;const a=n.startsWith(e)?n:e+n.replace(/^\//,"");return i?t+a:a}(e,t,n,r)}}function a(t,e={}){const{withBaseUrl:n}=i();return n(t,e)}},145:function(t,e,n){"use strict";function r(t){return!0===/^(\w*:|\/\/)/.test(t)}function o(t){return void 0!==t&&!r(t)}n.d(e,"b",(function(){return r})),n.d(e,"a",(function(){return o}))},146:function(t,e,n){"use strict";function r(t){var e,n,o="";if("string"==typeof t||"number"==typeof t)o+=t;else if("object"==typeof t)if(Array.isArray(t))for(e=0;e{}});var s=n(144),f=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);ot.startsWith("/"))(O=w)?b(O):O:void 0;var O;const A=Object(r.useRef)(!1),C=n?i.e:i.c,E=u.a.canUseIntersectionObserver;let S;Object(r.useEffect)(()=>(!E&&m&&window.docusaurus.prefetch(T),()=>{E&&S&&S.disconnect()}),[T,E,m]);const j=null!==(e=null==T?void 0:T.startsWith("#"))&&void 0!==e&&e,P=!T||!m||j;return T&&m&&!j&&!h&&g.collectLink(T),P?o.a.createElement("a",Object.assign({href:T},!m&&{target:"_blank",rel:"noopener noreferrer"},y)):o.a.createElement(C,Object.assign({},y,{onMouseEnter:()=>{A.current||(window.docusaurus.preload(T),A.current=!0)},innerRef:t=>{var e,n;E&&t&&m&&(e=t,n=()=>{window.docusaurus.prefetch(T)},S=new window.IntersectionObserver(t=>{t.forEach(t=>{e===t.target&&(t.isIntersecting||t.intersectionRatio>0)&&(S.unobserve(e),S.disconnect(),n())})}),S.observe(e))},to:T||""},n&&{activeClassName:d}))}},155:function(t,e,n){"use strict";var r=n(0),o=n.n(r),i=n(171);e.a=function(t){return o.a.createElement(i.a,Object.assign({},t))}},157:function(t,e,n){"use strict";n.r(e);var r=n(13);n.d(e,"MemoryRouter",(function(){return r.d})),n.d(e,"Prompt",(function(){return r.f})),n.d(e,"Redirect",(function(){return r.g})),n.d(e,"Route",(function(){return r.h})),n.d(e,"Router",(function(){return r.i})),n.d(e,"StaticRouter",(function(){return r.j})),n.d(e,"Switch",(function(){return r.k})),n.d(e,"generatePath",(function(){return r.l})),n.d(e,"matchPath",(function(){return r.m})),n.d(e,"useHistory",(function(){return r.n})),n.d(e,"useLocation",(function(){return r.o})),n.d(e,"useParams",(function(){return r.p})),n.d(e,"useRouteMatch",(function(){return r.q})),n.d(e,"withRouter",(function(){return r.r})),n.d(e,"BrowserRouter",(function(){return r.a})),n.d(e,"HashRouter",(function(){return r.b})),n.d(e,"Link",(function(){return r.c})),n.d(e,"NavLink",(function(){return r.e}))},158:function(t,e,n){try{t.exports=n(180)}catch(r){t.exports={}}},171:function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return bt}));var r,o,i,a,u=n(7),c=n.n(u),s=n(172),f=n.n(s),l=n(173),p=n.n(l),d=n(0),h=n.n(d),y=n(21),b=n.n(y),g="bodyAttributes",v="htmlAttributes",m="titleAttributes",w={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title"},T=(Object.keys(w).map((function(t){return w[t]})),"charset"),O="cssText",A="href",C="http-equiv",E="innerHTML",S="itemprop",j="name",P="property",L="rel",k="src",x="target",I={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},D="defaultTitle",R="defer",M="encodeSpecialCharacters",N="onChangeClientState",V="titleTemplate",_=Object.keys(I).reduce((function(t,e){return t[I[e]]=e,t}),{}),B=[w.NOSCRIPT,w.SCRIPT,w.STYLE],H="data-react-helmet",U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},q=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Y=function(){function t(t,e){for(var n=0;n=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},z=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},K=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!1===e?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},$=function(t){var e=Z(t,w.TITLE),n=Z(t,V);if(n&&e)return n.replace(/%s/g,(function(){return Array.isArray(e)?e.join(""):e}));var r=Z(t,D);return e||r||void 0},J=function(t){return Z(t,N)||function(){}},G=function(t,e){return e.filter((function(e){return void 0!==e[t]})).map((function(e){return e[t]})).reduce((function(t,e){return F({},t,e)}),{})},Q=function(t,e){return e.filter((function(t){return void 0!==t[w.BASE]})).map((function(t){return t[w.BASE]})).reverse().reduce((function(e,n){if(!e.length)for(var r=Object.keys(n),o=0;o=0;n--){var r=t[n];if(r.hasOwnProperty(e))return r[e]}return null},tt=(r=Date.now(),function(t){var e=Date.now();e-r>16?(r=e,t(e)):setTimeout((function(){tt(t)}),0)}),et=function(t){return clearTimeout(t)},nt="undefined"!=typeof window?window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||tt:t.requestAnimationFrame||tt,rt="undefined"!=typeof window?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||et:t.cancelAnimationFrame||et,ot=function(t){return console&&"function"==typeof console.warn&&console.warn(t)},it=null,at=function(t,e){var n=t.baseTag,r=t.bodyAttributes,o=t.htmlAttributes,i=t.linkTags,a=t.metaTags,u=t.noscriptTags,c=t.onChangeClientState,s=t.scriptTags,f=t.styleTags,l=t.title,p=t.titleAttributes;st(w.BODY,r),st(w.HTML,o),ct(l,p);var d={baseTag:ft(w.BASE,n),linkTags:ft(w.LINK,i),metaTags:ft(w.META,a),noscriptTags:ft(w.NOSCRIPT,u),scriptTags:ft(w.SCRIPT,s),styleTags:ft(w.STYLE,f)},h={},y={};Object.keys(d).forEach((function(t){var e=d[t],n=e.newTags,r=e.oldTags;n.length&&(h[t]=n),r.length&&(y[t]=d[t].oldTags)})),e&&e(),c(t,h,y)},ut=function(t){return Array.isArray(t)?t.join(""):t},ct=function(t,e){void 0!==t&&document.title!==t&&(document.title=ut(t)),st(w.TITLE,e)},st=function(t,e){var n=document.getElementsByTagName(t)[0];if(n){for(var r=n.getAttribute(H),o=r?r.split(","):[],i=[].concat(o),a=Object.keys(e),u=0;u=0;l--)n.removeAttribute(i[l]);o.length===i.length?n.removeAttribute(H):n.getAttribute(H)!==a.join(",")&&n.setAttribute(H,a.join(","))}},ft=function(t,e){var n=document.head||document.querySelector(w.HEAD),r=n.querySelectorAll(t+"["+"data-react-helmet]"),o=Array.prototype.slice.call(r),i=[],a=void 0;return e&&e.length&&e.forEach((function(e){var n=document.createElement(t);for(var r in e)if(e.hasOwnProperty(r))if(r===E)n.innerHTML=e.innerHTML;else if(r===O)n.styleSheet?n.styleSheet.cssText=e.cssText:n.appendChild(document.createTextNode(e.cssText));else{var u=void 0===e[r]?"":e[r];n.setAttribute(r,u)}n.setAttribute(H,"true"),o.some((function(t,e){return a=e,n.isEqualNode(t)}))?o.splice(a,1):i.push(n)})),o.forEach((function(t){return t.parentNode.removeChild(t)})),i.forEach((function(t){return n.appendChild(t)})),{oldTags:o,newTags:i}},lt=function(t){return Object.keys(t).reduce((function(e,n){var r=void 0!==t[n]?n+'="'+t[n]+'"':""+n;return e?e+" "+r:r}),"")},pt=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(t).reduce((function(e,n){return e[I[n]||n]=t[n],e}),e)},dt=function(t,e,n){switch(t){case w.TITLE:return{toComponent:function(){return t=e.title,n=e.titleAttributes,(r={key:t})[H]=!0,o=pt(n,r),[h.a.createElement(w.TITLE,o,t)];var t,n,r,o},toString:function(){return function(t,e,n,r){var o=lt(n),i=ut(e);return o?"<"+t+' data-react-helmet="true" '+o+">"+K(i,r)+"":"<"+t+' data-react-helmet="true">'+K(i,r)+""}(t,e.title,e.titleAttributes,n)}};case g:case v:return{toComponent:function(){return pt(e)},toString:function(){return lt(e)}};default:return{toComponent:function(){return function(t,e){return e.map((function(e,n){var r,o=((r={key:n})[H]=!0,r);return Object.keys(e).forEach((function(t){var n=I[t]||t;if(n===E||n===O){var r=e.innerHTML||e.cssText;o.dangerouslySetInnerHTML={__html:r}}else o[n]=e[t]})),h.a.createElement(t,o)}))}(t,e)},toString:function(){return function(t,e,n){return e.reduce((function(e,r){var o=Object.keys(r).filter((function(t){return!(t===E||t===O)})).reduce((function(t,e){var o=void 0===r[e]?e:e+'="'+K(r[e],n)+'"';return t?t+" "+o:o}),""),i=r.innerHTML||r.cssText||"",a=-1===B.indexOf(t);return e+"<"+t+' data-react-helmet="true" '+o+(a?"/>":">"+i+"")}),"")}(t,e,n)}}}},ht=function(t){var e=t.baseTag,n=t.bodyAttributes,r=t.encode,o=t.htmlAttributes,i=t.linkTags,a=t.metaTags,u=t.noscriptTags,c=t.scriptTags,s=t.styleTags,f=t.title,l=void 0===f?"":f,p=t.titleAttributes;return{base:dt(w.BASE,e,r),bodyAttributes:dt(g,n,r),htmlAttributes:dt(v,o,r),link:dt(w.LINK,i,r),meta:dt(w.META,a,r),noscript:dt(w.NOSCRIPT,u,r),script:dt(w.SCRIPT,c,r),style:dt(w.STYLE,s,r),title:dt(w.TITLE,{title:l,titleAttributes:p},r)}},yt=f()((function(t){return{baseTag:Q([A,x],t),bodyAttributes:G(g,t),defer:Z(t,R),encode:Z(t,M),htmlAttributes:G(v,t),linkTags:X(w.LINK,[L,A],t),metaTags:X(w.META,[j,T,C,P,S],t),noscriptTags:X(w.NOSCRIPT,[E],t),onChangeClientState:J(t),scriptTags:X(w.SCRIPT,[k,E],t),styleTags:X(w.STYLE,[O],t),title:$(t),titleAttributes:G(m,t)}}),(function(t){it&&rt(it),t.defer?it=nt((function(){at(t,(function(){it=null}))})):(at(t),it=null)}),ht)((function(){return null})),bt=(o=yt,a=i=function(t){function e(){return q(this,e),z(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.shouldComponentUpdate=function(t){return!p()(this.props,t)},e.prototype.mapNestedChildrenToProps=function(t,e){if(!e)return null;switch(t.type){case w.SCRIPT:case w.NOSCRIPT:return{innerHTML:e};case w.STYLE:return{cssText:e}}throw new Error("<"+t.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")},e.prototype.flattenArrayTypeChildren=function(t){var e,n=t.child,r=t.arrayTypeChildren,o=t.newChildProps,i=t.nestedChildren;return F({},r,((e={})[n.type]=[].concat(r[n.type]||[],[F({},o,this.mapNestedChildrenToProps(n,i))]),e))},e.prototype.mapObjectTypeChildren=function(t){var e,n,r=t.child,o=t.newProps,i=t.newChildProps,a=t.nestedChildren;switch(r.type){case w.TITLE:return F({},o,((e={})[r.type]=a,e.titleAttributes=F({},i),e));case w.BODY:return F({},o,{bodyAttributes:F({},i)});case w.HTML:return F({},o,{htmlAttributes:F({},i)})}return F({},o,((n={})[r.type]=F({},i),n))},e.prototype.mapArrayTypeChildrenToProps=function(t,e){var n=F({},e);return Object.keys(t).forEach((function(e){var r;n=F({},n,((r={})[e]=t[e],r))})),n},e.prototype.warnOnInvalidChildren=function(t,e){return!0},e.prototype.mapChildrenToProps=function(t,e){var n=this,r={};return h.a.Children.forEach(t,(function(t){if(t&&t.props){var o=t.props,i=o.children,a=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(t).reduce((function(e,n){return e[_[n]||n]=t[n],e}),e)}(W(o,["children"]));switch(n.warnOnInvalidChildren(t,i),t.type){case w.LINK:case w.META:case w.NOSCRIPT:case w.SCRIPT:case w.STYLE:r=n.flattenArrayTypeChildren({child:t,arrayTypeChildren:r,newChildProps:a,nestedChildren:i});break;default:e=n.mapObjectTypeChildren({child:t,newProps:e,newChildProps:a,nestedChildren:i})}}})),e=this.mapArrayTypeChildrenToProps(r,e)},e.prototype.render=function(){var t=this.props,e=t.children,n=W(t,["children"]),r=F({},n);return e&&(r=this.mapChildrenToProps(e,r)),h.a.createElement(o,r)},Y(e,null,[{key:"canUseDOM",set:function(t){o.canUseDOM=t}}]),e}(h.a.Component),i.propTypes={base:c.a.object,bodyAttributes:c.a.object,children:c.a.oneOfType([c.a.arrayOf(c.a.node),c.a.node]),defaultTitle:c.a.string,defer:c.a.bool,encodeSpecialCharacters:c.a.bool,htmlAttributes:c.a.object,link:c.a.arrayOf(c.a.object),meta:c.a.arrayOf(c.a.object),noscript:c.a.arrayOf(c.a.object),onChangeClientState:c.a.func,script:c.a.arrayOf(c.a.object),style:c.a.arrayOf(c.a.object),title:c.a.string,titleAttributes:c.a.object,titleTemplate:c.a.string},i.defaultProps={defer:!0,encodeSpecialCharacters:!0},i.peek=o.peek,i.rewind=function(){var t=o.rewind();return t||(t=ht({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}})),t},a);bt.renderStatic=bt.rewind}).call(this,n(28))},172:function(t,e,n){"use strict";var r,o=n(0),i=(r=o)&&"object"==typeof r&&"default"in r?r.default:r;function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var u=!("undefined"==typeof window||!window.document||!window.document.createElement);t.exports=function(t,e,n){if("function"!=typeof t)throw new Error("Expected reducePropsToState to be a function.");if("function"!=typeof e)throw new Error("Expected handleStateChangeOnClient to be a function.");if(void 0!==n&&"function"!=typeof n)throw new Error("Expected mapStateOnServer to either be undefined or a function.");return function(r){if("function"!=typeof r)throw new Error("Expected WrappedComponent to be a React component.");var c,s=[];function f(){c=t(s.map((function(t){return t.props}))),l.canUseDOM?e(c):n&&(c=n(c))}var l=function(t){var e,n;function o(){return t.apply(this,arguments)||this}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,o.peek=function(){return c},o.rewind=function(){if(o.canUseDOM)throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");var t=c;return c=void 0,s=[],t};var a=o.prototype;return a.UNSAFE_componentWillMount=function(){s.push(this),f()},a.componentDidUpdate=function(){f()},a.componentWillUnmount=function(){var t=s.indexOf(this);s.splice(t,1),f()},a.render=function(){return i.createElement(r,this.props)},o}(o.PureComponent);return a(l,"displayName","SideEffect("+function(t){return t.displayName||t.name||"Component"}(r)+")"),a(l,"canUseDOM",u),l}}},173:function(t,e){var n="undefined"!=typeof Element,r="function"==typeof Map,o="function"==typeof Set,i="function"==typeof ArrayBuffer&&!!ArrayBuffer.isView;function a(t,e){if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e){if(t.constructor!==e.constructor)return!1;var u,c,s,f;if(Array.isArray(t)){if((u=t.length)!=e.length)return!1;for(c=u;0!=c--;)if(!a(t[c],e[c]))return!1;return!0}if(r&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(f=t.entries();!(c=f.next()).done;)if(!e.has(c.value[0]))return!1;for(f=t.entries();!(c=f.next()).done;)if(!a(c.value[1],e.get(c.value[0])))return!1;return!0}if(o&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(f=t.entries();!(c=f.next()).done;)if(!e.has(c.value[0]))return!1;return!0}if(i&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if((u=t.length)!=e.length)return!1;for(c=u;0!=c--;)if(t[c]!==e[c])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if((u=(s=Object.keys(t)).length)!==Object.keys(e).length)return!1;for(c=u;0!=c--;)if(!Object.prototype.hasOwnProperty.call(e,s[c]))return!1;if(n&&t instanceof Element)return!1;for(c=u;0!=c--;)if(("_owner"!==s[c]&&"__v"!==s[c]&&"__o"!==s[c]||!t.$$typeof)&&!a(t[s[c]],e[s[c]]))return!1;return!0}return t!=t&&e!=e}t.exports=function(t,e){try{return a(t,e)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}},180:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.useDocVersionSuggestions=e.useActiveDocContext=e.useActiveVersion=e.useLatestVersion=e.useVersions=e.useActivePlugin=void 0;const r=n(157),o=n(181),i=n(182),a=t=>o.usePluginData("docusaurus-plugin-content-docs",t);e.useActivePlugin=(t={})=>{const e=o.useAllPluginInstancesData("docusaurus-plugin-content-docs"),{pathname:n}=r.useLocation();return i.getActivePlugin(e,n,t)},e.useVersions=t=>a(t).versions,e.useLatestVersion=t=>{const e=a(t);return i.getLatestVersion(e)},e.useActiveVersion=t=>{const e=a(t),{pathname:n}=r.useLocation();return i.getActiveVersion(e,n)},e.useActiveDocContext=t=>{const e=a(t),{pathname:n}=r.useLocation();return i.getActiveDocContext(e,n)},e.useDocVersionSuggestions=t=>{const e=a(t),{pathname:n}=r.useLocation();return i.getDocVersionSuggestions(e,n)}},181:function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return o})),n.d(e,"useAllPluginInstancesData",(function(){return i})),n.d(e,"usePluginData",(function(){return a}));var r=n(143);function o(){const{globalData:t}=Object(r.a)();if(!t)throw new Error("Docusaurus global data not found");return t}function i(t){const e=o()[t];if(!e)throw new Error("Docusaurus plugin global data not found for pluginName="+t);return e}function a(t,e="default"){const n=i(t)[e];if(!n)throw new Error(`Docusaurus plugin global data not found for pluginName=${t} and pluginId=${e}`);return n}},182:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getDocVersionSuggestions=e.getActiveDocContext=e.getActiveVersion=e.getLatestVersion=e.getActivePlugin=void 0;const r=n(157);e.getActivePlugin=function(t,e,n={}){const o=Object.entries(t).find(([t,n])=>!!r.matchPath(e,{path:n.path,exact:!1,strict:!1})),i=o?{pluginId:o[0],pluginData:o[1]}:void 0;if(!i&&n.failfast)throw new Error(`Can't find active docs plugin for pathname=${e}, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(t).map(t=>t.path).join(", ")}`);return i},e.getLatestVersion=t=>t.versions.find(t=>t.isLast),e.getActiveVersion=(t,n)=>{const o=e.getLatestVersion(t);return[...t.versions.filter(t=>t!==o),o].find(t=>!!r.matchPath(n,{path:t.path,exact:!1,strict:!1}))},e.getActiveDocContext=(t,n)=>{const o=e.getActiveVersion(t,n),i=null==o?void 0:o.docs.find(t=>!!r.matchPath(n,{path:t.path,exact:!0,strict:!1}));return{activeVersion:o,activeDoc:i,alternateDocVersions:i?function(e){const n={};return t.versions.forEach(t=>{t.docs.forEach(r=>{r.id===e&&(n[t.name]=r)})}),n}(i.id):{}}},e.getDocVersionSuggestions=(t,n)=>{const r=e.getLatestVersion(t),o=e.getActiveDocContext(t,n),i=o.activeVersion!==r;return{latestDocSuggestion:i?null==o?void 0:o.alternateDocVersions[r.name]:void 0,latestVersionSuggestion:i?r:void 0}}}}]); \ No newline at end of file diff --git a/docs/17256d0f.0dd677ec.js b/docs/17256d0f.0dd677ec.js deleted file mode 100644 index d8c0c0da374..00000000000 --- a/docs/17256d0f.0dd677ec.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return u}));var a=n(0),i=n.n(a);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function b(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=i.a.createContext({}),p=function(e){var t=i.a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):b(b({},t),e)),n},s=function(e){var t=p(e.components);return i.a.createElement(o.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.a.createElement(i.a.Fragment,{},t)}},m=i.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,r=e.parentName,o=c(e,["components","mdxType","originalType","parentName"]),s=p(n),m=a,u=s["".concat(r,".").concat(m)]||s[m]||d[m]||l;return n?i.a.createElement(u,b(b({ref:t},o),{},{components:n})):i.a.createElement(u,b({ref:t},o))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,r=new Array(l);r[0]=m;var b={};for(var c in t)hasOwnProperty.call(t,c)&&(b[c]=t[c]);b.originalType=e,b.mdxType="string"==typeof e?e:a,r[1]=b;for(var o=2;oMvc \u7279\u6027\u65b9\u5f0f",id:"832-mvc-\u7279\u6027\u65b9\u5f0f",children:[]}]},{value:"8.4 DataValidation \u9a8c\u8bc1 \ud83e\udd17",id:"84-datavalidation-\u9a8c\u8bc1-",children:[{value:"8.4.1 DataValidation \u4f18\u70b9",id:"841-datavalidation-\u4f18\u70b9",children:[]}]},{value:"8.5 DataValidation \u4f7f\u7528",id:"85-datavalidation-\u4f7f\u7528",children:[{value:"8.5.1 \u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1",id:"851-\u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1",children:[]},{value:"8.5.2 \u517c\u5bb9 Mvc \u7279\u6027\u9a8c\u8bc1",id:"852-\u517c\u5bb9-mvc-\u7279\u6027\u9a8c\u8bc1",children:[]},{value:"8.5.3 \u517c\u5bb9 Mvc \u590d\u6742\u9a8c\u8bc1",id:"853-\u517c\u5bb9-mvc-\u590d\u6742\u9a8c\u8bc1",children:[]}]},{value:"8.6 \u624b\u52a8\u9a8c\u8bc1",id:"86-\u624b\u52a8\u9a8c\u8bc1",children:[{value:"8.7.1 \u9a8c\u8bc1\u6a21\u578b",id:"871-\u9a8c\u8bc1\u6a21\u578b",children:[]},{value:"8.7.2 ValidationTypes \u5e38\u89c1\u9a8c\u8bc1",id:"872-validationtypes-\u5e38\u89c1\u9a8c\u8bc1",children:[]},{value:"8.7.3 [DataValidation] \u7279\u6027",id:"873-datavalidation-\u7279\u6027",children:[]}]},{value:"8.7 [NonValidation] \u8df3\u8fc7\u9a8c\u8bc1",id:"87-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1",children:[]},{value:"8.8 \u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c",id:"88-\u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c",children:[{value:"8.8.1 \u81ea\u5b9a\u4e49 ValidationTypes \u7c7b\u578b",id:"881-\u81ea\u5b9a\u4e49-validationtypes-\u7c7b\u578b",children:[]},{value:"8.8.2 \u81ea\u5b9a\u4e49 ValidationTypes \u5931\u8d25\u6d88\u606f",id:"882-\u81ea\u5b9a\u4e49-validationtypes-\u5931\u8d25\u6d88\u606f",children:[]}]},{value:"8.9 \u6a21\u578b\u9a8c\u8bc1\u8303\u56f4",id:"89-\u6a21\u578b\u9a8c\u8bc1\u8303\u56f4",children:[{value:"8.9.1 \u5168\u5c40\u9a8c\u8bc1",id:"891-\u5168\u5c40\u9a8c\u8bc1",children:[]},{value:"8.9.2 [NonValidation] \u8df3\u8fc7\u9a8c\u8bc1",id:"892-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1",children:[]},{value:"8.9.3 [TypeFilter(typeof(DataValidationFilter))] \u5c40\u90e8\u9a8c\u8bc1",id:"893-typefiltertypeofdatavalidationfilter-\u5c40\u90e8\u9a8c\u8bc1",children:[]},{value:"8.9.4 [ApiController] \u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1",id:"894-apicontroller-\u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1",children:[]}]},{value:"8.10 MiniProfiler \u67e5\u770b",id:"810-miniprofiler-\u67e5\u770b",children:[]},{value:"8.10 \u591a\u8bed\u8a00\u652f\u6301",id:"810-\u591a\u8bed\u8a00\u652f\u6301",children:[]},{value:"8.11 \u9a8c\u8bc1\u6a21\u578b\u63d0\u4f9b\u5668",id:"811-\u9a8c\u8bc1\u6a21\u578b\u63d0\u4f9b\u5668",children:[]},{value:"8.12 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"812-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],d={rightToc:s};function m(e){var t=e.components,n=Object(i.a)(e,["components"]);return Object(l.b)("wrapper",Object(a.a)({},d,n,{components:t,mdxType:"MDXLayout"}),Object(l.b)("h2",{id:"81-\u5173\u4e8e\u6570\u636e\u6821\u9a8c"},"8.1 \u5173\u4e8e\u6570\u636e\u6821\u9a8c"),Object(l.b)("p",null,"\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"),Object(l.b)("h2",{id:"82-\u6570\u636e\u6821\u9a8c\u7684\u597d\u5904"},"8.2 \u6570\u636e\u6821\u9a8c\u7684\u597d\u5904"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u8fc7\u6ee4\u4e0d\u5b89\u5168\u6570\u636e\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u5b89\u5168\u6027"),Object(l.b)("li",{parentName:"ul"},"\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u4e1a\u52a1\u5f02\u5e38\u5904\u7406\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u54cd\u5e94\u901f\u5ea6"),Object(l.b)("li",{parentName:"ul"},"\u5927\u5927\u63d0\u9ad8\u7cfb\u7edf\u7a33\u5b9a\u6027"),Object(l.b)("li",{parentName:"ul"},"\u5927\u6570\u636e\u5e76\u53d1\u65f6\u8d77\u7740\u4e00\u5b9a\u7684\u7f13\u51b2\u4f5c\u7528")),Object(l.b)("h2",{id:"83-\u6570\u636e\u6821\u9a8c\u65b9\u5f0f"},"8.3 \u6570\u636e\u6821\u9a8c\u65b9\u5f0f"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u4f20\u7edf\u65b9\u5f0f\uff0c\u5728\u4e1a\u52a1\u4ee3\u7801\u4e4b\u524d\u624b\u52a8\u9a8c\u8bc1"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Mvc")," \u7279\u6027\u65b9\u5f0f\uff0c",Object(l.b)("inlineCode",{parentName:"li"},"Mvc")," \u5185\u7f6e\u7684 ",Object(l.b)("inlineCode",{parentName:"li"},"DataAnnotations")," \u65b9\u5f0f"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u63a8\u8350\u65b9\u5f0f"),"\uff0c",Object(l.b)("inlineCode",{parentName:"li"},"Fur")," \u6846\u67b6\u5185\u7f6e\u7684 ",Object(l.b)("inlineCode",{parentName:"li"},"DataValidation")," \u9a8c\u8bc1"),Object(l.b)("li",{parentName:"ul"},"\u5176\u4ed6\u65b9\u5f0f\uff0c\u4f7f\u7528\u7b2c\u4e09\u65b9\u9a8c\u8bc1\u5e93\uff0c\u5982 ",Object(l.b)("inlineCode",{parentName:"li"},"FluentValidation"))),Object(l.b)("h3",{id:"831-\u4f20\u7edf\u65b9\u5f0f"},"8.3.1 \u4f20\u7edf\u65b9\u5f0f"),Object(l.b)("p",null,"\u5728\u5f88\u591a\u8001\u9879\u76ee\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u770b\u5230\u8fd9\u6837\u7684\u4ee3\u7801\uff1a"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{4,9,14}","{4,9,14}":!0}),'public bool Insert(Person person)\n{\n // \u9a8c\u8bc1\u53c2\u6570\n if(string.IsNullOrEmty(person.Name))\n {\n throw new System.Exception("\u540d\u5b57\u4e0d\u80fd\u4e3a\u7a7a");\n }\n\n if(person.Age < 18)\n {\n throw new System.Exception("\u5e74\u9f84\u4e0d\u80fd\u5c0f\u4e8e 18 \u5c81");\n }\n\n if(!person.Password.Equals(person.ConfirmPassword)\n {\n throw new System.Exception("\u4e24\u6b21\u5bc6\u7801\u4e0d\u4e00\u81f4");\n }\n\n // \u4e1a\u52a1\u4ee3\u7801\n _repository.Insert(person.Adapt());\n\n // ...\n}\n')),Object(l.b)("p",null,"\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",Object(l.b)("strong",{parentName:"p"},"\u5305\u542b\u4e86\u592a\u591a\u4e0e\u4e1a\u52a1\u65e0\u5173\u7684\u6570\u636e\u9a8c\u8bc1"),"\u3002"),Object(l.b)("p",null,"\u8bd5\u60f3\u4e00\u4e0b\uff0c\u5982\u679c\u8fd9\u4e2a ",Object(l.b)("inlineCode",{parentName:"p"},"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"),Object(l.b)("p",null,"\u518d\u8005\uff0c\u5982\u679c\u5176\u4ed6\u5730\u65b9\u4e5f\u9700\u8981\u7528\u5230\u8fd9\u4e2a ",Object(l.b)("inlineCode",{parentName:"p"},"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"),Object(l.b)("p",null,"\u5982\u6b64\u5f97\u77e5\uff0c\u8fd9\u6837\u7684\u65b9\u5f0f\u662f\u6781\u5176\u4e0d\u63a8\u8350\u7684\uff0c",Object(l.b)("strong",{parentName:"p"},"\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"),Object(l.b)("h3",{id:"832-mvc-\u7279\u6027\u65b9\u5f0f"},"8.3.2 ",Object(l.b)("inlineCode",{parentName:"h3"},"Mvc")," \u7279\u6027\u65b9\u5f0f"),Object(l.b)("p",null,"\u5728 ",Object(l.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4e2d\uff0c\u5fae\u8f6f\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u5168\u65b0\u7684 ",Object(l.b)("inlineCode",{parentName:"p"},"\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"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u5728\u6a21\u578b\u4e2d\u9a8c\u8bc1"))),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,7-8,11-12}","{1,7-8,11-12}":!0}),"using System.ComponentModel.DataAnnotations;\n\nnamespace Hoa.Application.Authorization.Dtos\n{\n public class SignInInput\n {\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\n [MinLength(4)] // \u6700\u5c0f\u957f\u5ea6\u9a8c\u8bc1\n public string Account { get; set; }\n\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\n [MaxLength(32)] // \u6700\u5927\u957f\u5ea6\u9a8c\u8bc1\n public string Password { get; set; }\n }\n}\n")),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u5728\u53c2\u6570\u4e2d\u9a8c\u8bc1"))),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2-3,8-9,12-13}","{2-3,8-9,12-13}":!0}),'public void CheckMethodParameterValid(\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\n [MinLength(4)] // \u6700\u5c0f\u957f\u5ea6\u9a8c\u8bc1\n string name,\n\n int age,\n\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\n [RegularExpression("[a-zA-Z0-9_]{8,30}") // \u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\n string password,\n\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\n [RegularExpression("[a-zA-Z0-9_]{8,30}") // \u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\n string confirmPassword\n)\n{\n // TODO\n}\n')),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5c0f\u63d0\u9192")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\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"))),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u81ea\u5b9a\u4e49\u7279\u6027\u9a8c\u8bc1"))),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,13-24}","{1,13-24}":!0}),'public class ClassicMovieAttribute : ValidationAttribute\n{\n public ClassicMovieAttribute(int year)\n {\n Year = year;\n }\n\n public int Year { get; }\n\n public string GetErrorMessage() =>\n $"Classic movies must have a release year no later than {Year}.";\n\n protected override ValidationResult IsValid(object value, ValidationContext validationContext)\n {\n var movie = (Movie)validationContext.ObjectInstance;\n var releaseYear = ((DateTime)value).Year;\n\n if (movie.Genre == Genre.Classic && releaseYear > Year)\n {\n return new ValidationResult(GetErrorMessage());\n }\n\n return ValidationResult.Success;\n }\n}\n')),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},Object(l.b)("inlineCode",{parentName:"strong"},"IValidatableObject")," \u590d\u6742\u9a8c\u8bc1"))),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,3,10-19}","{1,3,10-19}":!0}),'using System.Collections.Generic;\n\npublic class DtoModel : IValidatableObject\n{\n [Required]\n [StringLength(100)]\n public string Title { get; set; }\n\n // \u4f60\u7684\u9a8c\u8bc1\u903b\u8f91\n public IEnumerable Validate(ValidationContext validationContext)\n {\n if (\u4f60\u7684\u903b\u8f91\u4ee3\u7801)\n {\n yield return new ValidationResult(\n "\u9519\u8bef\u6d88\u606f"\n ,new[] { nameof(Title) } // \u9a8c\u8bc1\u5931\u8d25\u7684\u5c5e\u6027\n );\n }\n }\n}\n')),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"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"),Object(l.b)("p",null,Object(l.b)("strong",{parentName:"p"},"\u4f46\u662f ",Object(l.b)("inlineCode",{parentName:"strong"},"Mvc")," \u7279\u6027\u9a8c\u8bc1\u65b9\u5f0f\u6709\u51e0\u4e2a\u660e\u663e\u7684\u7f3a\u70b9"),"\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u53ea\u80fd\u5728 ",Object(l.b)("inlineCode",{parentName:"li"},"\u63a7\u5236\u5668")," \u4e2d\u7684 ",Object(l.b)("inlineCode",{parentName:"li"},"Action"),"\uff08\u52a8\u4f5c\u65b9\u6cd5\uff09\u4e2d\u4f7f\u7528"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u65e0\u6cd5\u5728\u4efb\u610f\u7c7b\u3001\u4efb\u610f\u65b9\u6cd5\u4e2d\u4f7f\u7528")),Object(l.b)("li",{parentName:"ul"},"\u5185\u7f6e\u7684\u9a8c\u8bc1\u7c7b\u578b\u975e\u5e38\u6709\u9650\uff0c\u4e14\u4e0d\u6613\u62d3\u5c55"),Object(l.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u9a8c\u8bc1\u6d88\u606f\u540e\u671f\u914d\u7f6e")),Object(l.b)("p",null,"\u6240\u4ee5\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e86\u65b0\u7684\u9a8c\u8bc1\u5f15\u64ce ",Object(l.b)("inlineCode",{parentName:"p"},"DataValidation"),"\uff0c\u5728\u5b8c\u5168\u517c\u5bb9 ",Object(l.b)("inlineCode",{parentName:"p"},"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"),Object(l.b)("h2",{id:"84-datavalidation-\u9a8c\u8bc1-"},"8.4 ",Object(l.b)("inlineCode",{parentName:"h2"},"DataValidation")," \u9a8c\u8bc1 \ud83e\udd17"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"DataValidation")," \u662f ",Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u5168\u65b0\u7684\u9a8c\u8bc1\u65b9\u5f0f\uff0c\u5b8c\u5168\u517c\u5bb9 ",Object(l.b)("inlineCode",{parentName:"p"},"Mvc")," \u5185\u7f6e\u9a8c\u8bc1\uff0c\u5e76\u4e14\u8d4b\u4e88\u4e86\u8d85\u80fd\u3002"),Object(l.b)("h3",{id:"841-datavalidation-\u4f18\u70b9"},"8.4.1 ",Object(l.b)("inlineCode",{parentName:"h3"},"DataValidation")," \u4f18\u70b9"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u5b8c\u5168\u517c\u5bb9 ",Object(l.b)("inlineCode",{parentName:"strong"},"Mvc")," \u5185\u7f6e\u9a8c\u8bc1\u5f15\u64ce")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u5185\u7f6e\u5e38\u89c1\u9a8c\u8bc1\u7c7b\u578b\u53ca\u53ef\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b\u578b\u529f\u80fd")),Object(l.b)("li",{parentName:"ul"},"\u63d0\u4f9b\u5168\u5c40\u5bf9\u8c61\u62d3\u5c55\u9a8c\u8bc1\u65b9\u5f0f"),Object(l.b)("li",{parentName:"ul"},"\u652f\u6301\u9a8c\u8bc1\u6d88\u606f\u540e\u671f\u914d\u7f6e\uff0c\u652f\u6301\u5b9e\u65f6\u66f4\u65b0"),Object(l.b)("li",{parentName:"ul"},"\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"),Object(l.b)("li",{parentName:"ul"},"\u652f\u6301\u8bbe\u7f6e\u9a8c\u8bc1\u7ed3\u679c\u6a21\u578b")),Object(l.b)("h2",{id:"85-datavalidation-\u4f7f\u7528"},"8.5 ",Object(l.b)("inlineCode",{parentName:"h2"},"DataValidation")," \u4f7f\u7528"),Object(l.b)("h3",{id:"851-\u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1"},"8.5.1 \u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddControllers()\n .AddDataValidation();\n }\n }\n}\n")),Object(l.b)("div",{className:"admonition admonition-important alert alert--info"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},".AddDataValidation()")," \u9700\u5728 ",Object(l.b)("inlineCode",{parentName:"p"},"services.AddControllers()")," \u4e4b\u540e\u6ce8\u518c\u3002"))),Object(l.b)("h3",{id:"852-\u517c\u5bb9-mvc-\u7279\u6027\u9a8c\u8bc1"},"8.5.2 \u517c\u5bb9 ",Object(l.b)("inlineCode",{parentName:"h3"},"Mvc")," \u7279\u6027\u9a8c\u8bc1"),Object(l.b)(b.a,{defaultValue:"testdto",values:[{label:"TestDto",value:"testdto"},{label:"FurAppService",value:"furAppService"}],mdxType:"Tabs"},Object(l.b)(c.a,{value:"testdto",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,7,10}","{1,7,10}":!0}),'using System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Application\n{\n public class TestDto\n {\n [Range(10, 20, ErrorMessage = "Id \u53ea\u80fd\u5728 10-20 \u533a\u95f4\u53d6\u503c")]\n public int Id { get; set; }\n\n [Required(ErrorMessage = "\u5fc5\u586b"), MinLength(3, ErrorMessage = "\u5b57\u7b26\u4e32\u957f\u5ea6\u4e0d\u80fd\u5c11\u4e8e3\u4f4d")]\n public string Name { get; set; }\n }\n}\n'))),Object(l.b)(c.a,{value:"furAppService",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{12,22}","{12,22}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n /// \n /// \u503c\u7c7b\u578b\u9a8c\u8bc1\n /// \n /// \n /// \n public int Get(int id)\n {\n return id;\n }\n\n /// \n /// \u5bf9\u8c61\u7c7b\u578b\u9a8c\u8bc1\n /// \n /// \n /// \n public TestDto Post(TestDto testDto)\n {\n return testDto;\n }\n }\n}\n')))),Object(l.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("img",{src:Object(r.a)("img/sjyz1.gif")}),Object(l.b)("h3",{id:"853-\u517c\u5bb9-mvc-\u590d\u6742\u9a8c\u8bc1"},"8.5.3 \u517c\u5bb9 ",Object(l.b)("inlineCode",{parentName:"h3"},"Mvc")," \u590d\u6742\u9a8c\u8bc1"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,6,14-22}","{2,6,14-22}":!0}),'using System.Collections.Generic;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Application\n{\n public class TestDto : IValidatableObject\n {\n [Range(10, 20, ErrorMessage = "Id \u53ea\u80fd\u5728 10-20 \u533a\u95f4\u53d6\u503c")]\n public int Id { get; set; }\n\n [Required(ErrorMessage = "\u5fc5\u586b"), MinLength(3, ErrorMessage = "\u5b57\u7b26\u4e32\u957f\u5ea6\u4e0d\u80fd\u5c11\u4e8e3\u4f4d")]\n public string Name { get; set; }\n\n public IEnumerable Validate(ValidationContext validationContext)\n {\n if (Name.StartsWith("Fur"))\n {\n yield return new ValidationResult(\n "\u4e0d\u80fd\u4ee5 Fur \u5f00\u5934"\n , new[] { nameof(Name) }\n );\n }\n }\n }\n}\n')),Object(l.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("img",{src:Object(r.a)("img/sjyz2.gif")}),Object(l.b)("h2",{id:"86-\u624b\u52a8\u9a8c\u8bc1"},"8.6 \u624b\u52a8\u9a8c\u8bc1"),Object(l.b)("h3",{id:"871-\u9a8c\u8bc1\u6a21\u578b"},"8.7.1 \u9a8c\u8bc1\u6a21\u578b"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,11}","{1,11}":!0}),"using Fur.DataValidation;\nusing Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [NonValidation] // \u8df3\u8fc7\u5168\u5c40\u9a8c\u8bc1\n public DataValidationResult Post(TestDto testDto)\n {\n return testDto.TryValidate();\n }\n }\n}\n")),Object(l.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("img",{src:Object(r.a)("img/sjyz3.gif")}),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"note")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\u652f\u6301 ",Object(l.b)("strong",{parentName:"p"},Object(l.b)("inlineCode",{parentName:"strong"},"Mvc"))," \u5185\u7f6e\u7684\u7279\u6027\u9a8c\u8bc1\u3001\u5c5e\u6027\u9a8c\u8bc1\u53ca\u590d\u6742\u7684 ",Object(l.b)("strong",{parentName:"p"},Object(l.b)("inlineCode",{parentName:"strong"},"IValidatableObject"))," \u9a8c\u8bc1\u3002"))),Object(l.b)("h3",{id:"872-validationtypes-\u5e38\u89c1\u9a8c\u8bc1"},"8.7.2 ",Object(l.b)("inlineCode",{parentName:"h3"},"ValidationTypes")," \u5e38\u89c1\u9a8c\u8bc1"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u5185\u7f6e\u4e86\u5f88\u591a\u5e38\u7528\u7c7b\u578b\u7684\u6570\u636e\u9a8c\u8bc1\uff0c\u5305\u62ec\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Required"),"\uff1a\u975e\u7a7a\u3001\u975e Null \u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Numeric"),"\uff1a\u6570\u503c\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PositiveNumber"),"\uff1a\u6b63\u6570\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"NegativeNumber"),"\uff1a\u8d1f\u6570\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Integer"),"\uff1a\u6574\u6570\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Money"),"\uff1a\u91d1\u94b1\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Date"),"\uff1a\u65e5\u671f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Time"),"\uff1a\u65f6\u95f4\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IDCard"),"\uff1a\u8eab\u4efd\u8bc1\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PostCode"),"\uff1a\u90ae\u7f16\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PhoneNumber"),"\uff1a\u624b\u673a\u53f7\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Telephone"),"\uff1a\u56fa\u8bdd\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PhoneOrTelNumber"),"\uff1a\u624b\u673a\u6216\u56fa\u8bdd\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"EmailAddress"),"\uff1a\u90ae\u4ef6\u5730\u5740\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Url"),"\uff1a\u7f51\u5740\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Color"),"\uff1a\u989c\u8272\u503c\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Chinese"),"\uff1a\u4e2d\u6587\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IPv4"),"\uff1aIPv4 \u5730\u5740\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IPv6"),"\uff1aIPv6 \u5730\u5740\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Age"),"\uff1a\u5e74\u9f84\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"ChineseName"),"\uff1a\u4e2d\u6587\u540d\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"EnglishName"),"\uff1a\u82f1\u6587\u540d\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Capital"),"\uff1a\u7eaf\u5927\u5199\u82f1\u6587\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Lowercase"),"\uff1a\u7eaf\u5c0f\u5199\u82f1\u6587\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Ascii"),"\uff1aAscii \u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Md5"),"\uff1aMd5 \u5b57\u7b26\u4e32\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Zip"),"\uff1a\u538b\u7f29\u5305\u683c\u5f0f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Image"),"\uff1a\u56fe\u7247\u683c\u5f0f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Document"),"\uff1a\u6587\u6863\u683c\u5f0f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"MP3"),"\uff1aMp3 \u683c\u5f0f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Flash"),"\uff1aFlash \u683c\u5f0f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Video"),"\uff1a\u89c6\u9891\u6587\u4ef6\u683c\u5f0f\u7c7b\u578b")),Object(l.b)("p",null,Object(l.b)("strong",{parentName:"p"},"\u4f7f\u7528\u793a\u4f8b")),Object(l.b)(b.a,{defaultValue:"dglx",values:[{label:"\u5355\u4e2a\u7c7b\u578b\u9a8c\u8bc1",value:"dglx"},{label:"\u591a\u4e2a\u7ec4\u5408\u7c7b\u578b\u9a8c\u8bc1",value:"zhlx"}],mdxType:"Tabs"},Object(l.b)(c.a,{value:"dglx",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u9a8c\u8bc1\u5fc5\u586b\n"".TryValidate(ValidationTypes.Required); // => false\n\n// \u9a8c\u8bc1\u4e2d\u6587\n"\u6211\u53eb MonK".TryValidate(ValidationTypes.Chinese); // => false\n\n// \u9a8c\u8bc1\u6570\u503c\n2.TryValidate(ValidationTypes.Numeric); // => true\n\n// \u9a8c\u8bc1\u6574\u6570\ntrue.TryValidate(ValidationTypes.Integer); // => false\n\n// \u9a8c\u8bc1\u90ae\u7bb1\n"monksoul@outlook.com".TryValidate(ValidationTypes.EmailAddress); // => true\n\n// \u9a8c\u8bc1\u8d1f\u6570\n2.0m.TryValidate(ValidationTypes.NegativeNumber); // => false\n\n// \u81ea\u5b9a\u4e49\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\n"Fur".TryValidate("/^Fur$"); // => true\n'))),Object(l.b)(c.a,{value:"zhlx",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u9a8c\u8bc1\u6570\u503c\u7c7b\u578b\u4e14\u662f\u6574\u6570\n"20".TryValidate(ValidationTypes.Numeric, ValidationTypes.Integer); // => true\n\n// \u9a8c\u8bc1\u65f6\u65e5\u671f\u6216\u65f6\u95f4\u683c\u5f0f\n"2020-05-20".TryValidate(ValidationOptions.AtLeastOne, ValidationTypes.Date, ValidationTypes.Time); // => true\n"23:45:20".TryValidate(ValidationOptions.AtLeastOne, ValidationTypes.Date, ValidationTypes.Time); // => true\n\n')))),Object(l.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\u53ef\u901a\u8fc7\u8bbe\u7f6e ",Object(l.b)("inlineCode",{parentName:"p"},"TryValidate([ValidationOptions], params object[] validationTypes)")," \u65b9\u6cd5\u7684 ",Object(l.b)("inlineCode",{parentName:"p"},"ValidationOptions")," \u53c2\u6570\u914d\u7f6e\u9a8c\u8bc1\u903b\u8f91\uff0c\u5982\uff1a",Object(l.b)("strong",{parentName:"p"},Object(l.b)("inlineCode",{parentName:"strong"},"\u540c\u65f6\u6210\u7acb"))," \u6216 ",Object(l.b)("strong",{parentName:"p"},Object(l.b)("inlineCode",{parentName:"strong"},"\u53ea\u8981\u4e00\u4e2a\u6210\u7acb"))," \u5373\u53ef\u9a8c\u8bc1\u901a\u8fc7"))),Object(l.b)("h3",{id:"873-datavalidation-\u7279\u6027"},"8.7.3 ",Object(l.b)("inlineCode",{parentName:"h3"},"[DataValidation]")," \u7279\u6027"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u8fd8\u63d0\u4f9b\u4e86 ",Object(l.b)("inlineCode",{parentName:"p"},"[DataValidation]")," \u7279\u6027\u65b9\u4fbf\u5728\u6a21\u578b\u53c2\u6570\u4e2d\u4f7f\u7528 ",Object(l.b)("inlineCode",{parentName:"p"},"ValidationTypes")," \u5e38\u89c1\u9a8c\u8bc1\u6216\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u3002"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,7,10,14,17,20}","{1,7,10,14,17,20}":!0}),'using Fur.DataValidation;\n\nnamespace Fur.Application\n{\n public class TestDto\n {\n [DataValidation(ValidationTypes.Integer)]\n public int Id { get; set; }\n\n [DataValidation(ValidationTypes.Numeric, ValidationTypes.Integer)]\n public int Cost { get; set; }\n\n [DataValidation(ValidationOptions.AtLeastOne, ValidationTypes.Chinese, ValidationTypes.Date)]\n public string Name { get; set; }\n\n // \u53ef\u4ee5\u548cMvc\u7279\u6027\u5171\u5b58\n [Required, DataValidation(ValidationTypes.Age)]\n public int Age { get; set; }\n\n [DataValidation(ValidationTypes.IDCard, ErrorMessage = "\u81ea\u5b9a\u4e49\u8eab\u4efd\u8bc1\u63d0\u793a\u6d88\u606f")]\n public string IDCard { get; set; }\n }\n}\n')),Object(l.b)("h2",{id:"87-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1"},"8.7 ",Object(l.b)("inlineCode",{parentName:"h2"},"[NonValidation]")," \u8df3\u8fc7\u9a8c\u8bc1"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u5bf9\u8c61\u6a21\u578b\u8df3\u8fc7\u9a8c\u8bc1\u7279\u6027 ",Object(l.b)("inlineCode",{parentName:"p"},"[NonValidation]"),"\uff0c\u652f\u6301\u5728 ",Object(l.b)("inlineCode",{parentName:"p"},"\u63a7\u5236\u5668"),"\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"\u52a8\u4f5c\u65b9\u6cd5"),"\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"\u7c7b")," \u4e2d\u4f7f\u7528\u3002"),Object(l.b)("p",null,"\u4e00\u65e6\u8d34\u4e86\u6b64\u7279\u6027\uff0c\u90a3\u4e48\u5c06\u4e0d\u4f1a\u6267\u884c\u9a8c\u8bc1\u64cd\u4f5c\u3002"),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"note")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("strong",{parentName:"p"},Object(l.b)("inlineCode",{parentName:"strong"},"[NonValidation]"))," \u53ea\u5bf9\u5bf9\u8c61\u7c7b\u578b\u6709\u6548\uff0c\u503c\u7c7b\u578b\u65e0\u6548\u3002"))),Object(l.b)("h2",{id:"88-\u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c"},"8.8 \u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c"),Object(l.b)("h3",{id:"881-\u81ea\u5b9a\u4e49-validationtypes-\u7c7b\u578b"},"8.8.1 \u81ea\u5b9a\u4e49 ",Object(l.b)("inlineCode",{parentName:"h3"},"ValidationTypes")," \u7c7b\u578b"),Object(l.b)("p",null,"\u9664\u4e86 ",Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u5185\u7f6e\u7684\u9a8c\u8bc1\u7c7b\u578b\u4ee5\u5916\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u8fd8\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b\u578b\u673a\u5236\u3002"),Object(l.b)("p",null,"\u5b9e\u73b0\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b\u578b\u5fc5\u987b\u9075\u5faa\u4ee5\u4e0b\u914d\u7f6e\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u9a8c\u8bc1\u7c7b\u578b\u5fc5\u987b\u65f6\u516c\u5f00\u4e14\u65f6 ",Object(l.b)("inlineCode",{parentName:"li"},"Enum")," \u679a\u4e3e\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},"\u679a\u4e3e\u7c7b\u578b\u5fc5\u987b\u8d34\u6709 ",Object(l.b)("inlineCode",{parentName:"li"},"[ValidationType]")," \u7279\u6027"),Object(l.b)("li",{parentName:"ul"},"\u679a\u4e3e\u4e2d\u6bcf\u4e00\u9879\u5fc5\u987b\u8d34\u6709 ",Object(l.b)("inlineCode",{parentName:"li"},"[ValidationItemMetadata]")," \u7279\u6027")),Object(l.b)("p",null,Object(l.b)("strong",{parentName:"p"},"\u5982"),"\uff1a"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,12,18}","{1,6,12,18}":!0}),'using Fur.DataValidation;\nusing System.Text.RegularExpressions;\n\nnamespace Fur.Application\n{\n [ValidationType]\n public enum MyValidationTypes\n {\n /// \n /// \u5f3a\u5bc6\u7801\u7c7b\u578b\n /// \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")]\n StrongPassword,\n\n /// \n /// \u4ee5 Fur \u5b57\u7b26\u4e32\u5f00\u5934\uff0c\u5ffd\u7565\u5927\u5c0f\u5199\n /// \n [ValidationItemMetadata(@"^(fur).*", "\u9ed8\u8ba4\u63d0\u793a\uff1a\u5fc5\u987b\u4ee5Fur\u5b57\u7b26\u4e32\u5f00\u5934\uff0c\u5ffd\u7565\u5927\u5c0f\u5199", RegexOptions.IgnoreCase)]\n StartWithFurString\n }\n}\n\n')),Object(l.b)("p",null,Object(l.b)("strong",{parentName:"p"},"\u4f7f\u7528")),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u624b\u52a8\u4f7f\u7528")),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'"q1w2e3".TryValidate(MyValidationTypes.StrongPassword); // => false\n\n"furos".TryValidate(MyValidationTypes.StartWithFurString); // => true\n')),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"[DataValidation]")," \u4e2d\u4f7f\u7528")),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"[DataValidation(MyValidationTypes.StrongPassword)]\npublic string Password { get; set; }\n")),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u591a\u4e2a\u81ea\u5b9a\u4e49\u7c7b\u578b\u6df7\u7528")),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'"Q1w2e3r4t5!*".TryValidate(MyValidationTypes.StrongPassword, ValidationTypes.Required); // => true\n')),Object(l.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\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"))),Object(l.b)("h3",{id:"882-\u81ea\u5b9a\u4e49-validationtypes-\u5931\u8d25\u6d88\u606f"},"8.8.2 \u81ea\u5b9a\u4e49 ",Object(l.b)("inlineCode",{parentName:"h3"},"ValidationTypes")," \u5931\u8d25\u6d88\u606f"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u5185\u7f6e\u7684 ",Object(l.b)("inlineCode",{parentName:"p"},"ValidationTypes")," \u5df2\u6709\u9ed8\u8ba4\u7684\u5931\u8d25\u6d88\u606f\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Required"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is required.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Numeric"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a numeric type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PositiveNumber"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a positive number type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"NegativeNumber"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a negative number type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Integer"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a integer type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Money"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a money type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Date"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a date type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Time"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a time type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IDCard"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a idcard type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PostCode"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a postcode type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PhoneNumber"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a phone number type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Telephone"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a telephone type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PhoneOrTelNumber"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a phone number or telephone type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"EmailAddress"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a email address type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Url"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a url address type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Color"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a color type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Chinese"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a chinese type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IPv4"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a IPv4 type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IPv6"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a IPv6 type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Age"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a age type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"ChineseName"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a chinese name type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"EnglishName"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a english name type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Capital"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a capital type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Lowercase"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a lowercase type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Ascii"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a ascii type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Md5"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a md5 type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Zip"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a zip type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Image"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a image type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Document"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a document type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"MP3"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a mp3 type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Flash"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a flash type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Video"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a video type."))),Object(l.b)("p",null,"\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u521b\u5efa\u7ee7\u627f ",Object(l.b)("inlineCode",{parentName:"p"},"IValidationMessageTypeProvider")," \u9a8c\u8bc1\u6d88\u606f\u63d0\u4f9b\u5668\u7c7b\u578b\uff0c\u6216\u901a\u8fc7 ",Object(l.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u914d\u7f6e\u3002"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},Object(l.b)("inlineCode",{parentName:"strong"},"[ValidationMessageType]"))," \u65b9\u5f0f")),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,9,12,15,19,22}","{5,9,12,15,19,22}":!0}),'using Fur.DataValidation;\n\nnamespace Fur.Application\n{\n [ValidationMessageType]\n public enum MyValidationMessageType\n {\n // \u4fee\u6539\u5185\u7f6e\u9a8c\u8bc1\u7c7b\u578b\u9a8c\u8bc1\u5931\u8d25\u6d88\u606f\n [ValidationMessage("\u503c\u4e0d\u80fd\u4e3a\u7a7a\u6216Null")]\n Required,\n\n [ValidationMessage("\u5fc5\u987b\u662f\u6570\u503c\u7c7b\u578b")]\n Numeric,\n\n [ValidationMessage("\u5fc5\u987b\u662f\u6b63\u6570")]\n PositiveNumber,\n\n // \u4fee\u6539\u81ea\u5b9a\u4e49\u7c7b\u578b\u9a8c\u8bc1\u5931\u8d25\u6d88\u606f\n [ValidationMessage("\u5bc6\u7801\u592a\u7b80\u5355\u4e86")]\n StrongPassword,\n\n [ValidationMessage("\u5fc5\u987b\u4ee5 Fur \u5f00\u5934")]\n StartWithFurString\n }\n}\n')),Object(l.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\u9664\u4e86\u8d34 ",Object(l.b)("inlineCode",{parentName:"p"},"[ValidationMessageType]")," \u7279\u6027\u5916\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u8fd8\u63d0\u4f9b\u4e86 ",Object(l.b)("inlineCode",{parentName:"p"},"IValidationMessageTypeProvider")," \u65b9\u5f0f\u67e5\u627e\u9a8c\u8bc1\u6d88\u606f\u7c7b\u578b\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("pre",{parentName:"div"},Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,8-12}","{1,6,8-12}":!0}),"using Fur.DataValidation;\nusing System;\n\nnamespace Fur.Application\n{\n public class MyValidationTypeMessageProvider : IValidationMessageTypeProvider\n {\n public Type[] Definitions => new[]\n {\n typeof(MyValidationMessageType),\n typeof(MyValidationMessageType2)\n };\n }\n}\n")),Object(l.b)("p",{parentName:"div"},"\u6ce8\u518c\u9a8c\u8bc1\u6d88\u606f\u63d0\u4f9b\u5668"),Object(l.b)("pre",{parentName:"div"},Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddControllers()\n .AddDataValidation();\n }\n }\n}\n")))),Object(l.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("img",{src:Object(r.a)("img/sjyz4.png")}),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},Object(l.b)("inlineCode",{parentName:"strong"},"appsettings.json")," \u65b9\u5f0f"))),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-11} title="Fur.Web.Entry/appsettings.json"',"{2-11}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "ValidationTypeMessageSettings": {\n "Definitions": [\n ["Required", "\u503c\u4e0d\u80fd\u4e3a\u7a7a\u6216Null"],\n ["Numeric", "\u5fc5\u987b\u662f\u6570\u503c\u7c7b\u578b"],\n\n ["StrongPassword", "\u5bc6\u7801\u592a\u7b80\u5355\u4e86!!!"]\n ]\n }\n }\n}\n')),Object(l.b)("div",{className:"admonition admonition-important alert alert--info"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"important")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u76f8\u540c\u7684 ",Object(l.b)("inlineCode",{parentName:"p"},"Key")," \u6216\u8986\u76d6 ",Object(l.b)("inlineCode",{parentName:"p"},"IValidationMessageTypeProvider")," \u63d0\u4f9b\u76f8\u540c ",Object(l.b)("inlineCode",{parentName:"p"},"Key")," \u7684\u503c\u3002"))),Object(l.b)("h4",{id:"\u9519\u8bef\u6d88\u606f\u67e5\u627e\u4f18\u5148\u7ea7"},"\u9519\u8bef\u6d88\u606f\u67e5\u627e\u4f18\u5148\u7ea7"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"DefaultErrorMessage")," -> ",Object(l.b)("inlineCode",{parentName:"p"},"IValidationMessageTypeProvider")," -> ",Object(l.b)("inlineCode",{parentName:"p"},"appsettings.json")," (",Object(l.b)("strong",{parentName:"p"},"\u4f4e -> \u9ad8"),")"),Object(l.b)("h2",{id:"89-\u6a21\u578b\u9a8c\u8bc1\u8303\u56f4"},"8.9 \u6a21\u578b\u9a8c\u8bc1\u8303\u56f4"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u591a\u79cd\u6a21\u578b\u9a8c\u8bc1\u8303\u56f4\u8bbe\u7f6e\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u5168\u5c40\u9a8c\u8bc1\uff08\u9ed8\u8ba4\uff09"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"[NonValidation]")," \u8df3\u8fc7\u9a8c\u8bc1"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"[TypeFilter(typeof(DataValidationFilter))]")," \u5c40\u90e8\u9a8c\u8bc1"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"[ApiController]")," \u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1")),Object(l.b)("h3",{id:"891-\u5168\u5c40\u9a8c\u8bc1"},"8.9.1 \u5168\u5c40\u9a8c\u8bc1"),Object(l.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u901a\u8fc7 ",Object(l.b)("inlineCode",{parentName:"p"},".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 ",Object(l.b)("inlineCode",{parentName:"p"},"false")," \u5373\u53ef\uff0c\u5982\uff1a",Object(l.b)("inlineCode",{parentName:"p"},".AddDataValidation(false)"),"\u3002"),Object(l.b)("h3",{id:"892-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1"},"8.9.2 ",Object(l.b)("inlineCode",{parentName:"h3"},"[NonValidation]")," \u8df3\u8fc7\u9a8c\u8bc1"),Object(l.b)("p",null,"\u53ef\u901a\u8fc7 ",Object(l.b)("inlineCode",{parentName:"p"},"[NonValidation]")," \u8d34\u5728 ",Object(l.b)("inlineCode",{parentName:"p"},"\u63a7\u5236\u5668"),"\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"\u52a8\u4f5c\u65b9\u6cd5"),"\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"\u7c7b")," \u4e2d\u8df3\u8fc7\u5168\u5c40\u9a8c\u8bc1\u6216\u4e0d\u9700\u8981\u9a8c\u8bc1"),Object(l.b)("h3",{id:"893-typefiltertypeofdatavalidationfilter-\u5c40\u90e8\u9a8c\u8bc1"},"8.9.3 ",Object(l.b)("inlineCode",{parentName:"h3"},"[TypeFilter(typeof(DataValidationFilter))]")," \u5c40\u90e8\u9a8c\u8bc1"),Object(l.b)("p",null,"\u6211\u4eec\u4e5f\u53ef\u4ee5\u65e0\u9700\u6ce8\u518c ",Object(l.b)("inlineCode",{parentName:"p"},".AddDataValidation()")," \u670d\u52a1\uff0c\u76f4\u63a5\u5728 ",Object(l.b)("inlineCode",{parentName:"p"},"\u52a8\u4f5c\u65b9\u6cd5")," \u4e0a\u8d34 ",Object(l.b)("inlineCode",{parentName:"p"},"[TypeFilter(typeof(DataValidationFilter))]")," \u53ef\u542f\u7528\u5c40\u90e8\u9a8c\u8bc1\u3002\u5982\uff1a"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,3,9}","{1,3,9}":!0}),"using Fur.DataValidation;\nusing Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [TypeFilter(typeof(DataValidationFilter))]\n public TestDto Post(TestDto testDto)\n {\n return testDto;\n }\n }\n}\n")),Object(l.b)("h3",{id:"894-apicontroller-\u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1"},"8.9.4 ",Object(l.b)("inlineCode",{parentName:"h3"},"[ApiController]")," \u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"[ApiController]")," \u662f ",Object(l.b)("inlineCode",{parentName:"p"},"Mvc")," \u63d0\u4f9b\u7684\u63a7\u5236\u5668\u8303\u56f4\uff08\u542b\u6240\u6709\u52a8\u4f5c\u65b9\u6cd5\uff09\u7684\u9a8c\u8bc1\u3002"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5}","{1,5}":!0}),"using Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [ApiController]\n public class MvcController : Controller\n {\n public IActionResult Index()\n {\n return View();\n }\n }\n}\n")),Object(l.b)("h2",{id:"810-miniprofiler-\u67e5\u770b"},"8.10 ",Object(l.b)("inlineCode",{parentName:"h2"},"MiniProfiler")," \u67e5\u770b"),Object(l.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("img",{src:Object(r.a)("img/sjyz5.png")}),Object(l.b)("h2",{id:"810-\u591a\u8bed\u8a00\u652f\u6301"},"8.10 \u591a\u8bed\u8a00\u652f\u6301"),Object(l.b)("p",null,"\u6587\u6863\u6574\u7406\u4e2d..."),Object(l.b)("h2",{id:"811-\u9a8c\u8bc1\u6a21\u578b\u63d0\u4f9b\u5668"},"8.11 \u9a8c\u8bc1\u6a21\u578b\u63d0\u4f9b\u5668"),Object(l.b)("p",null,"\u6587\u6863\u6574\u7406\u4e2d..."),Object(l.b)("h2",{id:"812-\u53cd\u9988\u4e0e\u5efa\u8bae"},"8.12 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(l.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/17256d0f.ea03f6fb.js b/docs/17256d0f.ea03f6fb.js new file mode 100644 index 00000000000..efe541f2762 --- /dev/null +++ b/docs/17256d0f.ea03f6fb.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return u}));var a=n(0),i=n.n(a);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function b(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var o=i.a.createContext({}),p=function(e){var t=i.a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):b(b({},t),e)),n},s=function(e){var t=p(e.components);return i.a.createElement(o.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.a.createElement(i.a.Fragment,{},t)}},m=i.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,r=e.parentName,o=c(e,["components","mdxType","originalType","parentName"]),s=p(n),m=a,u=s["".concat(r,".").concat(m)]||s[m]||d[m]||l;return n?i.a.createElement(u,b(b({ref:t},o),{},{components:n})):i.a.createElement(u,b({ref:t},o))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,r=new Array(l);r[0]=m;var b={};for(var c in t)hasOwnProperty.call(t,c)&&(b[c]=t[c]);b.originalType=e,b.mdxType="string"==typeof e?e:a,r[1]=b;for(var o=2;ofunction(e,t,n,{forcePrependBaseUrl:a=!1,absolute:l=!1}={}){if(!n)return n;if(n.startsWith("#"))return n;if(Object(i.b)(n))return n;if(a)return t+n;const r=n.startsWith(t)?n:t+n.replace(/^\//,"");return l?e+r:r}(t,e,n,a)}}function r(e,t={}){const{withBaseUrl:n}=l();return n(e,t)}},145:function(e,t,n){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function i(e){return void 0!==e&&!a(e)}n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return i}))},146:function(e,t,n){"use strict";function a(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;tt.value===e)&&j(e)}const v=e=>{j(e),null!=d&&u(d,e)},h=[],C=e=>{e.metaKey||e.altKey||e.ctrlKey||g(!0)},y=()=>{g(!1)};return Object(a.useEffect)(()=>{window.addEventListener("keydown",C),window.addEventListener("mousedown",y)},[]),i.a.createElement("div",null,i.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(r.a)("tabs",{"tabs--block":t})},s.map(({value:e,label:t})=>i.a.createElement("li",{role:"tab",tabIndex:0,"aria-selected":O===e,className:Object(r.a)("tabs__item",c.a.tabItem,{"tabs__item--active":O===e}),style:N?{}:{outline:"none"},key:e,ref:e=>h.push(e),onKeyDown:e=>{((e,t,n)=>{switch(n.keyCode){case p:((e,t)=>{const n=e.indexOf(t)+1;e[n]?e[n].focus():e[0].focus()})(e,t);break;case o:((e,t)=>{const n=e.indexOf(t)-1;e[n]?e[n].focus():e[e.length-1].focus()})(e,t)}})(h,e.target,e),C(e)},onFocus:()=>v(e),onClick:()=>{v(e),g(!1)},onPointerDown:()=>g(!1)},t))),i.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(n).filter(e=>e.props.value===O)[0]))}},150:function(e,t,n){"use strict";var a=n(0),i=n.n(a);t.a=function(e){return i.a.createElement("div",null,e.children)}},61:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return o})),n.d(t,"metadata",(function(){return p})),n.d(t,"rightToc",(function(){return s})),n.d(t,"default",(function(){return m}));var a=n(2),i=n(6),l=(n(0),n(142)),r=n(144),b=n(149),c=n(150),o={id:"data-validation",title:"8. \u6570\u636e\u6821\u9a8c",sidebar_label:"8. \u6570\u636e\u6821\u9a8c"},p={unversionedId:"data-validation",id:"data-validation",isDocsHomePage:!1,title:"8. \u6570\u636e\u6821\u9a8c",description:"8.1 \u5173\u4e8e\u6570\u636e\u6821\u9a8c",source:"@site/docs\\data-validation.mdx",slug:"/data-validation",permalink:"/docs/data-validation",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/data-validation.mdx",version:"current",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.1 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",permalink:"/docs/dbcontext"}},s=[{value:"8.1 \u5173\u4e8e\u6570\u636e\u6821\u9a8c",id:"81-\u5173\u4e8e\u6570\u636e\u6821\u9a8c",children:[]},{value:"8.2 \u6570\u636e\u6821\u9a8c\u7684\u597d\u5904",id:"82-\u6570\u636e\u6821\u9a8c\u7684\u597d\u5904",children:[]},{value:"8.3 \u6570\u636e\u6821\u9a8c\u65b9\u5f0f",id:"83-\u6570\u636e\u6821\u9a8c\u65b9\u5f0f",children:[{value:"8.3.1 \u4f20\u7edf\u65b9\u5f0f",id:"831-\u4f20\u7edf\u65b9\u5f0f",children:[]},{value:"8.3.2 Mvc \u7279\u6027\u65b9\u5f0f",id:"832-mvc-\u7279\u6027\u65b9\u5f0f",children:[]}]},{value:"8.4 DataValidation \u9a8c\u8bc1 \ud83e\udd17",id:"84-datavalidation-\u9a8c\u8bc1-",children:[{value:"8.4.1 DataValidation \u4f18\u70b9",id:"841-datavalidation-\u4f18\u70b9",children:[]}]},{value:"8.5 DataValidation \u4f7f\u7528",id:"85-datavalidation-\u4f7f\u7528",children:[{value:"8.5.1 \u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1",id:"851-\u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1",children:[]},{value:"8.5.2 \u517c\u5bb9 Mvc \u7279\u6027\u9a8c\u8bc1",id:"852-\u517c\u5bb9-mvc-\u7279\u6027\u9a8c\u8bc1",children:[]},{value:"8.5.3 \u517c\u5bb9 Mvc \u590d\u6742\u9a8c\u8bc1",id:"853-\u517c\u5bb9-mvc-\u590d\u6742\u9a8c\u8bc1",children:[]}]},{value:"8.6 \u624b\u52a8\u9a8c\u8bc1",id:"86-\u624b\u52a8\u9a8c\u8bc1",children:[{value:"8.7.1 \u9a8c\u8bc1\u6a21\u578b",id:"871-\u9a8c\u8bc1\u6a21\u578b",children:[]},{value:"8.7.2 ValidationTypes \u5e38\u89c1\u9a8c\u8bc1",id:"872-validationtypes-\u5e38\u89c1\u9a8c\u8bc1",children:[]},{value:"8.7.3 [DataValidation] \u7279\u6027",id:"873-datavalidation-\u7279\u6027",children:[]}]},{value:"8.7 [NonValidation] \u8df3\u8fc7\u9a8c\u8bc1",id:"87-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1",children:[]},{value:"8.8 \u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c",id:"88-\u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c",children:[{value:"8.8.1 \u81ea\u5b9a\u4e49 ValidationTypes \u7c7b\u578b",id:"881-\u81ea\u5b9a\u4e49-validationtypes-\u7c7b\u578b",children:[]},{value:"8.8.2 \u81ea\u5b9a\u4e49 ValidationTypes \u5931\u8d25\u6d88\u606f",id:"882-\u81ea\u5b9a\u4e49-validationtypes-\u5931\u8d25\u6d88\u606f",children:[]}]},{value:"8.9 \u6a21\u578b\u9a8c\u8bc1\u8303\u56f4",id:"89-\u6a21\u578b\u9a8c\u8bc1\u8303\u56f4",children:[{value:"8.9.1 \u5168\u5c40\u9a8c\u8bc1",id:"891-\u5168\u5c40\u9a8c\u8bc1",children:[]},{value:"8.9.2 [NonValidation] \u8df3\u8fc7\u9a8c\u8bc1",id:"892-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1",children:[]},{value:"8.9.3 [TypeFilter(typeof(DataValidationFilter))] \u5c40\u90e8\u9a8c\u8bc1",id:"893-typefiltertypeofdatavalidationfilter-\u5c40\u90e8\u9a8c\u8bc1",children:[]},{value:"8.9.4 [ApiController] \u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1",id:"894-apicontroller-\u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1",children:[]}]},{value:"8.10 MiniProfiler \u67e5\u770b",id:"810-miniprofiler-\u67e5\u770b",children:[]},{value:"8.10 \u591a\u8bed\u8a00\u652f\u6301",id:"810-\u591a\u8bed\u8a00\u652f\u6301",children:[]},{value:"8.11 \u9a8c\u8bc1\u6a21\u578b\u63d0\u4f9b\u5668",id:"811-\u9a8c\u8bc1\u6a21\u578b\u63d0\u4f9b\u5668",children:[]},{value:"8.12 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"812-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],d={rightToc:s};function m(e){var t=e.components,n=Object(i.a)(e,["components"]);return Object(l.b)("wrapper",Object(a.a)({},d,n,{components:t,mdxType:"MDXLayout"}),Object(l.b)("h2",{id:"81-\u5173\u4e8e\u6570\u636e\u6821\u9a8c"},"8.1 \u5173\u4e8e\u6570\u636e\u6821\u9a8c"),Object(l.b)("p",null,"\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"),Object(l.b)("h2",{id:"82-\u6570\u636e\u6821\u9a8c\u7684\u597d\u5904"},"8.2 \u6570\u636e\u6821\u9a8c\u7684\u597d\u5904"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u8fc7\u6ee4\u4e0d\u5b89\u5168\u6570\u636e\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u5b89\u5168\u6027"),Object(l.b)("li",{parentName:"ul"},"\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u4e1a\u52a1\u5f02\u5e38\u5904\u7406\uff0c\u63d0\u9ad8\u7cfb\u7edf\u7684\u54cd\u5e94\u901f\u5ea6"),Object(l.b)("li",{parentName:"ul"},"\u5927\u5927\u63d0\u9ad8\u7cfb\u7edf\u7a33\u5b9a\u6027"),Object(l.b)("li",{parentName:"ul"},"\u5927\u6570\u636e\u5e76\u53d1\u65f6\u8d77\u7740\u4e00\u5b9a\u7684\u7f13\u51b2\u4f5c\u7528")),Object(l.b)("h2",{id:"83-\u6570\u636e\u6821\u9a8c\u65b9\u5f0f"},"8.3 \u6570\u636e\u6821\u9a8c\u65b9\u5f0f"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u4f20\u7edf\u65b9\u5f0f\uff0c\u5728\u4e1a\u52a1\u4ee3\u7801\u4e4b\u524d\u624b\u52a8\u9a8c\u8bc1"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Mvc")," \u7279\u6027\u65b9\u5f0f\uff0c",Object(l.b)("inlineCode",{parentName:"li"},"Mvc")," \u5185\u7f6e\u7684 ",Object(l.b)("inlineCode",{parentName:"li"},"DataAnnotations")," \u65b9\u5f0f"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u63a8\u8350\u65b9\u5f0f"),"\uff0c",Object(l.b)("inlineCode",{parentName:"li"},"Fur")," \u6846\u67b6\u5185\u7f6e\u7684 ",Object(l.b)("inlineCode",{parentName:"li"},"DataValidation")," \u9a8c\u8bc1"),Object(l.b)("li",{parentName:"ul"},"\u5176\u4ed6\u65b9\u5f0f\uff0c\u4f7f\u7528\u7b2c\u4e09\u65b9\u9a8c\u8bc1\u5e93\uff0c\u5982 ",Object(l.b)("inlineCode",{parentName:"li"},"FluentValidation"))),Object(l.b)("h3",{id:"831-\u4f20\u7edf\u65b9\u5f0f"},"8.3.1 \u4f20\u7edf\u65b9\u5f0f"),Object(l.b)("p",null,"\u5728\u5f88\u591a\u8001\u9879\u76ee\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u770b\u5230\u8fd9\u6837\u7684\u4ee3\u7801\uff1a"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{4,9,14}","{4,9,14}":!0}),'public bool Insert(Person person)\n{\n // \u9a8c\u8bc1\u53c2\u6570\n if(string.IsNullOrEmty(person.Name))\n {\n throw new System.Exception("\u540d\u5b57\u4e0d\u80fd\u4e3a\u7a7a");\n }\n\n if(person.Age < 18)\n {\n throw new System.Exception("\u5e74\u9f84\u4e0d\u80fd\u5c0f\u4e8e 18 \u5c81");\n }\n\n if(!person.Password.Equals(person.ConfirmPassword)\n {\n throw new System.Exception("\u4e24\u6b21\u5bc6\u7801\u4e0d\u4e00\u81f4");\n }\n\n // \u4e1a\u52a1\u4ee3\u7801\n _repository.Insert(person.Adapt());\n\n // ...\n}\n')),Object(l.b)("p",null,"\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",Object(l.b)("strong",{parentName:"p"},"\u5305\u542b\u4e86\u592a\u591a\u4e0e\u4e1a\u52a1\u65e0\u5173\u7684\u6570\u636e\u9a8c\u8bc1"),"\u3002"),Object(l.b)("p",null,"\u8bd5\u60f3\u4e00\u4e0b\uff0c\u5982\u679c\u8fd9\u4e2a ",Object(l.b)("inlineCode",{parentName:"p"},"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"),Object(l.b)("p",null,"\u518d\u8005\uff0c\u5982\u679c\u5176\u4ed6\u5730\u65b9\u4e5f\u9700\u8981\u7528\u5230\u8fd9\u4e2a ",Object(l.b)("inlineCode",{parentName:"p"},"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"),Object(l.b)("p",null,"\u5982\u6b64\u5f97\u77e5\uff0c\u8fd9\u6837\u7684\u65b9\u5f0f\u662f\u6781\u5176\u4e0d\u63a8\u8350\u7684\uff0c",Object(l.b)("strong",{parentName:"p"},"\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"),Object(l.b)("h3",{id:"832-mvc-\u7279\u6027\u65b9\u5f0f"},"8.3.2 ",Object(l.b)("inlineCode",{parentName:"h3"},"Mvc")," \u7279\u6027\u65b9\u5f0f"),Object(l.b)("p",null,"\u5728 ",Object(l.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4e2d\uff0c\u5fae\u8f6f\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u5168\u65b0\u7684 ",Object(l.b)("inlineCode",{parentName:"p"},"\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"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u5728\u6a21\u578b\u4e2d\u9a8c\u8bc1"))),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,7-8,11-12}","{1,7-8,11-12}":!0}),"using System.ComponentModel.DataAnnotations;\n\nnamespace Hoa.Application.Authorization.Dtos\n{\n public class SignInInput\n {\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\n [MinLength(4)] // \u6700\u5c0f\u957f\u5ea6\u9a8c\u8bc1\n public string Account { get; set; }\n\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\n [MaxLength(32)] // \u6700\u5927\u957f\u5ea6\u9a8c\u8bc1\n public string Password { get; set; }\n }\n}\n")),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u5728\u53c2\u6570\u4e2d\u9a8c\u8bc1"))),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2-3,8-9,12-13}","{2-3,8-9,12-13}":!0}),'public void CheckMethodParameterValid(\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\n [MinLength(4)] // \u6700\u5c0f\u957f\u5ea6\u9a8c\u8bc1\n string name,\n\n int age,\n\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\n [RegularExpression("[a-zA-Z0-9_]{8,30}") // \u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\n string password,\n\n [Required] // \u5fc5\u586b\u9a8c\u8bc1\n [RegularExpression("[a-zA-Z0-9_]{8,30}") // \u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\n string confirmPassword\n)\n{\n // TODO\n}\n')),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5c0f\u63d0\u9192")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\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"))),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u81ea\u5b9a\u4e49\u7279\u6027\u9a8c\u8bc1"))),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,13-24}","{1,13-24}":!0}),'public class ClassicMovieAttribute : ValidationAttribute\n{\n public ClassicMovieAttribute(int year)\n {\n Year = year;\n }\n\n public int Year { get; }\n\n public string GetErrorMessage() =>\n $"Classic movies must have a release year no later than {Year}.";\n\n protected override ValidationResult IsValid(object value, ValidationContext validationContext)\n {\n var movie = (Movie)validationContext.ObjectInstance;\n var releaseYear = ((DateTime)value).Year;\n\n if (movie.Genre == Genre.Classic && releaseYear > Year)\n {\n return new ValidationResult(GetErrorMessage());\n }\n\n return ValidationResult.Success;\n }\n}\n')),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},Object(l.b)("inlineCode",{parentName:"strong"},"IValidatableObject")," \u590d\u6742\u9a8c\u8bc1"))),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,3,10-19}","{1,3,10-19}":!0}),'using System.Collections.Generic;\n\npublic class DtoModel : IValidatableObject\n{\n [Required]\n [StringLength(100)]\n public string Title { get; set; }\n\n // \u4f60\u7684\u9a8c\u8bc1\u903b\u8f91\n public IEnumerable Validate(ValidationContext validationContext)\n {\n if (\u4f60\u7684\u903b\u8f91\u4ee3\u7801)\n {\n yield return new ValidationResult(\n "\u9519\u8bef\u6d88\u606f"\n ,new[] { nameof(Title) } // \u9a8c\u8bc1\u5931\u8d25\u7684\u5c5e\u6027\n );\n }\n }\n}\n')),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"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"),Object(l.b)("p",null,Object(l.b)("strong",{parentName:"p"},"\u4f46\u662f ",Object(l.b)("inlineCode",{parentName:"strong"},"Mvc")," \u7279\u6027\u9a8c\u8bc1\u65b9\u5f0f\u6709\u51e0\u4e2a\u660e\u663e\u7684\u7f3a\u70b9"),"\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u53ea\u80fd\u5728 ",Object(l.b)("inlineCode",{parentName:"li"},"\u63a7\u5236\u5668")," \u4e2d\u7684 ",Object(l.b)("inlineCode",{parentName:"li"},"Action"),"\uff08\u52a8\u4f5c\u65b9\u6cd5\uff09\u4e2d\u4f7f\u7528"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u65e0\u6cd5\u5728\u4efb\u610f\u7c7b\u3001\u4efb\u610f\u65b9\u6cd5\u4e2d\u4f7f\u7528")),Object(l.b)("li",{parentName:"ul"},"\u5185\u7f6e\u7684\u9a8c\u8bc1\u7c7b\u578b\u975e\u5e38\u6709\u9650\uff0c\u4e14\u4e0d\u6613\u62d3\u5c55"),Object(l.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u9a8c\u8bc1\u6d88\u606f\u540e\u671f\u914d\u7f6e")),Object(l.b)("p",null,"\u6240\u4ee5\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e86\u65b0\u7684\u9a8c\u8bc1\u5f15\u64ce ",Object(l.b)("inlineCode",{parentName:"p"},"DataValidation"),"\uff0c\u5728\u5b8c\u5168\u517c\u5bb9 ",Object(l.b)("inlineCode",{parentName:"p"},"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"),Object(l.b)("h2",{id:"84-datavalidation-\u9a8c\u8bc1-"},"8.4 ",Object(l.b)("inlineCode",{parentName:"h2"},"DataValidation")," \u9a8c\u8bc1 \ud83e\udd17"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"DataValidation")," \u662f ",Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u5168\u65b0\u7684\u9a8c\u8bc1\u65b9\u5f0f\uff0c\u5b8c\u5168\u517c\u5bb9 ",Object(l.b)("inlineCode",{parentName:"p"},"Mvc")," \u5185\u7f6e\u9a8c\u8bc1\uff0c\u5e76\u4e14\u8d4b\u4e88\u4e86\u8d85\u80fd\u3002"),Object(l.b)("h3",{id:"841-datavalidation-\u4f18\u70b9"},"8.4.1 ",Object(l.b)("inlineCode",{parentName:"h3"},"DataValidation")," \u4f18\u70b9"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u5b8c\u5168\u517c\u5bb9 ",Object(l.b)("inlineCode",{parentName:"strong"},"Mvc")," \u5185\u7f6e\u9a8c\u8bc1\u5f15\u64ce")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},"\u5185\u7f6e\u5e38\u89c1\u9a8c\u8bc1\u7c7b\u578b\u53ca\u53ef\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b\u578b\u529f\u80fd")),Object(l.b)("li",{parentName:"ul"},"\u63d0\u4f9b\u5168\u5c40\u5bf9\u8c61\u62d3\u5c55\u9a8c\u8bc1\u65b9\u5f0f"),Object(l.b)("li",{parentName:"ul"},"\u652f\u6301\u9a8c\u8bc1\u6d88\u606f\u540e\u671f\u914d\u7f6e\uff0c\u652f\u6301\u5b9e\u65f6\u66f4\u65b0"),Object(l.b)("li",{parentName:"ul"},"\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"),Object(l.b)("li",{parentName:"ul"},"\u652f\u6301\u8bbe\u7f6e\u9a8c\u8bc1\u7ed3\u679c\u6a21\u578b")),Object(l.b)("h2",{id:"85-datavalidation-\u4f7f\u7528"},"8.5 ",Object(l.b)("inlineCode",{parentName:"h2"},"DataValidation")," \u4f7f\u7528"),Object(l.b)("h3",{id:"851-\u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1"},"8.5.1 \u6ce8\u518c\u9a8c\u8bc1\u670d\u52a1"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddControllers()\n .AddDataValidation();\n }\n }\n}\n")),Object(l.b)("div",{className:"admonition admonition-important alert alert--info"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},".AddDataValidation()")," \u9700\u5728 ",Object(l.b)("inlineCode",{parentName:"p"},"services.AddControllers()")," \u4e4b\u540e\u6ce8\u518c\u3002"))),Object(l.b)("h3",{id:"852-\u517c\u5bb9-mvc-\u7279\u6027\u9a8c\u8bc1"},"8.5.2 \u517c\u5bb9 ",Object(l.b)("inlineCode",{parentName:"h3"},"Mvc")," \u7279\u6027\u9a8c\u8bc1"),Object(l.b)(b.a,{defaultValue:"testdto",values:[{label:"TestDto",value:"testdto"},{label:"FurAppService",value:"furAppService"}],mdxType:"Tabs"},Object(l.b)(c.a,{value:"testdto",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,7,10}","{1,7,10}":!0}),'using System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Application\n{\n public class TestDto\n {\n [Range(10, 20, ErrorMessage = "Id \u53ea\u80fd\u5728 10-20 \u533a\u95f4\u53d6\u503c")]\n public int Id { get; set; }\n\n [Required(ErrorMessage = "\u5fc5\u586b"), MinLength(3, ErrorMessage = "\u5b57\u7b26\u4e32\u957f\u5ea6\u4e0d\u80fd\u5c11\u4e8e3\u4f4d")]\n public string Name { get; set; }\n }\n}\n'))),Object(l.b)(c.a,{value:"furAppService",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{12,22}","{12,22}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n /// \n /// \u503c\u7c7b\u578b\u9a8c\u8bc1\n /// \n /// \n /// \n public int Get(int id)\n {\n return id;\n }\n\n /// \n /// \u5bf9\u8c61\u7c7b\u578b\u9a8c\u8bc1\n /// \n /// \n /// \n public TestDto Post(TestDto testDto)\n {\n return testDto;\n }\n }\n}\n')))),Object(l.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("img",{src:Object(r.a)("img/sjyz1.gif")}),Object(l.b)("h3",{id:"853-\u517c\u5bb9-mvc-\u590d\u6742\u9a8c\u8bc1"},"8.5.3 \u517c\u5bb9 ",Object(l.b)("inlineCode",{parentName:"h3"},"Mvc")," \u590d\u6742\u9a8c\u8bc1"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,6,14-22}","{2,6,14-22}":!0}),'using System.Collections.Generic;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Application\n{\n public class TestDto : IValidatableObject\n {\n [Range(10, 20, ErrorMessage = "Id \u53ea\u80fd\u5728 10-20 \u533a\u95f4\u53d6\u503c")]\n public int Id { get; set; }\n\n [Required(ErrorMessage = "\u5fc5\u586b"), MinLength(3, ErrorMessage = "\u5b57\u7b26\u4e32\u957f\u5ea6\u4e0d\u80fd\u5c11\u4e8e3\u4f4d")]\n public string Name { get; set; }\n\n public IEnumerable Validate(ValidationContext validationContext)\n {\n if (Name.StartsWith("Fur"))\n {\n yield return new ValidationResult(\n "\u4e0d\u80fd\u4ee5 Fur \u5f00\u5934"\n , new[] { nameof(Name) }\n );\n }\n }\n }\n}\n')),Object(l.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("img",{src:Object(r.a)("img/sjyz2.gif")}),Object(l.b)("h2",{id:"86-\u624b\u52a8\u9a8c\u8bc1"},"8.6 \u624b\u52a8\u9a8c\u8bc1"),Object(l.b)("h3",{id:"871-\u9a8c\u8bc1\u6a21\u578b"},"8.7.1 \u9a8c\u8bc1\u6a21\u578b"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,11}","{1,11}":!0}),"using Fur.DataValidation;\nusing Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [NonValidation] // \u8df3\u8fc7\u5168\u5c40\u9a8c\u8bc1\n public DataValidationResult Post(TestDto testDto)\n {\n return testDto.TryValidate();\n }\n }\n}\n")),Object(l.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("img",{src:Object(r.a)("img/sjyz3.gif")}),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"note")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\u652f\u6301 ",Object(l.b)("strong",{parentName:"p"},Object(l.b)("inlineCode",{parentName:"strong"},"Mvc"))," \u5185\u7f6e\u7684\u7279\u6027\u9a8c\u8bc1\u3001\u5c5e\u6027\u9a8c\u8bc1\u53ca\u590d\u6742\u7684 ",Object(l.b)("strong",{parentName:"p"},Object(l.b)("inlineCode",{parentName:"strong"},"IValidatableObject"))," \u9a8c\u8bc1\u3002"))),Object(l.b)("h3",{id:"872-validationtypes-\u5e38\u89c1\u9a8c\u8bc1"},"8.7.2 ",Object(l.b)("inlineCode",{parentName:"h3"},"ValidationTypes")," \u5e38\u89c1\u9a8c\u8bc1"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u5185\u7f6e\u4e86\u5f88\u591a\u5e38\u7528\u7c7b\u578b\u7684\u6570\u636e\u9a8c\u8bc1\uff0c\u5305\u62ec\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Required"),"\uff1a\u975e\u7a7a\u3001\u975e Null \u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Numeric"),"\uff1a\u6570\u503c\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PositiveNumber"),"\uff1a\u6b63\u6570\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"NegativeNumber"),"\uff1a\u8d1f\u6570\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Integer"),"\uff1a\u6574\u6570\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Money"),"\uff1a\u91d1\u94b1\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Date"),"\uff1a\u65e5\u671f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Time"),"\uff1a\u65f6\u95f4\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IDCard"),"\uff1a\u8eab\u4efd\u8bc1\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PostCode"),"\uff1a\u90ae\u7f16\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PhoneNumber"),"\uff1a\u624b\u673a\u53f7\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Telephone"),"\uff1a\u56fa\u8bdd\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PhoneOrTelNumber"),"\uff1a\u624b\u673a\u6216\u56fa\u8bdd\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"EmailAddress"),"\uff1a\u90ae\u4ef6\u5730\u5740\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Url"),"\uff1a\u7f51\u5740\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Color"),"\uff1a\u989c\u8272\u503c\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Chinese"),"\uff1a\u4e2d\u6587\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IPv4"),"\uff1aIPv4 \u5730\u5740\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IPv6"),"\uff1aIPv6 \u5730\u5740\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Age"),"\uff1a\u5e74\u9f84\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"ChineseName"),"\uff1a\u4e2d\u6587\u540d\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"EnglishName"),"\uff1a\u82f1\u6587\u540d\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Capital"),"\uff1a\u7eaf\u5927\u5199\u82f1\u6587\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Lowercase"),"\uff1a\u7eaf\u5c0f\u5199\u82f1\u6587\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Ascii"),"\uff1aAscii \u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Md5"),"\uff1aMd5 \u5b57\u7b26\u4e32\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Zip"),"\uff1a\u538b\u7f29\u5305\u683c\u5f0f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Image"),"\uff1a\u56fe\u7247\u683c\u5f0f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Document"),"\uff1a\u6587\u6863\u683c\u5f0f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"MP3"),"\uff1aMp3 \u683c\u5f0f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Flash"),"\uff1aFlash \u683c\u5f0f\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Video"),"\uff1a\u89c6\u9891\u6587\u4ef6\u683c\u5f0f\u7c7b\u578b")),Object(l.b)("p",null,Object(l.b)("strong",{parentName:"p"},"\u4f7f\u7528\u793a\u4f8b")),Object(l.b)(b.a,{defaultValue:"dglx",values:[{label:"\u5355\u4e2a\u7c7b\u578b\u9a8c\u8bc1",value:"dglx"},{label:"\u591a\u4e2a\u7ec4\u5408\u7c7b\u578b\u9a8c\u8bc1",value:"zhlx"}],mdxType:"Tabs"},Object(l.b)(c.a,{value:"dglx",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u9a8c\u8bc1\u5fc5\u586b\n"".TryValidate(ValidationTypes.Required); // => false\n\n// \u9a8c\u8bc1\u4e2d\u6587\n"\u6211\u53eb MonK".TryValidate(ValidationTypes.Chinese); // => false\n\n// \u9a8c\u8bc1\u6570\u503c\n2.TryValidate(ValidationTypes.Numeric); // => true\n\n// \u9a8c\u8bc1\u6574\u6570\ntrue.TryValidate(ValidationTypes.Integer); // => false\n\n// \u9a8c\u8bc1\u90ae\u7bb1\n"monksoul@outlook.com".TryValidate(ValidationTypes.EmailAddress); // => true\n\n// \u9a8c\u8bc1\u8d1f\u6570\n2.0m.TryValidate(ValidationTypes.NegativeNumber); // => false\n\n// \u81ea\u5b9a\u4e49\u6b63\u5219\u8868\u8fbe\u5f0f\u9a8c\u8bc1\n"Fur".TryValidate("/^Fur$"); // => true\n'))),Object(l.b)(c.a,{value:"zhlx",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u9a8c\u8bc1\u6570\u503c\u7c7b\u578b\u4e14\u662f\u6574\u6570\n"20".TryValidate(ValidationTypes.Numeric, ValidationTypes.Integer); // => true\n\n// \u9a8c\u8bc1\u65f6\u65e5\u671f\u6216\u65f6\u95f4\u683c\u5f0f\n"2020-05-20".TryValidate(ValidationOptions.AtLeastOne, ValidationTypes.Date, ValidationTypes.Time); // => true\n"23:45:20".TryValidate(ValidationOptions.AtLeastOne, ValidationTypes.Date, ValidationTypes.Time); // => true\n\n')))),Object(l.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\u53ef\u901a\u8fc7\u8bbe\u7f6e ",Object(l.b)("inlineCode",{parentName:"p"},"TryValidate([ValidationOptions], params object[] validationTypes)")," \u65b9\u6cd5\u7684 ",Object(l.b)("inlineCode",{parentName:"p"},"ValidationOptions")," \u53c2\u6570\u914d\u7f6e\u9a8c\u8bc1\u903b\u8f91\uff0c\u5982\uff1a",Object(l.b)("strong",{parentName:"p"},Object(l.b)("inlineCode",{parentName:"strong"},"\u540c\u65f6\u6210\u7acb"))," \u6216 ",Object(l.b)("strong",{parentName:"p"},Object(l.b)("inlineCode",{parentName:"strong"},"\u53ea\u8981\u4e00\u4e2a\u6210\u7acb"))," \u5373\u53ef\u9a8c\u8bc1\u901a\u8fc7"))),Object(l.b)("h3",{id:"873-datavalidation-\u7279\u6027"},"8.7.3 ",Object(l.b)("inlineCode",{parentName:"h3"},"[DataValidation]")," \u7279\u6027"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u8fd8\u63d0\u4f9b\u4e86 ",Object(l.b)("inlineCode",{parentName:"p"},"[DataValidation]")," \u7279\u6027\u65b9\u4fbf\u5728\u6a21\u578b\u53c2\u6570\u4e2d\u4f7f\u7528 ",Object(l.b)("inlineCode",{parentName:"p"},"ValidationTypes")," \u5e38\u89c1\u9a8c\u8bc1\u6216\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u3002"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,7,10,14,17,20}","{1,7,10,14,17,20}":!0}),'using Fur.DataValidation;\n\nnamespace Fur.Application\n{\n public class TestDto\n {\n [DataValidation(ValidationTypes.Integer)]\n public int Id { get; set; }\n\n [DataValidation(ValidationTypes.Numeric, ValidationTypes.Integer)]\n public int Cost { get; set; }\n\n [DataValidation(ValidationOptions.AtLeastOne, ValidationTypes.Chinese, ValidationTypes.Date)]\n public string Name { get; set; }\n\n // \u53ef\u4ee5\u548cMvc\u7279\u6027\u5171\u5b58\n [Required, DataValidation(ValidationTypes.Age)]\n public int Age { get; set; }\n\n [DataValidation(ValidationTypes.IDCard, ErrorMessage = "\u81ea\u5b9a\u4e49\u8eab\u4efd\u8bc1\u63d0\u793a\u6d88\u606f")]\n public string IDCard { get; set; }\n }\n}\n')),Object(l.b)("h2",{id:"87-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1"},"8.7 ",Object(l.b)("inlineCode",{parentName:"h2"},"[NonValidation]")," \u8df3\u8fc7\u9a8c\u8bc1"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u5bf9\u8c61\u6a21\u578b\u8df3\u8fc7\u9a8c\u8bc1\u7279\u6027 ",Object(l.b)("inlineCode",{parentName:"p"},"[NonValidation]"),"\uff0c\u652f\u6301\u5728 ",Object(l.b)("inlineCode",{parentName:"p"},"\u63a7\u5236\u5668"),"\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"\u52a8\u4f5c\u65b9\u6cd5"),"\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"\u7c7b")," \u4e2d\u4f7f\u7528\u3002"),Object(l.b)("p",null,"\u4e00\u65e6\u8d34\u4e86\u6b64\u7279\u6027\uff0c\u90a3\u4e48\u5c06\u4e0d\u4f1a\u6267\u884c\u9a8c\u8bc1\u64cd\u4f5c\u3002"),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"note")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("strong",{parentName:"p"},Object(l.b)("inlineCode",{parentName:"strong"},"[NonValidation]"))," \u53ea\u5bf9\u5bf9\u8c61\u7c7b\u578b\u6709\u6548\uff0c\u503c\u7c7b\u578b\u65e0\u6548\u3002"))),Object(l.b)("h2",{id:"88-\u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c"},"8.8 \u9ad8\u7ea7\u81ea\u5b9a\u4e49\u64cd\u4f5c"),Object(l.b)("h3",{id:"881-\u81ea\u5b9a\u4e49-validationtypes-\u7c7b\u578b"},"8.8.1 \u81ea\u5b9a\u4e49 ",Object(l.b)("inlineCode",{parentName:"h3"},"ValidationTypes")," \u7c7b\u578b"),Object(l.b)("p",null,"\u9664\u4e86 ",Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u5185\u7f6e\u7684\u9a8c\u8bc1\u7c7b\u578b\u4ee5\u5916\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u8fd8\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b\u578b\u673a\u5236\u3002"),Object(l.b)("p",null,"\u5b9e\u73b0\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b\u578b\u5fc5\u987b\u9075\u5faa\u4ee5\u4e0b\u914d\u7f6e\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u9a8c\u8bc1\u7c7b\u578b\u5fc5\u987b\u65f6\u516c\u5f00\u4e14\u65f6 ",Object(l.b)("inlineCode",{parentName:"li"},"Enum")," \u679a\u4e3e\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},"\u679a\u4e3e\u7c7b\u578b\u5fc5\u987b\u8d34\u6709 ",Object(l.b)("inlineCode",{parentName:"li"},"[ValidationType]")," \u7279\u6027"),Object(l.b)("li",{parentName:"ul"},"\u679a\u4e3e\u4e2d\u6bcf\u4e00\u9879\u5fc5\u987b\u8d34\u6709 ",Object(l.b)("inlineCode",{parentName:"li"},"[ValidationItemMetadata]")," \u7279\u6027")),Object(l.b)("p",null,Object(l.b)("strong",{parentName:"p"},"\u5982"),"\uff1a"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,12,18}","{1,6,12,18}":!0}),'using Fur.DataValidation;\nusing System.Text.RegularExpressions;\n\nnamespace Fur.Application\n{\n [ValidationType]\n public enum MyValidationTypes\n {\n /// \n /// \u5f3a\u5bc6\u7801\u7c7b\u578b\n /// \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")]\n StrongPassword,\n\n /// \n /// \u4ee5 Fur \u5b57\u7b26\u4e32\u5f00\u5934\uff0c\u5ffd\u7565\u5927\u5c0f\u5199\n /// \n [ValidationItemMetadata(@"^(fur).*", "\u9ed8\u8ba4\u63d0\u793a\uff1a\u5fc5\u987b\u4ee5Fur\u5b57\u7b26\u4e32\u5f00\u5934\uff0c\u5ffd\u7565\u5927\u5c0f\u5199", RegexOptions.IgnoreCase)]\n StartWithFurString\n }\n}\n\n')),Object(l.b)("p",null,Object(l.b)("strong",{parentName:"p"},"\u4f7f\u7528")),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u624b\u52a8\u4f7f\u7528")),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'"q1w2e3".TryValidate(MyValidationTypes.StrongPassword); // => false\n\n"furos".TryValidate(MyValidationTypes.StartWithFurString); // => true\n')),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"[DataValidation]")," \u4e2d\u4f7f\u7528")),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"[DataValidation(MyValidationTypes.StrongPassword)]\npublic string Password { get; set; }\n")),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u591a\u4e2a\u81ea\u5b9a\u4e49\u7c7b\u578b\u6df7\u7528")),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'"Q1w2e3r4t5!*".TryValidate(MyValidationTypes.StrongPassword, ValidationTypes.Required); // => true\n')),Object(l.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\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"))),Object(l.b)("h3",{id:"882-\u81ea\u5b9a\u4e49-validationtypes-\u5931\u8d25\u6d88\u606f"},"8.8.2 \u81ea\u5b9a\u4e49 ",Object(l.b)("inlineCode",{parentName:"h3"},"ValidationTypes")," \u5931\u8d25\u6d88\u606f"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u5185\u7f6e\u7684 ",Object(l.b)("inlineCode",{parentName:"p"},"ValidationTypes")," \u5df2\u6709\u9ed8\u8ba4\u7684\u5931\u8d25\u6d88\u606f\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Required"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is required.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Numeric"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a numeric type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PositiveNumber"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a positive number type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"NegativeNumber"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a negative number type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Integer"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a integer type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Money"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a money type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Date"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a date type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Time"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a time type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IDCard"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a idcard type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PostCode"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a postcode type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PhoneNumber"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a phone number type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Telephone"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a telephone type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"PhoneOrTelNumber"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a phone number or telephone type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"EmailAddress"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a email address type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Url"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a url address type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Color"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a color type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Chinese"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a chinese type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IPv4"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a IPv4 type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"IPv6"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a IPv6 type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Age"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a age type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"ChineseName"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a chinese name type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"EnglishName"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a english name type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Capital"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a capital type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Lowercase"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a lowercase type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Ascii"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a ascii type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Md5"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a md5 type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Zip"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a zip type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Image"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a image type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Document"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a document type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"MP3"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a mp3 type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Flash"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a flash type.")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Video"),"\uff1a",Object(l.b)("strong",{parentName:"li"},"The Value is not a video type."))),Object(l.b)("p",null,"\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u521b\u5efa\u7ee7\u627f ",Object(l.b)("inlineCode",{parentName:"p"},"IValidationMessageTypeProvider")," \u9a8c\u8bc1\u6d88\u606f\u63d0\u4f9b\u5668\u7c7b\u578b\uff0c\u6216\u901a\u8fc7 ",Object(l.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u914d\u7f6e\u3002"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},Object(l.b)("inlineCode",{parentName:"strong"},"[ValidationMessageType]"))," \u65b9\u5f0f")),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,9,12,15,19,22}","{5,9,12,15,19,22}":!0}),'using Fur.DataValidation;\n\nnamespace Fur.Application\n{\n [ValidationMessageType]\n public enum MyValidationMessageType\n {\n // \u4fee\u6539\u5185\u7f6e\u9a8c\u8bc1\u7c7b\u578b\u9a8c\u8bc1\u5931\u8d25\u6d88\u606f\n [ValidationMessage("\u503c\u4e0d\u80fd\u4e3a\u7a7a\u6216Null")]\n Required,\n\n [ValidationMessage("\u5fc5\u987b\u662f\u6570\u503c\u7c7b\u578b")]\n Numeric,\n\n [ValidationMessage("\u5fc5\u987b\u662f\u6b63\u6570")]\n PositiveNumber,\n\n // \u4fee\u6539\u81ea\u5b9a\u4e49\u7c7b\u578b\u9a8c\u8bc1\u5931\u8d25\u6d88\u606f\n [ValidationMessage("\u5bc6\u7801\u592a\u7b80\u5355\u4e86")]\n StrongPassword,\n\n [ValidationMessage("\u5fc5\u987b\u4ee5 Fur \u5f00\u5934")]\n StartWithFurString\n }\n}\n')),Object(l.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\u9664\u4e86\u8d34 ",Object(l.b)("inlineCode",{parentName:"p"},"[ValidationMessageType]")," \u7279\u6027\u5916\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u8fd8\u63d0\u4f9b\u4e86 ",Object(l.b)("inlineCode",{parentName:"p"},"IValidationMessageTypeProvider")," \u65b9\u5f0f\u67e5\u627e\u9a8c\u8bc1\u6d88\u606f\u7c7b\u578b\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("pre",{parentName:"div"},Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,8-12}","{1,6,8-12}":!0}),"using Fur.DataValidation;\nusing System;\n\nnamespace Fur.Application\n{\n public class MyValidationTypeMessageProvider : IValidationMessageTypeProvider\n {\n public Type[] Definitions => new[]\n {\n typeof(MyValidationMessageType),\n typeof(MyValidationMessageType2)\n };\n }\n}\n")),Object(l.b)("p",{parentName:"div"},"\u6ce8\u518c\u9a8c\u8bc1\u6d88\u606f\u63d0\u4f9b\u5668"),Object(l.b)("pre",{parentName:"div"},Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddControllers()\n .AddDataValidation();\n }\n }\n}\n")))),Object(l.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("img",{src:Object(r.a)("img/sjyz4.png")}),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"},Object(l.b)("inlineCode",{parentName:"strong"},"appsettings.json")," \u65b9\u5f0f"))),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-11} title="Fur.Web.Entry/appsettings.json"',"{2-11}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "ValidationTypeMessageSettings": {\n "Definitions": [\n ["Required", "\u503c\u4e0d\u80fd\u4e3a\u7a7a\u6216Null"],\n ["Numeric", "\u5fc5\u987b\u662f\u6570\u503c\u7c7b\u578b"],\n\n ["StrongPassword", "\u5bc6\u7801\u592a\u7b80\u5355\u4e86!!!"]\n ]\n }\n }\n}\n')),Object(l.b)("div",{className:"admonition admonition-important alert alert--info"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"important")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u76f8\u540c\u7684 ",Object(l.b)("inlineCode",{parentName:"p"},"Key")," \u6216\u8986\u76d6 ",Object(l.b)("inlineCode",{parentName:"p"},"IValidationMessageTypeProvider")," \u63d0\u4f9b\u76f8\u540c ",Object(l.b)("inlineCode",{parentName:"p"},"Key")," \u7684\u503c\u3002"))),Object(l.b)("h4",{id:"\u9519\u8bef\u6d88\u606f\u67e5\u627e\u4f18\u5148\u7ea7"},"\u9519\u8bef\u6d88\u606f\u67e5\u627e\u4f18\u5148\u7ea7"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"DefaultErrorMessage")," -> ",Object(l.b)("inlineCode",{parentName:"p"},"IValidationMessageTypeProvider")," -> ",Object(l.b)("inlineCode",{parentName:"p"},"appsettings.json")," (",Object(l.b)("strong",{parentName:"p"},"\u4f4e -> \u9ad8"),")"),Object(l.b)("h2",{id:"89-\u6a21\u578b\u9a8c\u8bc1\u8303\u56f4"},"8.9 \u6a21\u578b\u9a8c\u8bc1\u8303\u56f4"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u591a\u79cd\u6a21\u578b\u9a8c\u8bc1\u8303\u56f4\u8bbe\u7f6e\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},"\u5168\u5c40\u9a8c\u8bc1\uff08\u9ed8\u8ba4\uff09"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"[NonValidation]")," \u8df3\u8fc7\u9a8c\u8bc1"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"[TypeFilter(typeof(DataValidationFilter))]")," \u5c40\u90e8\u9a8c\u8bc1"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"[ApiController]")," \u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1")),Object(l.b)("h3",{id:"891-\u5168\u5c40\u9a8c\u8bc1"},"8.9.1 \u5168\u5c40\u9a8c\u8bc1"),Object(l.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u901a\u8fc7 ",Object(l.b)("inlineCode",{parentName:"p"},".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 ",Object(l.b)("inlineCode",{parentName:"p"},"false")," \u5373\u53ef\uff0c\u5982\uff1a",Object(l.b)("inlineCode",{parentName:"p"},".AddDataValidation(false)"),"\u3002"),Object(l.b)("h3",{id:"892-nonvalidation-\u8df3\u8fc7\u9a8c\u8bc1"},"8.9.2 ",Object(l.b)("inlineCode",{parentName:"h3"},"[NonValidation]")," \u8df3\u8fc7\u9a8c\u8bc1"),Object(l.b)("p",null,"\u53ef\u901a\u8fc7 ",Object(l.b)("inlineCode",{parentName:"p"},"[NonValidation]")," \u8d34\u5728 ",Object(l.b)("inlineCode",{parentName:"p"},"\u63a7\u5236\u5668"),"\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"\u52a8\u4f5c\u65b9\u6cd5"),"\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"\u7c7b")," \u4e2d\u8df3\u8fc7\u5168\u5c40\u9a8c\u8bc1\u6216\u4e0d\u9700\u8981\u9a8c\u8bc1"),Object(l.b)("h3",{id:"893-typefiltertypeofdatavalidationfilter-\u5c40\u90e8\u9a8c\u8bc1"},"8.9.3 ",Object(l.b)("inlineCode",{parentName:"h3"},"[TypeFilter(typeof(DataValidationFilter))]")," \u5c40\u90e8\u9a8c\u8bc1"),Object(l.b)("p",null,"\u6211\u4eec\u4e5f\u53ef\u4ee5\u65e0\u9700\u6ce8\u518c ",Object(l.b)("inlineCode",{parentName:"p"},".AddDataValidation()")," \u670d\u52a1\uff0c\u76f4\u63a5\u5728 ",Object(l.b)("inlineCode",{parentName:"p"},"\u52a8\u4f5c\u65b9\u6cd5")," \u4e0a\u8d34 ",Object(l.b)("inlineCode",{parentName:"p"},"[TypeFilter(typeof(DataValidationFilter))]")," \u53ef\u542f\u7528\u5c40\u90e8\u9a8c\u8bc1\u3002\u5982\uff1a"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,3,9}","{1,3,9}":!0}),"using Fur.DataValidation;\nusing Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [TypeFilter(typeof(DataValidationFilter))]\n public TestDto Post(TestDto testDto)\n {\n return testDto;\n }\n }\n}\n")),Object(l.b)("h3",{id:"894-apicontroller-\u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1"},"8.9.4 ",Object(l.b)("inlineCode",{parentName:"h3"},"[ApiController]")," \u63a7\u5236\u5668\u8303\u56f4\u9a8c\u8bc1"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"[ApiController]")," \u662f ",Object(l.b)("inlineCode",{parentName:"p"},"Mvc")," \u63d0\u4f9b\u7684\u63a7\u5236\u5668\u8303\u56f4\uff08\u542b\u6240\u6709\u52a8\u4f5c\u65b9\u6cd5\uff09\u7684\u9a8c\u8bc1\u3002"),Object(l.b)("pre",null,Object(l.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5}","{1,5}":!0}),"using Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [ApiController]\n public class MvcController : Controller\n {\n public IActionResult Index()\n {\n return View();\n }\n }\n}\n")),Object(l.b)("h2",{id:"810-miniprofiler-\u67e5\u770b"},"8.10 ",Object(l.b)("inlineCode",{parentName:"h2"},"MiniProfiler")," \u67e5\u770b"),Object(l.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(l.b)("img",{src:Object(r.a)("img/sjyz5.png")}),Object(l.b)("h2",{id:"810-\u591a\u8bed\u8a00\u652f\u6301"},"8.10 \u591a\u8bed\u8a00\u652f\u6301"),Object(l.b)("p",null,"\u6587\u6863\u6574\u7406\u4e2d..."),Object(l.b)("h2",{id:"811-\u9a8c\u8bc1\u6a21\u578b\u63d0\u4f9b\u5668"},"8.11 \u9a8c\u8bc1\u6a21\u578b\u63d0\u4f9b\u5668"),Object(l.b)("p",null,"\u6587\u6863\u6574\u7406\u4e2d..."),Object(l.b)("h2",{id:"812-\u53cd\u9988\u4e0e\u5efa\u8bae"},"8.12 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(l.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(l.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/1761adf3.0eeb8b92.js b/docs/1761adf3.0eeb8b92.js deleted file mode 100644 index dc4dea982a6..00000000000 --- a/docs/1761adf3.0eeb8b92.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return O}));var r=n(0),a=n.n(r);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=a.a.createContext({}),b=function(e){var t=a.a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},p=function(e){var t=b(e.components);return a.a.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},d=a.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),p=b(n),d=r,O=p["".concat(l,".").concat(d)]||p[d]||u[d]||i;return n?a.a.createElement(O,c(c({ref:t},s),{},{components:n})):a.a.createElement(O,c({ref:t},s))}));function O(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=d;var c={};for(var o in t)hasOwnProperty.call(t,o)&&(c[o]=t[o]);c.originalType=e,c.mdxType="string"==typeof e?e:r,l[1]=c;for(var s=2;sDataTable",id:"91322-\u8fd4\u56de-datatable",children:[]},{value:"9.13.2.3 \u8fd4\u56de DataSet",id:"91323-\u8fd4\u56de-dataset",children:[]},{value:"9.13.2.4 \u8fd4\u56de List<T>",id:"91324-\u8fd4\u56de-listt",children:[]},{value:"9.13.2.5 \u8fd4\u56de Tuple<T1,...T8>",id:"91325-\u8fd4\u56de-tuplet1t8",children:[]},{value:"9.13.2.6 \u8fd4\u56de \u5355\u884c\u5355\u5217 object",id:"91326-\u8fd4\u56de-\u5355\u884c\u5355\u5217-object",children:[]},{value:"9.13.2.7 \u8fd4\u56de \u5355\u884c\u5355\u5217 <T>",id:"91327-\u8fd4\u56de-\u5355\u884c\u5355\u5217-t",children:[]},{value:"9.13.2.8 \u6267\u884c\u4f46\u65e0\u8fd4\u56de",id:"91328-\u6267\u884c\u4f46\u65e0\u8fd4\u56de",children:[]}]},{value:"9.13.3 \u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b",id:"9133-\u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b",children:[{value:"9.13.3.1 \u521b\u5efa\u53c2\u6570\u6a21\u578b",id:"91331-\u521b\u5efa\u53c2\u6570\u6a21\u578b",children:[]},{value:"9.13.3.2 \u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b",id:"91332-\u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b",children:[]}]},{value:"9.13.3 \u5173\u4e8e [DbParameter]",id:"9133-\u5173\u4e8e-dbparameter",children:[]},{value:"9.13.4 \u5173\u4e8e ProcedureOutputResult",id:"9134-\u5173\u4e8e-procedureoutputresult",children:[]},{value:"9.13.5 \u5b58\u50a8\u8fc7\u7a0b\u53c2\u6570",id:"9135-\u5b58\u50a8\u8fc7\u7a0b\u53c2\u6570",children:[]},{value:"9.13.6 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9136-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],p={rightToc:b};function u(e){var t=e.components,n=Object(a.a)(e,["components"]);return Object(i.b)("wrapper",Object(r.a)({},p,n,{components:t,mdxType:"MDXLayout"}),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u6e29\u99a8\u63d0\u793a")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u63a8\u8350\u4f7f\u7528 \u300a",Object(i.b)("a",Object(r.a)({parentName:"p"},{href:"/docs/dbcontext-sql-proxy"}),"9.15 Sql \u9ad8\u7ea7\u4ee3\u7406"),"\u300b\u4ee3\u66ff\u672c\u7ae0\u8282\u529f\u80fd\u3002",Object(i.b)("inlineCode",{parentName:"p"},"Sql \u9ad8\u7ea7\u4ee3\u7406")," \u80fd\u591f\u63d0\u4f9b\u66f4\u5bb9\u6613\u4e14\u66f4\u6613\u7ef4\u62a4\u7684\u65b9\u5f0f\u3002"))),Object(i.b)("h2",{id:"9131-\u5173\u4e8e\u5b58\u50a8\u8fc7\u7a0b"},"9.13.1 \u5173\u4e8e\u5b58\u50a8\u8fc7\u7a0b"),Object(i.b)("p",null,"\u5f15\u7528\u767e\u5ea6\u767e\u79d1\uff1a"),Object(i.b)("blockquote",null,Object(i.b)("p",{parentName:"blockquote"},"\u5b58\u50a8\u8fc7\u7a0b\uff08Stored Procedure\uff09\u662f\u5728\u5927\u578b\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\uff0c\u4e00\u7ec4\u4e3a\u4e86\u5b8c\u6210\u7279\u5b9a\u529f\u80fd\u7684 SQL \u8bed\u53e5\u96c6\uff0c\u5b83\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\uff0c\u4e00\u6b21\u7f16\u8bd1\u540e\u6c38\u4e45\u6709\u6548\uff0c\u7528\u6237\u901a\u8fc7\u6307\u5b9a\u5b58\u50a8\u8fc7\u7a0b\u7684\u540d\u5b57\u5e76\u7ed9\u51fa\u53c2\u6570\uff08\u5982\u679c\u8be5\u5b58\u50a8\u8fc7\u7a0b\u5e26\u6709\u53c2\u6570\uff09\u6765\u6267\u884c\u5b83\u3002"),Object(i.b)("p",{parentName:"blockquote"},"\u5b58\u50a8\u8fc7\u7a0b\u662f\u6570\u636e\u5e93\u4e2d\u7684\u4e00\u4e2a\u91cd\u8981\u5bf9\u8c61\u3002\u5728\u6570\u636e\u91cf\u7279\u522b\u5e9e\u5927\u7684\u60c5\u51b5\u4e0b\u5229\u7528\u5b58\u50a8\u8fc7\u7a0b\u80fd\u8fbe\u5230\u500d\u901f\u7684\u6548\u7387\u63d0\u5347\u3002")),Object(i.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u5b58\u50a8\u8fc7\u7a0b\u5c31\u662f\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4e2d\uff08",Object(i.b)("inlineCode",{parentName:"p"},"Sqlite")," \u9664\u5916\uff09\u4e2d\u7f16\u5199\u903b\u8f91\u7684\u51fd\u6570/\u65b9\u6cd5\uff0c\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5c06 ",Object(i.b)("inlineCode",{parentName:"p"},"sql")," \u7f16\u8bd1\u7f13\u5b58\u8d77\u6765\uff0c\u5927\u5927\u63d0\u9ad8\u5b58\u50a8\u8fc7\u7a0b\u7684\u6267\u884c\u6548\u7387\u3002"),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"\u8fd9\u91cc\u4e0d\u8ba8\u8bba\u5b58\u50a8\u8fc7\u7a0b\u7684\u4f18\u7f3a\u70b9\u3002")),Object(i.b)("h3",{id:"91311-\u652f\u6301\u5b58\u50a8\u8fc7\u7a0b\u7684\u6570\u636e\u5e93"},"9.13.1.1 \u652f\u6301\u5b58\u50a8\u8fc7\u7a0b\u7684\u6570\u636e\u5e93"),Object(i.b)("table",null,Object(i.b)("thead",{parentName:"table"},Object(i.b)("tr",{parentName:"thead"},Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"SqlServer"),Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Sqlite"),Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Cosmos"),Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"InMemoryDatabase"),Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"MySql"),Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"PostgreSQL"),Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Oracle"),Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Firebird"),Object(i.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Dm"))),Object(i.b)("tbody",{parentName:"table"},Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null})),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null})),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(i.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714")))),Object(i.b)("h2",{id:"9132-\u5b58\u50a8\u8fc7\u7a0b\u4f7f\u7528"},"9.13.2 \u5b58\u50a8\u8fc7\u7a0b\u4f7f\u7528"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\u63d0\u4f9b\u4e86\u591a\u79cd\u5b58\u50a8\u8fc7\u7a0b\u64cd\u4f5c\u65b9\u5f0f\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"ISqlRepository"),"\uff1a",Object(i.b)("inlineCode",{parentName:"li"},"Sql")," \u64cd\u4f5c\u4ed3\u50a8\uff0c\u53ef\u901a\u8fc7 ",Object(i.b)("inlineCode",{parentName:"li"},"\u4f9d\u8d56\u6ce8\u5165")),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"ISqlDispatchProxy"),"\uff1a",Object(i.b)("inlineCode",{parentName:"li"},"Sql")," \u4ee3\u7406\u65b9\u5f0f\uff08\u9ad8\u7ea7\u7528\u6cd5\uff0c\u63a8\u8350\uff09"),Object(i.b)("li",{parentName:"ul"},"\u901a\u8fc7\u4efb\u610f\u5b9e\u4f53\u4ed3\u50a8\u64cd\u4f5c\uff1a",Object(i.b)("inlineCode",{parentName:"li"},"personRepository.SqlProcedureQuery(procName)")),Object(i.b)("li",{parentName:"ul"},"\u901a\u8fc7\u5b57\u7b26\u4e32\u62d3\u5c55\u65b9\u6cd5\uff1a",Object(i.b)("inlineCode",{parentName:"li"},"procName.SqlProcedureQuery()")),Object(i.b)("li",{parentName:"ul"},"\u901a\u8fc7 ",Object(i.b)("inlineCode",{parentName:"li"},"repository.Sql().SqlProcedureQuery()")," \u65b9\u5f0f")),Object(i.b)("h3",{id:"91321-\u521d\u59cb\u5316\u65b9\u5f0f"},"9.13.2.1 \u521d\u59cb\u5316\u65b9\u5f0f"),Object(i.b)(l.a,{defaultValue:"one",values:[{label:"ISqlRepository",value:"one"},{label:"ISqlDispatchProxy",value:"two"},{label:"\u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f",value:"three"},{label:"\u5b57\u7b26\u4e32\u62d3\u5c55\u65b9\u5f0f",value:"four"}],mdxType:"Tabs"},Object(i.b)(c.a,{value:"one",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,9-12}","{1,9-12}":!0}),"using Fur.DatabaseAccessor;\nusing Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [DynamicApiController]\n public class SqlService\n {\n private ISqlRepository _sqlRepository;\n public SqlService(ISqlRepository sqlRepository)\n {\n _sqlRepository = sqlRepository;\n }\n }\n}\n"))),Object(i.b)(c.a,{value:"two",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,7,9-10}","{2,7,9-10}":!0}),'using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing System.Collections.Generic;\n\nnamespace Fur.Application\n{\n public interface ISqlExecuteProxy : ISqlDispatchProxy\n {\n [SqlProcedure("proc_GetPersons")]\n List GetPersons(string keyword);\n }\n}\n')),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{9-12}","{9-12}":!0}),"using Fur.DatabaseAccessor;\nusing Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [DynamicApiController]\n public class SqlService\n {\n private ISqlExecuteProxy _sqlExecuteProxy;\n public SqlService(ISqlExecuteProxy sqlExecuteProxy)\n {\n _sqlExecuteProxy = sqlExecuteProxy;\n }\n }\n}\n"))),Object(i.b)(c.a,{value:"three",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'var persons = personRepository.SqlProcedureQuery("proc_GetPersons");\n'))),Object(i.b)(c.a,{value:"four",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'var persons = "proc_GetPersons".SqlProcedureQuery();\n')))),Object(i.b)("h3",{id:"91322-\u8fd4\u56de-datatable"},"9.13.2.2 \u8fd4\u56de ",Object(i.b)("inlineCode",{parentName:"h3"},"DataTable")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar dataTable = _sqlRepository.SqlProcedureQuery("proc_GetPersons");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar dataTable = _sqlExecuteProxy.GetPersons(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar dataTable = _personRepository.SqlProcedureQuery("proc_GetPersons");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar dataTable = _repository.Sql().SqlProcedureQuery("proc_GetPersons");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nvar dataTable = "proc_GetPersons".SqlProcedureQuery();\n')),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(i.b)("h3",{id:"91323-\u8fd4\u56de-dataset"},"9.13.2.3 \u8fd4\u56de ",Object(i.b)("inlineCode",{parentName:"h3"},"DataSet")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar dataSet = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar dataSet = _sqlExecuteProxy.GetPersons(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar dataSet = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar dataSet = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nvar dataSet = "proc_GetPersons".SqlProcedureQueries();\n')),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(i.b)("h3",{id:"91324-\u8fd4\u56de-listt"},"9.13.2.4 \u8fd4\u56de ",Object(i.b)("inlineCode",{parentName:"h3"},"List")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar list = _sqlRepository.SqlProcedureQuery("proc_GetPersons");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar list = _sqlExecuteProxy.GetPersons(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar list = _personRepository.SqlProcedureQuery("proc_GetPersons");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar list = _repository.Sql().SqlProcedureQuery("proc_GetPersons");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nvar list = "proc_GetPersons".SqlProcedureQuery();\n')),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(i.b)("h3",{id:"91325-\u8fd4\u56de-tuplet1t8"},"9.13.2.5 \u8fd4\u56de ",Object(i.b)("inlineCode",{parentName:"h3"},"Tuple")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u5927\u5927\u5229\u7528\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"Tuple")," \u7684\u7279\u6027\uff0c\u5c06\u8fd4\u56de\u591a\u4e2a\u7ed3\u679c\u96c6\u8f6c\u6210 ",Object(i.b)("inlineCode",{parentName:"p"},"Tuple")," \u7c7b\u578b"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\n\n// \u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\nvar list1 = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e24\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e09\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u56db\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e94\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516d\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e03\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516b\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7, list8) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// ==================================\n\n// ISqlDispatchProxy \u65b9\u5f0f\uff0c\u63a8\u8350\u65b9\u5f0f\uff0c\u81ea\u52a8\u5904\u7406\u591a\u4e2a\u7ed3\u679c\u96c6\n\n// \u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\nvar list1 = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u4e24\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u4e09\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u56db\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u4e94\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u516d\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u4e03\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u516b\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7, list8) = _sqlRepository.GetDatas();\n\n// ==================================\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\n\n// \u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\nvar list1 = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e24\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e09\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u56db\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e94\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516d\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e03\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516b\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7, list8) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// ==================================\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\n\n// \u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\nvar list1 = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e24\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e09\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u56db\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e94\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516d\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e03\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516b\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7, list8) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// ==================================\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\n\n// \u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\nvar list1 = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u4e24\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u4e09\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u56db\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u4e94\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u516d\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u4e03\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u516b\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7, list8) = "proc_GetPersons".SqlProcedureQueries();\n')),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(i.b)("h3",{id:"91326-\u8fd4\u56de-\u5355\u884c\u5355\u5217-object"},"9.13.2.6 \u8fd4\u56de ",Object(i.b)("inlineCode",{parentName:"h3"},"\u5355\u884c\u5355\u5217 object")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlProcedureScalar("proc_GetName");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetName(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlProcedureScalar("proc_GetName");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlProcedureScalar("proc_GetName");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nvar value = "proc_GetName".SqlProcedureScalar();\n')),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(i.b)("h3",{id:"91327-\u8fd4\u56de-\u5355\u884c\u5355\u5217-t"},"9.13.2.7 \u8fd4\u56de ",Object(i.b)("inlineCode",{parentName:"h3"},"\u5355\u884c\u5355\u5217 ")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlProcedureScalar("proc_GetName");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetName(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlProcedureScalar("proc_GetName");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlProcedureScalar("proc_GetName");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nvar value = "proc_GetName".SqlProcedureScalar();\n')),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(i.b)("h3",{id:"91328-\u6267\u884c\u4f46\u65e0\u8fd4\u56de"},"9.13.2.8 \u6267\u884c\u4f46\u65e0\u8fd4\u56de"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\n_sqlRepository.SqlProcedureNonQuery("proc_UpdateData");\n\n// ISqlDispatchProxy \u65b9\u5f0f\n_sqlExecuteProxy.UpdateData(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\n_personRepository.SqlProcedureNonQuery("proc_UpdateData");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\n_repository.Sql().SqlProcedureNonQuery("proc_UpdateData");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\n"proc_UpdateData".SqlProcedureNonQuery();\n')),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(i.b)("h2",{id:"9133-\u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b"},"9.13.3 \u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b"),Object(i.b)("p",null,"\u5728\u5b58\u50a8\u8fc7\u7a0b\u4e2d\uff0c\u6709\u4e00\u79cd\u4f8b\u5b50\u975e\u5e38\u590d\u6742\uff0c\u90a3\u5c31\u662f\u65e2\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"INPUT")," \u53c2\u6570\uff0c\u53c8\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"OUTPUT")," \u53c2\u6570\uff0c\u8fd8\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"RETURN")," \u53c2\u6570\uff0c\u540c\u65f6\u8fd8\u8f93\u51fa \u7ed3\u679c\u96c6 \ud83d\udca5\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-sql",metastring:"{3,4,10-12,15-17,22}","{3,4,10-12,15-17,22}":!0}),"CREATE PROC PROC_Output\n @Id INT, // \u8f93\u5165\u53c2\u6570\n @Name NVARCHAR(32) OUTPUT, // \u8f93\u51fa\u53c2\u6570\uff0c\u8fd8\u5e26\u957f\u5ea6\n @Age INT OUTPUT // \u8f93\u51fa\u53c2\u6570\nAS\nBEGIN\n SET @Name = 'Fur Output';\n\n // \u8f93\u51fa\u7ed3\u679c\u96c6\n SELECT *\n FROM dbo.Test\n WHERE Id > @Id;\n\n // \u8f93\u51fa\u7ed3\u679c\u96c6\n SELECT TOP 10\n *\n FROM dbo.Test;\n\n SET @Age = 27;\n\n // \u5e26 RETURN \u8fd4\u56de\n RETURN 10;\nEND;\n")),Object(i.b)("h3",{id:"91331-\u521b\u5efa\u53c2\u6570\u6a21\u578b"},"9.13.3.1 \u521b\u5efa\u53c2\u6570\u6a21\u578b"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,10,13,16}","{1,10,13,16}":!0}),"using Fur.DatabaseAccessor;\nusing System.Data;\n\nnamespace Fur.Application\n{\n public class ProcOutputModel\n {\n public int Id { get; set; } // \u8f93\u5165\u53c2\u6570\n\n [DbParameter(ParameterDirection.Output, Size = 32)]\n public string Name { get; set; } // \u8f93\u51fa\u53c2\u6570\n\n [DbParameter(ParameterDirection.Output)]\n public int Age { get; set; } // \u8f93\u51fa\u53c2\u6570\n\n [DbParameter(ParameterDirection.ReturnValue)]\n public int ReturnValue { get; set; } // \u8fd4\u56de\u503c\n }\n}\n")),Object(i.b)("h3",{id:"91332-\u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b"},"9.13.3.2 \u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("strong",{parentName:"li"}," ",Object(i.b)("inlineCode",{parentName:"strong"},"DataSet")," ")," \u65b9\u5f0f")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nProcedureOutputResult result = _sqlRepository.SqlProcedureOutput("proc_Complex", new ProcOutputModel{});\n\n// ISqlDispatchProxy \u65b9\u5f0f\nProcedureOutputResult result = _sqlExecuteProxy.Complex(new ProcOutputModel{}); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nProcedureOutputResult result = _personRepository.SqlProcedureOutput("proc_Complex", new ProcOutputModel{});\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nProcedureOutputResult result = _repository.Sql().SqlProcedureOutput("proc_Complex", new ProcOutputModel{});\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nProcedureOutputResult result = "proc_Complex".SqlProcedureOutput(new ProcOutputModel{});\n')),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u83b7\u53d6 OUTPUT \u53c2\u6570\u503c\nvar outputs = result.OutputValues;\n\n// \u83b7\u53d6 RETURN \u8fd4\u56de\u503c\nvar reval = result.ReturnValue;\n\n// \u83b7\u53d6\u8fd4\u56de\u7ed3\u679c\u96c6\nvar dataSet = result.Result;\n")),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Tuple")," \u65b9\u5f0f")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nProcedureOutputResult<(List, List)> result = _sqlRepository.SqlProcedureOutput<(List, List)>("proc_Complex", new ProcOutputModel{});\n\n// ISqlDispatchProxy \u65b9\u5f0f\nProcedureOutputResult<(List, List)> result = _sqlExecuteProxy.Complex(new ProcOutputModel{}); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nProcedureOutputResult<(List, List)> result = _personRepository.SqlProcedureOutput<(List, List)>("proc_Complex", new ProcOutputModel{});\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nProcedureOutputResult<(List, List)> result = _repository.Sql().SqlProcedureOutput<(List, List)>("proc_Complex", new ProcOutputModel{});\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nProcedureOutputResult<(List, List)> result = "proc_Complex".SqlProcedureOutput<(List, List)>(new ProcOutputModel{});\n')),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u83b7\u53d6 OUTPUT \u53c2\u6570\u503c\nvar outputs = result.OutputValues;\n\n// \u83b7\u53d6 RETURN \u8fd4\u56de\u503c\nvar reval = result.ReturnValue;\n\n// \u83b7\u53d6\u8fd4\u56de\u7ed3\u679c\u96c6\nvar (list1,list2) = result.Result;\n")),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(i.b)("h2",{id:"9133-\u5173\u4e8e-dbparameter"},"9.13.3 \u5173\u4e8e ",Object(i.b)("inlineCode",{parentName:"h2"},"[DbParameter]")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"[DbParameter]")," \u7279\u6027\u662f\u7528\u6765\u6807\u6ce8 ",Object(i.b)("inlineCode",{parentName:"p"},"Sql"),"\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"\u51fd\u6570"),"\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"\u5b58\u50a8\u8fc7\u7a0b")," \u53c2\u6570\u7684\uff0c\u53ef\u914d\u7f6e\u5c5e\u6027\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Direction"),"\uff1a\u8bbe\u7f6e\u53c2\u6570\u65b9\u5411\uff0c",Object(i.b)("inlineCode",{parentName:"li"},"ParameterDirection")," \u679a\u4e3e\u7c7b\u578b\uff0c\u9ed8\u8ba4 ",Object(i.b)("inlineCode",{parentName:"li"},"ParameterDirection.Input")),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"DbType"),"\uff1a\u8bbe\u7f6e\u53c2\u6570\u7c7b\u578b\uff0c",Object(i.b)("inlineCode",{parentName:"li"},"DbType")," \u679a\u4e3e\u7c7b\u578b\uff0c\u65e0\u9ed8\u8ba4"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Size"),"\uff1a\u8bbe\u7f6e\u53c2\u6570\u957f\u5ea6\u7684\uff0c",Object(i.b)("inlineCode",{parentName:"li"},"int")," \u7c7b\u578b")),Object(i.b)("p",null,"\u5176\u4e2d ",Object(i.b)("inlineCode",{parentName:"p"},"Direction")," \u5c5e\u6027\u662f\u9ed8\u8ba4\u6784\u9020\u51fd\u6570\u53c2\u6570\u3002"),Object(i.b)("h2",{id:"9134-\u5173\u4e8e-procedureoutputresult"},"9.13.4 \u5173\u4e8e ",Object(i.b)("inlineCode",{parentName:"h2"},"ProcedureOutputResult")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"ProcedureOutputResult")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"ProcedureOutputResult")," \u662f\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b\u6267\u884c\u8fd4\u56de\u6a21\u578b\u7c7b\uff0c\u6709\u4ee5\u4e0b\u5c5e\u6027\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"OutputValues"),"\uff1a\u591a\u4e2a\u8f93\u51fa\u503c\uff0c",Object(i.b)("inlineCode",{parentName:"li"},"ProcedureOutputValue")," \u7c7b\u578b"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"ReturnValue"),"\uff1a\u8fd4\u56de\u503c\uff0c",Object(i.b)("inlineCode",{parentName:"li"},"object")," \u7c7b\u578b"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Result"),"\uff1a\u7ed3\u679c\u96c6\uff0c\u975e\u6cdb\u578b\u7248\u672c\u662f ",Object(i.b)("inlineCode",{parentName:"li"},"DataSet"),"\u7c7b\u578b\uff0c\u5426\u5219\u662f \u6cdb\u578b\u7c7b\u578b")),Object(i.b)("h2",{id:"9135-\u5b58\u50a8\u8fc7\u7a0b\u53c2\u6570"},"9.13.5 \u5b58\u50a8\u8fc7\u7a0b\u53c2\u6570"),Object(i.b)("p",null,"\u6240\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"sql")," \u53c2\u6570\u90fd\u652f\u6301\u56db\u79cd\u65b9\u5f0f\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"DbParameter[]"),"\uff1a\u6570\u7ec4\u7c7b\u578b"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"new {}"),"\uff1a\u533f\u540d\u7c7b\u578b"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"new Class{}"),"\uff1a\u5f3a\u7c7b\u578b\u7c7b\u578b\uff08\u652f\u6301\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b\u53c2\u6570\uff09"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Dictionary")," \u7c7b\u578b")),Object(i.b)("h2",{id:"9136-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.13.6 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(r.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/1761adf3.1568ad36.js b/docs/1761adf3.1568ad36.js new file mode 100644 index 00000000000..d96af437536 --- /dev/null +++ b/docs/1761adf3.1568ad36.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return O}));var r=n(0),a=n.n(r);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=a.a.createContext({}),b=function(e){var t=a.a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},p=function(e){var t=b(e.components);return a.a.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},d=a.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),p=b(n),d=r,O=p["".concat(i,".").concat(d)]||p[d]||u[d]||l;return n?a.a.createElement(O,c(c({ref:t},s),{},{components:n})):a.a.createElement(O,c({ref:t},s))}));function O(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=d;var c={};for(var o in t)hasOwnProperty.call(t,o)&&(c[o]=t[o]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var s=2;sfunction(e,t,n,{forcePrependBaseUrl:r=!1,absolute:l=!1}={}){if(!n)return n;if(n.startsWith("#"))return n;if(Object(a.b)(n))return n;if(r)return t+n;const i=n.startsWith(t)?n:t+n.replace(/^\//,"");return l?e+i:i}(t,e,n,r)}}function i(e,t={}){const{withBaseUrl:n}=l();return n(e,t)}},145:function(e,t,n){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return a}))},146:function(e,t,n){"use strict";function r(e){var t,n,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;tt.value===e)&&j(e)}const T=e=>{j(e),null!=u&&O(u,e)},P=[],y=e=>{e.metaKey||e.altKey||e.ctrlKey||N(!0)},h=()=>{N(!1)};return Object(r.useEffect)(()=>{window.addEventListener("keydown",y),window.addEventListener("mousedown",h)},[]),a.a.createElement("div",null,a.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(i.a)("tabs",{"tabs--block":t})},p.map(({value:e,label:t})=>a.a.createElement("li",{role:"tab",tabIndex:0,"aria-selected":m===e,className:Object(i.a)("tabs__item",o.a.tabItem,{"tabs__item--active":m===e}),style:v?{}:{outline:"none"},key:e,ref:e=>P.push(e),onKeyDown:e=>{((e,t,n)=>{switch(n.keyCode){case b:((e,t)=>{const n=e.indexOf(t)+1;e[n]?e[n].focus():e[0].focus()})(e,t);break;case s:((e,t)=>{const n=e.indexOf(t)-1;e[n]?e[n].focus():e[e.length-1].focus()})(e,t)}})(P,e.target,e),y(e)},onFocus:()=>T(e),onClick:()=>{T(e),N(!1)},onPointerDown:()=>N(!1)},t))),a.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},r.Children.toArray(n).filter(e=>e.props.value===m)[0]))}},150:function(e,t,n){"use strict";var r=n(0),a=n.n(r);t.a=function(e){return a.a.createElement("div",null,e.children)}},62:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return o})),n.d(t,"metadata",(function(){return s})),n.d(t,"rightToc",(function(){return b})),n.d(t,"default",(function(){return u}));var r=n(2),a=n(6),l=(n(0),n(142)),i=(n(144),n(149)),c=n(150),o={id:"dbcontext-proc",title:"9.13 \u5b58\u50a8\u8fc7\u7a0b\u64cd\u4f5c",sidebar_label:"9.13 \u5b58\u50a8\u8fc7\u7a0b\u64cd\u4f5c"},s={unversionedId:"dbcontext-proc",id:"dbcontext-proc",isDocsHomePage:!1,title:"9.13 \u5b58\u50a8\u8fc7\u7a0b\u64cd\u4f5c",description:"\u63a8\u8350\u4f7f\u7528 \u300a9.15 Sql \u9ad8\u7ea7\u4ee3\u7406\u300b\u4ee3\u66ff\u672c\u7ae0\u8282\u529f\u80fd\u3002Sql \u9ad8\u7ea7\u4ee3\u7406 \u80fd\u591f\u63d0\u4f9b\u66f4\u5bb9\u6613\u4e14\u66f4\u6613\u7ef4\u62a4\u7684\u65b9\u5f0f\u3002",source:"@site/docs\\dbcontext-proc.mdx",slug:"/dbcontext-proc",permalink:"/docs/dbcontext-proc",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/dbcontext-proc.mdx",version:"current",sidebar_label:"9.13 \u5b58\u50a8\u8fc7\u7a0b\u64cd\u4f5c",sidebar:"docs",previous:{title:"9.12 \u89c6\u56fe\u64cd\u4f5c",permalink:"/docs/dbcontext-view"},next:{title:"9.14 \u51fd\u6570\u64cd\u4f5c",permalink:"/docs/dbcontext-function"}},b=[{value:"9.13.1 \u5173\u4e8e\u5b58\u50a8\u8fc7\u7a0b",id:"9131-\u5173\u4e8e\u5b58\u50a8\u8fc7\u7a0b",children:[{value:"9.13.1.1 \u652f\u6301\u5b58\u50a8\u8fc7\u7a0b\u7684\u6570\u636e\u5e93",id:"91311-\u652f\u6301\u5b58\u50a8\u8fc7\u7a0b\u7684\u6570\u636e\u5e93",children:[]}]},{value:"9.13.2 \u5b58\u50a8\u8fc7\u7a0b\u4f7f\u7528",id:"9132-\u5b58\u50a8\u8fc7\u7a0b\u4f7f\u7528",children:[{value:"9.13.2.1 \u521d\u59cb\u5316\u65b9\u5f0f",id:"91321-\u521d\u59cb\u5316\u65b9\u5f0f",children:[]},{value:"9.13.2.2 \u8fd4\u56de DataTable",id:"91322-\u8fd4\u56de-datatable",children:[]},{value:"9.13.2.3 \u8fd4\u56de DataSet",id:"91323-\u8fd4\u56de-dataset",children:[]},{value:"9.13.2.4 \u8fd4\u56de List<T>",id:"91324-\u8fd4\u56de-listt",children:[]},{value:"9.13.2.5 \u8fd4\u56de Tuple<T1,...T8>",id:"91325-\u8fd4\u56de-tuplet1t8",children:[]},{value:"9.13.2.6 \u8fd4\u56de \u5355\u884c\u5355\u5217 object",id:"91326-\u8fd4\u56de-\u5355\u884c\u5355\u5217-object",children:[]},{value:"9.13.2.7 \u8fd4\u56de \u5355\u884c\u5355\u5217 <T>",id:"91327-\u8fd4\u56de-\u5355\u884c\u5355\u5217-t",children:[]},{value:"9.13.2.8 \u6267\u884c\u4f46\u65e0\u8fd4\u56de",id:"91328-\u6267\u884c\u4f46\u65e0\u8fd4\u56de",children:[]}]},{value:"9.13.3 \u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b",id:"9133-\u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b",children:[{value:"9.13.3.1 \u521b\u5efa\u53c2\u6570\u6a21\u578b",id:"91331-\u521b\u5efa\u53c2\u6570\u6a21\u578b",children:[]},{value:"9.13.3.2 \u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b",id:"91332-\u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b",children:[]}]},{value:"9.13.3 \u5173\u4e8e [DbParameter]",id:"9133-\u5173\u4e8e-dbparameter",children:[]},{value:"9.13.4 \u5173\u4e8e ProcedureOutputResult",id:"9134-\u5173\u4e8e-procedureoutputresult",children:[]},{value:"9.13.5 \u5b58\u50a8\u8fc7\u7a0b\u53c2\u6570",id:"9135-\u5b58\u50a8\u8fc7\u7a0b\u53c2\u6570",children:[]},{value:"9.13.6 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9136-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],p={rightToc:b};function u(e){var t=e.components,n=Object(a.a)(e,["components"]);return Object(l.b)("wrapper",Object(r.a)({},p,n,{components:t,mdxType:"MDXLayout"}),Object(l.b)("div",{className:"admonition admonition-important alert alert--info"},Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u6e29\u99a8\u63d0\u793a")),Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\u63a8\u8350\u4f7f\u7528 \u300a",Object(l.b)("a",Object(r.a)({parentName:"p"},{href:"/docs/dbcontext-sql-proxy"}),"9.15 Sql \u9ad8\u7ea7\u4ee3\u7406"),"\u300b\u4ee3\u66ff\u672c\u7ae0\u8282\u529f\u80fd\u3002",Object(l.b)("inlineCode",{parentName:"p"},"Sql \u9ad8\u7ea7\u4ee3\u7406")," \u80fd\u591f\u63d0\u4f9b\u66f4\u5bb9\u6613\u4e14\u66f4\u6613\u7ef4\u62a4\u7684\u65b9\u5f0f\u3002"))),Object(l.b)("h2",{id:"9131-\u5173\u4e8e\u5b58\u50a8\u8fc7\u7a0b"},"9.13.1 \u5173\u4e8e\u5b58\u50a8\u8fc7\u7a0b"),Object(l.b)("p",null,"\u5f15\u7528\u767e\u5ea6\u767e\u79d1\uff1a"),Object(l.b)("blockquote",null,Object(l.b)("p",{parentName:"blockquote"},"\u5b58\u50a8\u8fc7\u7a0b\uff08Stored Procedure\uff09\u662f\u5728\u5927\u578b\u6570\u636e\u5e93\u7cfb\u7edf\u4e2d\uff0c\u4e00\u7ec4\u4e3a\u4e86\u5b8c\u6210\u7279\u5b9a\u529f\u80fd\u7684 SQL \u8bed\u53e5\u96c6\uff0c\u5b83\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\uff0c\u4e00\u6b21\u7f16\u8bd1\u540e\u6c38\u4e45\u6709\u6548\uff0c\u7528\u6237\u901a\u8fc7\u6307\u5b9a\u5b58\u50a8\u8fc7\u7a0b\u7684\u540d\u5b57\u5e76\u7ed9\u51fa\u53c2\u6570\uff08\u5982\u679c\u8be5\u5b58\u50a8\u8fc7\u7a0b\u5e26\u6709\u53c2\u6570\uff09\u6765\u6267\u884c\u5b83\u3002"),Object(l.b)("p",{parentName:"blockquote"},"\u5b58\u50a8\u8fc7\u7a0b\u662f\u6570\u636e\u5e93\u4e2d\u7684\u4e00\u4e2a\u91cd\u8981\u5bf9\u8c61\u3002\u5728\u6570\u636e\u91cf\u7279\u522b\u5e9e\u5927\u7684\u60c5\u51b5\u4e0b\u5229\u7528\u5b58\u50a8\u8fc7\u7a0b\u80fd\u8fbe\u5230\u500d\u901f\u7684\u6548\u7387\u63d0\u5347\u3002")),Object(l.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u5b58\u50a8\u8fc7\u7a0b\u5c31\u662f\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4e2d\uff08",Object(l.b)("inlineCode",{parentName:"p"},"Sqlite")," \u9664\u5916\uff09\u4e2d\u7f16\u5199\u903b\u8f91\u7684\u51fd\u6570/\u65b9\u6cd5\uff0c\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5c06 ",Object(l.b)("inlineCode",{parentName:"p"},"sql")," \u7f16\u8bd1\u7f13\u5b58\u8d77\u6765\uff0c\u5927\u5927\u63d0\u9ad8\u5b58\u50a8\u8fc7\u7a0b\u7684\u6267\u884c\u6548\u7387\u3002"),Object(l.b)("p",null,Object(l.b)("strong",{parentName:"p"},"\u8fd9\u91cc\u4e0d\u8ba8\u8bba\u5b58\u50a8\u8fc7\u7a0b\u7684\u4f18\u7f3a\u70b9\u3002")),Object(l.b)("h3",{id:"91311-\u652f\u6301\u5b58\u50a8\u8fc7\u7a0b\u7684\u6570\u636e\u5e93"},"9.13.1.1 \u652f\u6301\u5b58\u50a8\u8fc7\u7a0b\u7684\u6570\u636e\u5e93"),Object(l.b)("table",null,Object(l.b)("thead",{parentName:"table"},Object(l.b)("tr",{parentName:"thead"},Object(l.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"SqlServer"),Object(l.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Sqlite"),Object(l.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Cosmos"),Object(l.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"InMemoryDatabase"),Object(l.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"MySql"),Object(l.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"PostgreSQL"),Object(l.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Oracle"),Object(l.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Firebird"),Object(l.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Dm"))),Object(l.b)("tbody",{parentName:"table"},Object(l.b)("tr",{parentName:"tbody"},Object(l.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(l.b)("td",Object(r.a)({parentName:"tr"},{align:null})),Object(l.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(l.b)("td",Object(r.a)({parentName:"tr"},{align:null})),Object(l.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(l.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(l.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(l.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(l.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714")))),Object(l.b)("h2",{id:"9132-\u5b58\u50a8\u8fc7\u7a0b\u4f7f\u7528"},"9.13.2 \u5b58\u50a8\u8fc7\u7a0b\u4f7f\u7528"),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\u63d0\u4f9b\u4e86\u591a\u79cd\u5b58\u50a8\u8fc7\u7a0b\u64cd\u4f5c\u65b9\u5f0f\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"ISqlRepository"),"\uff1a",Object(l.b)("inlineCode",{parentName:"li"},"Sql")," \u64cd\u4f5c\u4ed3\u50a8\uff0c\u53ef\u901a\u8fc7 ",Object(l.b)("inlineCode",{parentName:"li"},"\u4f9d\u8d56\u6ce8\u5165")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"ISqlDispatchProxy"),"\uff1a",Object(l.b)("inlineCode",{parentName:"li"},"Sql")," \u4ee3\u7406\u65b9\u5f0f\uff08\u9ad8\u7ea7\u7528\u6cd5\uff0c\u63a8\u8350\uff09"),Object(l.b)("li",{parentName:"ul"},"\u901a\u8fc7\u4efb\u610f\u5b9e\u4f53\u4ed3\u50a8\u64cd\u4f5c\uff1a",Object(l.b)("inlineCode",{parentName:"li"},"personRepository.SqlProcedureQuery(procName)")),Object(l.b)("li",{parentName:"ul"},"\u901a\u8fc7\u5b57\u7b26\u4e32\u62d3\u5c55\u65b9\u6cd5\uff1a",Object(l.b)("inlineCode",{parentName:"li"},"procName.SqlProcedureQuery()")),Object(l.b)("li",{parentName:"ul"},"\u901a\u8fc7 ",Object(l.b)("inlineCode",{parentName:"li"},"repository.Sql().SqlProcedureQuery()")," \u65b9\u5f0f")),Object(l.b)("h3",{id:"91321-\u521d\u59cb\u5316\u65b9\u5f0f"},"9.13.2.1 \u521d\u59cb\u5316\u65b9\u5f0f"),Object(l.b)(i.a,{defaultValue:"one",values:[{label:"ISqlRepository",value:"one"},{label:"ISqlDispatchProxy",value:"two"},{label:"\u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f",value:"three"},{label:"\u5b57\u7b26\u4e32\u62d3\u5c55\u65b9\u5f0f",value:"four"}],mdxType:"Tabs"},Object(l.b)(c.a,{value:"one",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,9-12}","{1,9-12}":!0}),"using Fur.DatabaseAccessor;\nusing Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [DynamicApiController]\n public class SqlService\n {\n private ISqlRepository _sqlRepository;\n public SqlService(ISqlRepository sqlRepository)\n {\n _sqlRepository = sqlRepository;\n }\n }\n}\n"))),Object(l.b)(c.a,{value:"two",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,7,9-10}","{2,7,9-10}":!0}),'using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing System.Collections.Generic;\n\nnamespace Fur.Application\n{\n public interface ISqlExecuteProxy : ISqlDispatchProxy\n {\n [SqlProcedure("proc_GetPersons")]\n List GetPersons(string keyword);\n }\n}\n')),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{9-12}","{9-12}":!0}),"using Fur.DatabaseAccessor;\nusing Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [DynamicApiController]\n public class SqlService\n {\n private ISqlExecuteProxy _sqlExecuteProxy;\n public SqlService(ISqlExecuteProxy sqlExecuteProxy)\n {\n _sqlExecuteProxy = sqlExecuteProxy;\n }\n }\n}\n"))),Object(l.b)(c.a,{value:"three",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'var persons = personRepository.SqlProcedureQuery("proc_GetPersons");\n'))),Object(l.b)(c.a,{value:"four",mdxType:"TabItem"},Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'var persons = "proc_GetPersons".SqlProcedureQuery();\n')))),Object(l.b)("h3",{id:"91322-\u8fd4\u56de-datatable"},"9.13.2.2 \u8fd4\u56de ",Object(l.b)("inlineCode",{parentName:"h3"},"DataTable")),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar dataTable = _sqlRepository.SqlProcedureQuery("proc_GetPersons");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar dataTable = _sqlExecuteProxy.GetPersons(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar dataTable = _personRepository.SqlProcedureQuery("proc_GetPersons");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar dataTable = _repository.Sql().SqlProcedureQuery("proc_GetPersons");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nvar dataTable = "proc_GetPersons".SqlProcedureQuery();\n')),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(l.b)("h3",{id:"91323-\u8fd4\u56de-dataset"},"9.13.2.3 \u8fd4\u56de ",Object(l.b)("inlineCode",{parentName:"h3"},"DataSet")),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar dataSet = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar dataSet = _sqlExecuteProxy.GetPersons(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar dataSet = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar dataSet = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nvar dataSet = "proc_GetPersons".SqlProcedureQueries();\n')),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(l.b)("h3",{id:"91324-\u8fd4\u56de-listt"},"9.13.2.4 \u8fd4\u56de ",Object(l.b)("inlineCode",{parentName:"h3"},"List")),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar list = _sqlRepository.SqlProcedureQuery("proc_GetPersons");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar list = _sqlExecuteProxy.GetPersons(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar list = _personRepository.SqlProcedureQuery("proc_GetPersons");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar list = _repository.Sql().SqlProcedureQuery("proc_GetPersons");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nvar list = "proc_GetPersons".SqlProcedureQuery();\n')),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(l.b)("h3",{id:"91325-\u8fd4\u56de-tuplet1t8"},"9.13.2.5 \u8fd4\u56de ",Object(l.b)("inlineCode",{parentName:"h3"},"Tuple")),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u5927\u5927\u5229\u7528\u4e86 ",Object(l.b)("inlineCode",{parentName:"p"},"Tuple")," \u7684\u7279\u6027\uff0c\u5c06\u8fd4\u56de\u591a\u4e2a\u7ed3\u679c\u96c6\u8f6c\u6210 ",Object(l.b)("inlineCode",{parentName:"p"},"Tuple")," \u7c7b\u578b"),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\n\n// \u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\nvar list1 = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e24\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e09\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u56db\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e94\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516d\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e03\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516b\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7, list8) = _sqlRepository.SqlProcedureQueries("proc_GetPersons");\n\n// ==================================\n\n// ISqlDispatchProxy \u65b9\u5f0f\uff0c\u63a8\u8350\u65b9\u5f0f\uff0c\u81ea\u52a8\u5904\u7406\u591a\u4e2a\u7ed3\u679c\u96c6\n\n// \u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\nvar list1 = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u4e24\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u4e09\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u56db\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u4e94\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u516d\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u4e03\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7) = _sqlRepository.GetDatas();\n\n// \u8fd4\u56de\u516b\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7, list8) = _sqlRepository.GetDatas();\n\n// ==================================\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\n\n// \u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\nvar list1 = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e24\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e09\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u56db\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e94\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516d\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e03\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516b\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7, list8) = _personRepository.SqlProcedureQueries("proc_GetPersons");\n\n// ==================================\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\n\n// \u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\nvar list1 = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e24\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e09\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u56db\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e94\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516d\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u4e03\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// \u8fd4\u56de\u516b\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7, list8) = _repository.Sql().SqlProcedureQueries("proc_GetPersons");\n\n// ==================================\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\n\n// \u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6\nvar list1 = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u4e24\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u4e09\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u56db\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u4e94\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u516d\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u4e03\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7) = "proc_GetPersons".SqlProcedureQueries();\n\n// \u8fd4\u56de\u516b\u4e2a\u7ed3\u679c\u96c6\nvar (list1, list2, list3, list4, list5, list6, list7, list8) = "proc_GetPersons".SqlProcedureQueries();\n')),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(l.b)("h3",{id:"91326-\u8fd4\u56de-\u5355\u884c\u5355\u5217-object"},"9.13.2.6 \u8fd4\u56de ",Object(l.b)("inlineCode",{parentName:"h3"},"\u5355\u884c\u5355\u5217 object")),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlProcedureScalar("proc_GetName");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetName(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlProcedureScalar("proc_GetName");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlProcedureScalar("proc_GetName");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nvar value = "proc_GetName".SqlProcedureScalar();\n')),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(l.b)("h3",{id:"91327-\u8fd4\u56de-\u5355\u884c\u5355\u5217-t"},"9.13.2.7 \u8fd4\u56de ",Object(l.b)("inlineCode",{parentName:"h3"},"\u5355\u884c\u5355\u5217 ")),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlProcedureScalar("proc_GetName");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetName(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlProcedureScalar("proc_GetName");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlProcedureScalar("proc_GetName");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nvar value = "proc_GetName".SqlProcedureScalar();\n')),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(l.b)("h3",{id:"91328-\u6267\u884c\u4f46\u65e0\u8fd4\u56de"},"9.13.2.8 \u6267\u884c\u4f46\u65e0\u8fd4\u56de"),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\n_sqlRepository.SqlProcedureNonQuery("proc_UpdateData");\n\n// ISqlDispatchProxy \u65b9\u5f0f\n_sqlExecuteProxy.UpdateData(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\n_personRepository.SqlProcedureNonQuery("proc_UpdateData");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\n_repository.Sql().SqlProcedureNonQuery("proc_UpdateData");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\n"proc_UpdateData".SqlProcedureNonQuery();\n')),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(l.b)("h2",{id:"9133-\u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b"},"9.13.3 \u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b"),Object(l.b)("p",null,"\u5728\u5b58\u50a8\u8fc7\u7a0b\u4e2d\uff0c\u6709\u4e00\u79cd\u4f8b\u5b50\u975e\u5e38\u590d\u6742\uff0c\u90a3\u5c31\u662f\u65e2\u6709 ",Object(l.b)("inlineCode",{parentName:"p"},"INPUT")," \u53c2\u6570\uff0c\u53c8\u6709 ",Object(l.b)("inlineCode",{parentName:"p"},"OUTPUT")," \u53c2\u6570\uff0c\u8fd8\u6709 ",Object(l.b)("inlineCode",{parentName:"p"},"RETURN")," \u53c2\u6570\uff0c\u540c\u65f6\u8fd8\u8f93\u51fa \u7ed3\u679c\u96c6 \ud83d\udca5\uff0c\u5982\uff1a"),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-sql",metastring:"{3,4,10-12,15-17,22}","{3,4,10-12,15-17,22}":!0}),"CREATE PROC PROC_Output\n @Id INT, // \u8f93\u5165\u53c2\u6570\n @Name NVARCHAR(32) OUTPUT, // \u8f93\u51fa\u53c2\u6570\uff0c\u8fd8\u5e26\u957f\u5ea6\n @Age INT OUTPUT // \u8f93\u51fa\u53c2\u6570\nAS\nBEGIN\n SET @Name = 'Fur Output';\n\n // \u8f93\u51fa\u7ed3\u679c\u96c6\n SELECT *\n FROM dbo.Test\n WHERE Id > @Id;\n\n // \u8f93\u51fa\u7ed3\u679c\u96c6\n SELECT TOP 10\n *\n FROM dbo.Test;\n\n SET @Age = 27;\n\n // \u5e26 RETURN \u8fd4\u56de\n RETURN 10;\nEND;\n")),Object(l.b)("h3",{id:"91331-\u521b\u5efa\u53c2\u6570\u6a21\u578b"},"9.13.3.1 \u521b\u5efa\u53c2\u6570\u6a21\u578b"),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,10,13,16}","{1,10,13,16}":!0}),"using Fur.DatabaseAccessor;\nusing System.Data;\n\nnamespace Fur.Application\n{\n public class ProcOutputModel\n {\n public int Id { get; set; } // \u8f93\u5165\u53c2\u6570\n\n [DbParameter(ParameterDirection.Output, Size = 32)]\n public string Name { get; set; } // \u8f93\u51fa\u53c2\u6570\n\n [DbParameter(ParameterDirection.Output)]\n public int Age { get; set; } // \u8f93\u51fa\u53c2\u6570\n\n [DbParameter(ParameterDirection.ReturnValue)]\n public int ReturnValue { get; set; } // \u8fd4\u56de\u503c\n }\n}\n")),Object(l.b)("h3",{id:"91332-\u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b"},"9.13.3.2 \u6267\u884c\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("strong",{parentName:"li"}," ",Object(l.b)("inlineCode",{parentName:"strong"},"DataSet")," ")," \u65b9\u5f0f")),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nProcedureOutputResult result = _sqlRepository.SqlProcedureOutput("proc_Complex", new ProcOutputModel{});\n\n// ISqlDispatchProxy \u65b9\u5f0f\nProcedureOutputResult result = _sqlExecuteProxy.Complex(new ProcOutputModel{}); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nProcedureOutputResult result = _personRepository.SqlProcedureOutput("proc_Complex", new ProcOutputModel{});\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nProcedureOutputResult result = _repository.Sql().SqlProcedureOutput("proc_Complex", new ProcOutputModel{});\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nProcedureOutputResult result = "proc_Complex".SqlProcedureOutput(new ProcOutputModel{});\n')),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u83b7\u53d6 OUTPUT \u53c2\u6570\u503c\nvar outputs = result.OutputValues;\n\n// \u83b7\u53d6 RETURN \u8fd4\u56de\u503c\nvar reval = result.ReturnValue;\n\n// \u83b7\u53d6\u8fd4\u56de\u7ed3\u679c\u96c6\nvar dataSet = result.Result;\n")),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Tuple")," \u65b9\u5f0f")),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nProcedureOutputResult<(List, List)> result = _sqlRepository.SqlProcedureOutput<(List, List)>("proc_Complex", new ProcOutputModel{});\n\n// ISqlDispatchProxy \u65b9\u5f0f\nProcedureOutputResult<(List, List)> result = _sqlExecuteProxy.Complex(new ProcOutputModel{}); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nProcedureOutputResult<(List, List)> result = _personRepository.SqlProcedureOutput<(List, List)>("proc_Complex", new ProcOutputModel{});\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nProcedureOutputResult<(List, List)> result = _repository.Sql().SqlProcedureOutput<(List, List)>("proc_Complex", new ProcOutputModel{});\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u5b58\u50a8\u8fc7\u7a0b\u540d\u6267\u884c\nProcedureOutputResult<(List, List)> result = "proc_Complex".SqlProcedureOutput<(List, List)>(new ProcOutputModel{});\n')),Object(l.b)("pre",null,Object(l.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u83b7\u53d6 OUTPUT \u53c2\u6570\u503c\nvar outputs = result.OutputValues;\n\n// \u83b7\u53d6 RETURN \u8fd4\u56de\u503c\nvar reval = result.ReturnValue;\n\n// \u83b7\u53d6\u8fd4\u56de\u7ed3\u679c\u96c6\nvar (list1,list2) = result.Result;\n")),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},Object(l.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(l.b)("h2",{id:"9133-\u5173\u4e8e-dbparameter"},"9.13.3 \u5173\u4e8e ",Object(l.b)("inlineCode",{parentName:"h2"},"[DbParameter]")),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"[DbParameter]")," \u7279\u6027\u662f\u7528\u6765\u6807\u6ce8 ",Object(l.b)("inlineCode",{parentName:"p"},"Sql"),"\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"\u51fd\u6570"),"\uff0c",Object(l.b)("inlineCode",{parentName:"p"},"\u5b58\u50a8\u8fc7\u7a0b")," \u53c2\u6570\u7684\uff0c\u53ef\u914d\u7f6e\u5c5e\u6027\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Direction"),"\uff1a\u8bbe\u7f6e\u53c2\u6570\u65b9\u5411\uff0c",Object(l.b)("inlineCode",{parentName:"li"},"ParameterDirection")," \u679a\u4e3e\u7c7b\u578b\uff0c\u9ed8\u8ba4 ",Object(l.b)("inlineCode",{parentName:"li"},"ParameterDirection.Input")),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"DbType"),"\uff1a\u8bbe\u7f6e\u53c2\u6570\u7c7b\u578b\uff0c",Object(l.b)("inlineCode",{parentName:"li"},"DbType")," \u679a\u4e3e\u7c7b\u578b\uff0c\u65e0\u9ed8\u8ba4"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Size"),"\uff1a\u8bbe\u7f6e\u53c2\u6570\u957f\u5ea6\u7684\uff0c",Object(l.b)("inlineCode",{parentName:"li"},"int")," \u7c7b\u578b")),Object(l.b)("p",null,"\u5176\u4e2d ",Object(l.b)("inlineCode",{parentName:"p"},"Direction")," \u5c5e\u6027\u662f\u9ed8\u8ba4\u6784\u9020\u51fd\u6570\u53c2\u6570\u3002"),Object(l.b)("h2",{id:"9134-\u5173\u4e8e-procedureoutputresult"},"9.13.4 \u5173\u4e8e ",Object(l.b)("inlineCode",{parentName:"h2"},"ProcedureOutputResult")),Object(l.b)("p",null,Object(l.b)("inlineCode",{parentName:"p"},"ProcedureOutputResult")," \u548c ",Object(l.b)("inlineCode",{parentName:"p"},"ProcedureOutputResult")," \u662f\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b\u6267\u884c\u8fd4\u56de\u6a21\u578b\u7c7b\uff0c\u6709\u4ee5\u4e0b\u5c5e\u6027\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"OutputValues"),"\uff1a\u591a\u4e2a\u8f93\u51fa\u503c\uff0c",Object(l.b)("inlineCode",{parentName:"li"},"ProcedureOutputValue")," \u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"ReturnValue"),"\uff1a\u8fd4\u56de\u503c\uff0c",Object(l.b)("inlineCode",{parentName:"li"},"object")," \u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Result"),"\uff1a\u7ed3\u679c\u96c6\uff0c\u975e\u6cdb\u578b\u7248\u672c\u662f ",Object(l.b)("inlineCode",{parentName:"li"},"DataSet"),"\u7c7b\u578b\uff0c\u5426\u5219\u662f \u6cdb\u578b\u7c7b\u578b")),Object(l.b)("h2",{id:"9135-\u5b58\u50a8\u8fc7\u7a0b\u53c2\u6570"},"9.13.5 \u5b58\u50a8\u8fc7\u7a0b\u53c2\u6570"),Object(l.b)("p",null,"\u6240\u6709 ",Object(l.b)("inlineCode",{parentName:"p"},"sql")," \u53c2\u6570\u90fd\u652f\u6301\u56db\u79cd\u65b9\u5f0f\uff1a"),Object(l.b)("ul",null,Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"DbParameter[]"),"\uff1a\u6570\u7ec4\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"new {}"),"\uff1a\u533f\u540d\u7c7b\u578b"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"new Class{}"),"\uff1a\u5f3a\u7c7b\u578b\u7c7b\u578b\uff08\u652f\u6301\u590d\u6742\u5b58\u50a8\u8fc7\u7a0b\u53c2\u6570\uff09"),Object(l.b)("li",{parentName:"ul"},Object(l.b)("inlineCode",{parentName:"li"},"Dictionary")," \u7c7b\u578b")),Object(l.b)("h2",{id:"9136-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.13.6 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(l.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(l.b)("h5",{parentName:"div"},Object(l.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(l.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(l.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(l.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(l.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(l.b)("a",Object(r.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/17666df9.a5abd77b.js b/docs/17666df9.40158a0a.js similarity index 99% rename from docs/17666df9.a5abd77b.js rename to docs/17666df9.40158a0a.js index f47742c6460..749ce24b764 100644 --- a/docs/17666df9.a5abd77b.js +++ b/docs/17666df9.40158a0a.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{142:function(e,n,a){"use strict";a.d(n,"a",(function(){return p})),a.d(n,"b",(function(){return w}));var t=a(0),u=a.n(t);function s(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function r(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),a.push.apply(a,t)}return a}function c(e){for(var n=1;n=0||(u[a]=e[a]);return u}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(u[a]=e[a])}return u}var i=u.a.createContext({}),o=function(e){var n=u.a.useContext(i),a=n;return e&&(a="function"==typeof e?e(n):c(c({},n),e)),a},p=function(e){var n=o(e.components);return u.a.createElement(i.Provider,{value:n},e.children)},l={inlineCode:"code",wrapper:function(e){var n=e.children;return u.a.createElement(u.a.Fragment,{},n)}},N=u.a.forwardRef((function(e,n){var a=e.components,t=e.mdxType,s=e.originalType,r=e.parentName,i=d(e,["components","mdxType","originalType","parentName"]),p=o(a),N=t,w=p["".concat(r,".").concat(N)]||p[N]||l[N]||s;return a?u.a.createElement(w,c(c({ref:n},i),{},{components:a})):u.a.createElement(w,c({ref:n},i))}));function w(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var s=a.length,r=new Array(s);r[0]=N;var c={};for(var d in n)hasOwnProperty.call(n,d)&&(c[d]=n[d]);c.originalType=e,c.mdxType="string"==typeof e?e:t,r[1]=c;for(var i=2;iu.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateInclude(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateInclude(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateInclude(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateInclude(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateInclude("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateInclude(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateInclude(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateIncludeAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateIncludeAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateIncludeAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateIncludeAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateIncludeAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateIncludeAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateIncludeAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateIncludeAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"964-\u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.4 \u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateIncludeNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateIncludeNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateIncludeNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateIncludeNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateIncludeNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateIncludeNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateIncludeNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateIncludeNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateIncludeNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateIncludeNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateIncludeNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateIncludeNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateIncludeNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateIncludeNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateIncludeNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateIncludeNowAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"965-\u6392\u9664\u7279\u5b9a\u5217\u66f4\u65b0\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.5 \u6392\u9664\u7279\u5b9a\u5217\u66f4\u65b0\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExclude(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateExclude(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateExclude(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateExclude(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateExclude(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateExclude("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateExclude(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateExclude(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExcludeAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateExcludeAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateExcludeAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateExcludeAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateExcludeAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateExcludeAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateExcludeAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateExcludeAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"966-\u6392\u9664\u7279\u5b9a\u5217\u66f4\u65b0\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.6 \u6392\u9664\u7279\u5b9a\u5217\u66f4\u65b0\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExcludeNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateExcludeNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateExcludeNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateExcludeNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateExcludeNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateExcludeNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateExcludeNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateExcludeNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExcludeNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateExcludeNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateExcludeNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateExcludeNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateExcludeNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateExcludeNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateExcludeNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateExcludeNowAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"967-\u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u6240\u6709\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.7 \u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u6240\u6709\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),"// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExists(user);\n\n// \u793a\u4f8b\u4e8c\nuser.UpdateExists();\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExistsAsync(user);\n\n// \u793a\u4f8b\u4e8c\nawait user.UpdateExistsAsync();\n")),Object(s.b)("h2",{id:"968-\u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u6240\u6709\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.8 \u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u6240\u6709\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),"// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExistsNow(user);\n\n// \u793a\u4f8b\u4e8c\nuser.UpdateExistsNow();\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExistsNowAsync(user);\n\n// \u793a\u4f8b\u4e8c\nawait user.UpdateExistsNowAsync();\n")),Object(s.b)("h2",{id:"969-\u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u90e8\u5206\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.9 \u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u90e8\u5206\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateIncludeExists(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateIncludeExists(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateIncludeExists(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateIncludeExists(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateIncludeExists(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateIncludeExists("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateIncludeExists(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateIncludeExists(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateIncludeExistsAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateIncludeExistsAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateIncludeExistsAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateIncludeExistsAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateIncludeExistsAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateIncludeExistsAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateIncludeExistsAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateIncludeExistsAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"9610-\u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.10 \u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateIncludeExistsNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateIncludeExistsNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateIncludeExistsNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateIncludeExistsNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateIncludeExistsNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateIncludeExistsNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateIncludeExistsNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateIncludeExistsNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateIncludeExistsNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateIncludeExistsNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateIncludeExistsNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateIncludeExistsNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateIncludeExistsNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateIncludeExistsNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateIncludeExistsNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateIncludeExistsNowAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"9611-\u6570\u636e\u5b58\u5728\u624d\u6392\u9664\u7279\u5b9a\u90e8\u5206\u5217\u66f4\u65b0\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.11 \u6570\u636e\u5b58\u5728\u624d\u6392\u9664\u7279\u5b9a\u90e8\u5206\u5217\u66f4\u65b0\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExcludeExists(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateExcludeExists(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateExcludeExists(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateExcludeExists(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateExcludeExists(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateExcludeExists("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateExcludeExists(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateExcludeExists(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExcludeExistsAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateExcludeExistsAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateExcludeExistsAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateExcludeExistsAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateExcludeExistsAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateExcludeExistsAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateExcludeExistsAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateExcludeExistsAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"9612-\u6570\u636e\u5b58\u5728\u624d\u6392\u9664\u7279\u5b9a\u90e8\u5206\u5217\u66f4\u65b0\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.12 \u6570\u636e\u5b58\u5728\u624d\u6392\u9664\u7279\u5b9a\u90e8\u5206\u5217\u66f4\u65b0\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExcludeExistsNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateExcludeExistsNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateExcludeExistsNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateExcludeExistsNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateExcludeExistsNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateExcludeExistsNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateExcludeExistsNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateExcludeExistsNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExcludeExistsNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateExcludeExistsNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateExcludeExistsNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateExcludeExistsNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateExcludeExistsNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateExcludeExistsNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateExcludeExistsNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateExcludeExistsNowAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"9613-\u66f4\u65b0\u591a\u6761\u8bb0\u5f55\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.13 \u66f4\u65b0\u591a\u6761\u8bb0\u5f55\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),"// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.Update(user, user2);\n\n// \u793a\u4f8b\u4e8c\nrepository.Update(new List { user, user2 });\n\n// \u793a\u4f8b\u4e09\nrepository.Update(new[] {user, user2 });\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateAsync(user, user2);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateAsync(new List { user, user2 });\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateAsync(new[] {user, user2 });\n")),Object(s.b)("h2",{id:"9614-\u66f4\u65b0\u591a\u6761\u8bb0\u5f55\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.14 \u66f4\u65b0\u591a\u6761\u8bb0\u5f55\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),"// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateNow(user, user2);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateNow(new List { user, user2 });\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateNow(new[] {user, user2 });\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateNowAsync(user, user2);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateNowAsync(new List { user, user2 });\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateNowAsync(new[] {user, user2 });\n")),Object(s.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(s.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-heading"}),Object(s.b)("h5",{parentName:"div"},Object(s.b)("span",Object(t.a)({parentName:"h5"},{className:"admonition-icon"}),Object(s.b)("svg",Object(t.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(s.b)("path",Object(t.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(s.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-content"}),Object(s.b)("p",{parentName:"div"},"\u6240\u6709\u5e26 ",Object(s.b)("inlineCode",{parentName:"p"},"Now")," \u7ed3\u5c3e\u7684\u8868\u793a\u7acb\u5373\u63d0\u4ea4\u5230\u6570\u636e\u5e93\uff0c\u4e5f\u5c31\u662f\u7acb\u5373\u8c03\u7528 ",Object(s.b)("inlineCode",{parentName:"p"},"SaveChanges")," \u6216 ",Object(s.b)("inlineCode",{parentName:"p"},"SaveChangesAsync"),"\u3002"))),Object(s.b)("h2",{id:"9615-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.6.15 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(s.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(s.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-heading"}),Object(s.b)("h5",{parentName:"div"},Object(s.b)("span",Object(t.a)({parentName:"h5"},{className:"admonition-icon"}),Object(s.b)("svg",Object(t.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(s.b)("path",Object(t.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(s.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-content"}),Object(s.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(s.b)("a",Object(t.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}o.isMDXComponent=!0}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{142:function(e,n,a){"use strict";a.d(n,"a",(function(){return p})),a.d(n,"b",(function(){return w}));var t=a(0),u=a.n(t);function s(e,n,a){return n in e?Object.defineProperty(e,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[n]=a,e}function r(e,n){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),a.push.apply(a,t)}return a}function c(e){for(var n=1;n=0||(u[a]=e[a]);return u}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(u[a]=e[a])}return u}var i=u.a.createContext({}),o=function(e){var n=u.a.useContext(i),a=n;return e&&(a="function"==typeof e?e(n):c(c({},n),e)),a},p=function(e){var n=o(e.components);return u.a.createElement(i.Provider,{value:n},e.children)},l={inlineCode:"code",wrapper:function(e){var n=e.children;return u.a.createElement(u.a.Fragment,{},n)}},N=u.a.forwardRef((function(e,n){var a=e.components,t=e.mdxType,s=e.originalType,r=e.parentName,i=d(e,["components","mdxType","originalType","parentName"]),p=o(a),N=t,w=p["".concat(r,".").concat(N)]||p[N]||l[N]||s;return a?u.a.createElement(w,c(c({ref:n},i),{},{components:a})):u.a.createElement(w,c({ref:n},i))}));function w(e,n){var a=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var s=a.length,r=new Array(s);r[0]=N;var c={};for(var d in n)hasOwnProperty.call(n,d)&&(c[d]=n[d]);c.originalType=e,c.mdxType="string"==typeof e?e:t,r[1]=c;for(var i=2;iu.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateInclude(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateInclude(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateInclude(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateInclude(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateInclude("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateInclude(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateInclude(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateIncludeAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateIncludeAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateIncludeAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateIncludeAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateIncludeAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateIncludeAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateIncludeAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateIncludeAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"964-\u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.4 \u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateIncludeNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateIncludeNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateIncludeNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateIncludeNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateIncludeNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateIncludeNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateIncludeNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateIncludeNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateIncludeNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateIncludeNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateIncludeNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateIncludeNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateIncludeNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateIncludeNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateIncludeNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateIncludeNowAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"965-\u6392\u9664\u7279\u5b9a\u5217\u66f4\u65b0\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.5 \u6392\u9664\u7279\u5b9a\u5217\u66f4\u65b0\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExclude(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateExclude(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateExclude(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateExclude(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateExclude(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateExclude("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateExclude(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateExclude(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExcludeAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateExcludeAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateExcludeAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateExcludeAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateExcludeAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateExcludeAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateExcludeAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateExcludeAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"966-\u6392\u9664\u7279\u5b9a\u5217\u66f4\u65b0\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.6 \u6392\u9664\u7279\u5b9a\u5217\u66f4\u65b0\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExcludeNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateExcludeNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateExcludeNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateExcludeNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateExcludeNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateExcludeNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateExcludeNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateExcludeNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExcludeNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateExcludeNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateExcludeNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateExcludeNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateExcludeNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateExcludeNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateExcludeNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateExcludeNowAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"967-\u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u6240\u6709\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.7 \u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u6240\u6709\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),"// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExists(user);\n\n// \u793a\u4f8b\u4e8c\nuser.UpdateExists();\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExistsAsync(user);\n\n// \u793a\u4f8b\u4e8c\nawait user.UpdateExistsAsync();\n")),Object(s.b)("h2",{id:"968-\u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u6240\u6709\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.8 \u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u6240\u6709\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),"// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExistsNow(user);\n\n// \u793a\u4f8b\u4e8c\nuser.UpdateExistsNow();\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExistsNowAsync(user);\n\n// \u793a\u4f8b\u4e8c\nawait user.UpdateExistsNowAsync();\n")),Object(s.b)("h2",{id:"969-\u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u90e8\u5206\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.9 \u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u90e8\u5206\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateIncludeExists(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateIncludeExists(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateIncludeExists(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateIncludeExists(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateIncludeExists(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateIncludeExists("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateIncludeExists(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateIncludeExists(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateIncludeExistsAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateIncludeExistsAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateIncludeExistsAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateIncludeExistsAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateIncludeExistsAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateIncludeExistsAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateIncludeExistsAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateIncludeExistsAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"9610-\u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.10 \u6570\u636e\u5b58\u5728\u624d\u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateIncludeExistsNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateIncludeExistsNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateIncludeExistsNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateIncludeExistsNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateIncludeExistsNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateIncludeExistsNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateIncludeExistsNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateIncludeExistsNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateIncludeExistsNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateIncludeExistsNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateIncludeExistsNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateIncludeExistsNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateIncludeExistsNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateIncludeExistsNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateIncludeExistsNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateIncludeExistsNowAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"9611-\u6570\u636e\u5b58\u5728\u624d\u6392\u9664\u7279\u5b9a\u90e8\u5206\u5217\u66f4\u65b0\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.11 \u6570\u636e\u5b58\u5728\u624d\u6392\u9664\u7279\u5b9a\u90e8\u5206\u5217\u66f4\u65b0\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExcludeExists(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateExcludeExists(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateExcludeExists(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateExcludeExists(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateExcludeExists(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateExcludeExists("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateExcludeExists(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateExcludeExists(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExcludeExistsAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateExcludeExistsAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateExcludeExistsAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateExcludeExistsAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateExcludeExistsAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateExcludeExistsAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateExcludeExistsAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateExcludeExistsAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"9612-\u6570\u636e\u5b58\u5728\u624d\u6392\u9664\u7279\u5b9a\u90e8\u5206\u5217\u66f4\u65b0\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.12 \u6570\u636e\u5b58\u5728\u624d\u6392\u9664\u7279\u5b9a\u90e8\u5206\u5217\u66f4\u65b0\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateExcludeExistsNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateExcludeExistsNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateExcludeExistsNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.UpdateExcludeExistsNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.UpdateExcludeExistsNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.UpdateExcludeExistsNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.UpdateExcludeExistsNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.UpdateExcludeExistsNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateExcludeExistsNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateExcludeExistsNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateExcludeExistsNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.UpdateExcludeExistsNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.UpdateExcludeExistsNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.UpdateExcludeExistsNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.UpdateExcludeExistsNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.UpdateExcludeExistsNowAsync(new[] {"Age", "Name"});\n')),Object(s.b)("h2",{id:"9613-\u66f4\u65b0\u591a\u6761\u8bb0\u5f55\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.13 \u66f4\u65b0\u591a\u6761\u8bb0\u5f55\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),"// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.Update(user, user2);\n\n// \u793a\u4f8b\u4e8c\nrepository.Update(new List { user, user2 });\n\n// \u793a\u4f8b\u4e09\nrepository.Update(new[] {user, user2 });\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateAsync(user, user2);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateAsync(new List { user, user2 });\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateAsync(new[] {user, user2 });\n")),Object(s.b)("h2",{id:"9614-\u66f4\u65b0\u591a\u6761\u8bb0\u5f55\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.6.14 \u66f4\u65b0\u591a\u6761\u8bb0\u5f55\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(s.b)("pre",null,Object(s.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),"// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.UpdateNow(user, user2);\n\n// \u793a\u4f8b\u4e8c\nrepository.UpdateNow(new List { user, user2 });\n\n// \u793a\u4f8b\u4e09\nrepository.UpdateNow(new[] {user, user2 });\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.UpdateNowAsync(user, user2);\n\n// \u793a\u4f8b\u4e8c\nawait repository.UpdateNowAsync(new List { user, user2 });\n\n// \u793a\u4f8b\u4e09\nawait repository.UpdateNowAsync(new[] {user, user2 });\n")),Object(s.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(s.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-heading"}),Object(s.b)("h5",{parentName:"div"},Object(s.b)("span",Object(t.a)({parentName:"h5"},{className:"admonition-icon"}),Object(s.b)("svg",Object(t.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(s.b)("path",Object(t.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(s.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-content"}),Object(s.b)("p",{parentName:"div"},"\u6240\u6709\u5e26 ",Object(s.b)("inlineCode",{parentName:"p"},"Now")," \u7ed3\u5c3e\u7684\u8868\u793a\u7acb\u5373\u63d0\u4ea4\u5230\u6570\u636e\u5e93\uff0c\u4e5f\u5c31\u662f\u7acb\u5373\u8c03\u7528 ",Object(s.b)("inlineCode",{parentName:"p"},"SaveChanges")," \u6216 ",Object(s.b)("inlineCode",{parentName:"p"},"SaveChangesAsync"),"\u3002"))),Object(s.b)("h2",{id:"9615-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.6.15 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(s.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(s.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-heading"}),Object(s.b)("h5",{parentName:"div"},Object(s.b)("span",Object(t.a)({parentName:"h5"},{className:"admonition-icon"}),Object(s.b)("svg",Object(t.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(s.b)("path",Object(t.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(s.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-content"}),Object(s.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(s.b)("a",Object(t.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}o.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/17896441.9aece880.js b/docs/17896441.9aece880.js deleted file mode 100644 index 1d00987bd66..00000000000 --- a/docs/17896441.9aece880.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{138:function(e,t,a){"use strict";a.r(t);var n=a(0),l=a.n(n),r=a(155),i=a(143),c=a(144),m=a(151);var o=function(e){var t=e.metadata;return l.a.createElement("nav",{className:"pagination-nav","aria-label":"Blog list page navigation"},l.a.createElement("div",{className:"pagination-nav__item"},t.previous&&l.a.createElement(m.a,{className:"pagination-nav__link",to:t.previous.permalink},l.a.createElement("div",{className:"pagination-nav__sublabel"},"Previous"),l.a.createElement("div",{className:"pagination-nav__label"},"\xab ",t.previous.title))),l.a.createElement("div",{className:"pagination-nav__item pagination-nav__item--next"},t.next&&l.a.createElement(m.a,{className:"pagination-nav__link",to:t.next.permalink},l.a.createElement("div",{className:"pagination-nav__sublabel"},"Next"),l.a.createElement("div",{className:"pagination-nav__label"},t.next.title," \xbb"))))},s=a(158);var d=function(){var e=Object(i.a)().siteConfig.title,t=Object(s.useActivePlugin)({failfast:!0}).pluginId,a=Object(s.useActiveVersion)(t),n=Object(s.useDocVersionSuggestions)(t),r=n.latestDocSuggestion,c=n.latestVersionSuggestion;if(!c)return l.a.createElement(l.a.Fragment,null);var o,d=null!=r?r:(o=c).docs.find((function(e){return e.id===o.mainDocId}));return l.a.createElement("div",{className:"alert alert--warning margin-bottom--md",role:"alert"},"current"===a.name?l.a.createElement("div",null,"This is unreleased documentation for ",e," ",l.a.createElement("strong",null,a.label)," version."):l.a.createElement("div",null,"This is documentation for ",e," ",l.a.createElement("strong",null,a.label),", which is no longer actively maintained."),l.a.createElement("div",{className:"margin-top--md"},"For up-to-date documentation, see the"," ",l.a.createElement("strong",null,l.a.createElement(m.a,{to:d.path},"latest version"))," ","(",c.label,")."))},u=a(162),v=a(146),g=a(61),E=a.n(g);t.default=function(e){var t,a=Object(i.a)().siteConfig,n=void 0===a?{}:a,m=n.url,g=n.title,p=n.titleDelimiter,f=e.content,b=f.metadata,h=b.description,N=b.title,_=b.permalink,w=b.editUrl,y=b.lastUpdatedAt,O=b.lastUpdatedBy,k=f.frontMatter,j=k.image,C=k.keywords,x=k.hide_title,I=k.hide_table_of_contents,L=Object(s.useActivePlugin)({failfast:!0}).pluginId,A=Object(s.useVersions)(L),S=Object(s.useActiveVersion)(L),D=A.length>1,T=N?N+" "+p+" "+g:g,B=Object(c.a)(j,{absolute:!0});return l.a.createElement(l.a.Fragment,null,l.a.createElement(r.a,null,l.a.createElement("title",null,T),l.a.createElement("meta",{property:"og:title",content:T}),h&&l.a.createElement("meta",{name:"description",content:h}),h&&l.a.createElement("meta",{property:"og:description",content:h}),C&&C.length&&l.a.createElement("meta",{name:"keywords",content:C.join(",")}),j&&l.a.createElement("meta",{property:"og:image",content:B}),j&&l.a.createElement("meta",{property:"twitter:image",content:B}),j&&l.a.createElement("meta",{name:"twitter:image:alt",content:"Image for "+N}),_&&l.a.createElement("meta",{property:"og:url",content:m+_}),_&&l.a.createElement("link",{rel:"canonical",href:m+_})),l.a.createElement("div",{className:Object(v.a)("container padding-vert--lg",E.a.docItemWrapper)},l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:Object(v.a)("col",(t={},t[E.a.docItemCol]=!I,t))},l.a.createElement(d,null),l.a.createElement("div",{className:E.a.docItemContainer},l.a.createElement("article",null,D&&l.a.createElement("div",null,l.a.createElement("span",{className:"badge badge--secondary"},"Version: ",S.label)),!x&&l.a.createElement("header",null,l.a.createElement("h1",{className:E.a.docTitle},N)),l.a.createElement("div",{className:"markdown"},l.a.createElement(f,null))),(w||y||O)&&l.a.createElement("div",{className:"margin-vert--xl"},l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col"},w&&l.a.createElement("a",{href:w,target:"_blank",rel:"noreferrer noopener"},l.a.createElement("svg",{fill:"currentColor",height:"1.2em",width:"1.2em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 40 40",style:{marginRight:"0.3em",verticalAlign:"sub"}},l.a.createElement("g",null,l.a.createElement("path",{d:"m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"}))),"Edit this page")),(y||O)&&l.a.createElement("div",{className:"col text--right"},l.a.createElement("em",null,l.a.createElement("small",null,"Last updated"," ",y&&l.a.createElement(l.a.Fragment,null,"on"," ",l.a.createElement("time",{dateTime:new Date(1e3*y).toISOString(),className:E.a.docLastUpdatedAt},new Date(1e3*y).toLocaleDateString()),O&&" "),O&&l.a.createElement(l.a.Fragment,null,"by ",l.a.createElement("strong",null,O)),!1))))),l.a.createElement("div",{className:"margin-vert--lg"},l.a.createElement(o,{metadata:b})))),!I&&f.rightToc&&l.a.createElement("div",{className:"col col--3"},l.a.createElement(u.a,{headings:f.rightToc})))))}},162:function(e,t,a){"use strict";var n=a(0),l=a.n(n);var r=function(e,t,a){var l=Object(n.useState)(void 0),r=l[0],i=l[1];Object(n.useEffect)((function(){var n,l;function c(){var c=function(){var e=0,t=null;for(n=document.getElementsByClassName("anchor");e=0&&r<=a&&(t=l),e+=1}return t}();if(c){var m=0,o=!1;for(l=document.getElementsByClassName(e);me.id===o.mainDocId);var o;return l.a.createElement("div",{className:"alert alert--warning margin-bottom--md",role:"alert"},"current"===a.name?l.a.createElement("div",null,"This is unreleased documentation for ",e," ",l.a.createElement("strong",null,a.label)," version."):l.a.createElement("div",null,"This is documentation for ",e," ",l.a.createElement("strong",null,a.label),", which is no longer actively maintained."),l.a.createElement("div",{className:"margin-top--md"},"For up-to-date documentation, see the"," ",l.a.createElement("strong",null,l.a.createElement(s.a,{to:c.path},"latest version"))," ","(",r.label,")."))},u=a(164),g=a(146),E=a(64),v=a.n(E);t.default=function(e){const{siteConfig:t={}}=Object(i.a)(),{url:a,title:n,titleDelimiter:s}=t,{content:E}=e,{metadata:p}=E,{description:f,title:b,permalink:h,editUrl:N,lastUpdatedAt:_,lastUpdatedBy:w}=p,{frontMatter:{image:y,keywords:O,hide_title:k,hide_table_of_contents:j}}=E,{pluginId:C}=Object(m.useActivePlugin)({failfast:!0}),x=Object(m.useVersions)(C),I=Object(m.useActiveVersion)(C),L=x.length>1,A=b?`${b} ${s} ${n}`:n,S=Object(c.a)(y,{absolute:!0});return l.a.createElement(l.a.Fragment,null,l.a.createElement(r.a,null,l.a.createElement("title",null,A),l.a.createElement("meta",{property:"og:title",content:A}),f&&l.a.createElement("meta",{name:"description",content:f}),f&&l.a.createElement("meta",{property:"og:description",content:f}),O&&O.length&&l.a.createElement("meta",{name:"keywords",content:O.join(",")}),y&&l.a.createElement("meta",{property:"og:image",content:S}),y&&l.a.createElement("meta",{property:"twitter:image",content:S}),y&&l.a.createElement("meta",{name:"twitter:image:alt",content:"Image for "+b}),h&&l.a.createElement("meta",{property:"og:url",content:a+h}),h&&l.a.createElement("link",{rel:"canonical",href:a+h})),l.a.createElement("div",{className:Object(g.a)("container padding-vert--lg",v.a.docItemWrapper)},l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:Object(g.a)("col",{[v.a.docItemCol]:!j})},l.a.createElement(d,null),l.a.createElement("div",{className:v.a.docItemContainer},l.a.createElement("article",null,L&&l.a.createElement("div",null,l.a.createElement("span",{className:"badge badge--secondary"},"Version: ",I.label)),!k&&l.a.createElement("header",null,l.a.createElement("h1",{className:v.a.docTitle},b)),l.a.createElement("div",{className:"markdown"},l.a.createElement(E,null))),(N||_||w)&&l.a.createElement("div",{className:"margin-vert--xl"},l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col"},N&&l.a.createElement("a",{href:N,target:"_blank",rel:"noreferrer noopener"},l.a.createElement("svg",{fill:"currentColor",height:"1.2em",width:"1.2em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 40 40",style:{marginRight:"0.3em",verticalAlign:"sub"}},l.a.createElement("g",null,l.a.createElement("path",{d:"m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"}))),"Edit this page")),(_||w)&&l.a.createElement("div",{className:"col text--right"},l.a.createElement("em",null,l.a.createElement("small",null,"Last updated"," ",_&&l.a.createElement(l.a.Fragment,null,"on"," ",l.a.createElement("time",{dateTime:new Date(1e3*_).toISOString(),className:v.a.docLastUpdatedAt},new Date(1e3*_).toLocaleDateString()),w&&" "),w&&l.a.createElement(l.a.Fragment,null,"by ",l.a.createElement("strong",null,w)),!1))))),l.a.createElement("div",{className:"margin-vert--lg"},l.a.createElement(o,{metadata:p})))),!j&&E.rightToc&&l.a.createElement("div",{className:"col col--3"},l.a.createElement(u.a,{headings:E.rightToc})))))}},164:function(e,t,a){"use strict";var n=a(0),l=a.n(n);var r=function(e,t,a){const[l,r]=Object(n.useState)(void 0);Object(n.useEffect)(()=>{let n,i;function c(){const c=function(){let e=0,t=null;for(n=document.getElementsByClassName("anchor");e=0&&r<=a&&(t=l),e+=1}return t}();if(c){let a=0,n=!1;for(i=document.getElementsByClassName(e);a{document.removeEventListener("scroll",c),document.removeEventListener("resize",c)}})},i=a(48),c=a.n(i);const s="table-of-contents__link";function o({headings:e,isChild:t}){return e.length?l.a.createElement("ul",{className:t?"":"table-of-contents table-of-contents__left-border"},e.map(e=>l.a.createElement("li",{key:e.id},l.a.createElement("a",{href:"#"+e.id,className:s,dangerouslySetInnerHTML:{__html:e.value}}),l.a.createElement(o,{isChild:!0,headings:e.children})))):null}t.a=function({headings:e}){return r(s,"table-of-contents__link--active",100),l.a.createElement("div",{className:c.a.tableOfContents},l.a.createElement(o,{headings:e}))}}}]); \ No newline at end of file diff --git a/docs/1be78505.572787d1.js b/docs/1be78505.572787d1.js new file mode 100644 index 00000000000..ff964672eb4 --- /dev/null +++ b/docs/1be78505.572787d1.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{154:function(n,o,w){"use strict";var a=w(151);w.d(o,"a",(function(){return a.a}))}}]); \ No newline at end of file diff --git a/docs/1be78505.5f3cad14.js b/docs/1be78505.5f3cad14.js deleted file mode 100644 index b717f8db264..00000000000 --- a/docs/1be78505.5f3cad14.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[11,85],{139:function(e,t,a){"use strict";a.r(t);var n=a(0),l=a.n(n),c=a(142),i=a(143),r=a(22),o=a(153),s=a(2),u=a(6),m=a(146),b=a(148),d=a(166),v=a(167),f=a(168),h=a(165),p=a(151),k=a(145),E=a(62),O=a.n(E);var g=function e(t,a){return"link"===t.type?(n=t.href,l=a,(c=function(e){return e.endsWith("/")?e:e+"/"})(n)===c(l)):"category"===t.type&&t.items.some((function(t){return e(t,a)}));var n,l,c};function j(e){var t,a,c,i=e.item,r=e.onItemClick,o=e.collapsible,b=e.activePath,d=Object(u.a)(e,["item","onItemClick","collapsible","activePath"]),v=i.items,f=i.label,h=g(i,b),p=(a=h,c=Object(n.useRef)(a),Object(n.useEffect)((function(){c.current=a}),[a]),c.current),k=Object(n.useState)((function(){return!!o&&(!h&&i.collapsed)})),E=k[0],j=k[1];Object(n.useEffect)((function(){h&&!p&&E&&j(!1)}),[h,p,E]);var C=Object(n.useCallback)((function(e){e.preventDefault(),j((function(e){return!e}))}),[j]);return 0===v.length?null:l.a.createElement("li",{className:Object(m.a)("menu__list-item",{"menu__list-item--collapsed":E}),key:f},l.a.createElement("a",Object(s.a)({className:Object(m.a)("menu__link",(t={"menu__link--sublist":o,"menu__link--active":o&&h},t[O.a.menuLinkText]=!o,t)),onClick:o?C:void 0,href:o?"#!":void 0},d),f),l.a.createElement("ul",{className:"menu__list"},v.map((function(e){return l.a.createElement(_,{tabIndex:E?"-1":"0",key:e.label,item:e,onItemClick:r,collapsible:o,activePath:b})}))))}function C(e){var t=e.item,a=e.onItemClick,n=e.activePath,c=(e.collapsible,Object(u.a)(e,["item","onItemClick","activePath","collapsible"])),i=t.href,r=t.label,o=g(t,n);return l.a.createElement("li",{className:"menu__list-item",key:r},l.a.createElement(p.a,Object(s.a)({className:Object(m.a)("menu__link",{"menu__link--active":o}),to:i},Object(k.a)(i)?{isNavLink:!0,exact:!0,onClick:a}:{target:"_blank",rel:"noreferrer noopener"},c),r))}function _(e){switch(e.item.type){case"category":return l.a.createElement(j,e);case"link":default:return l.a.createElement(C,e)}}var N=function(e){var t,a,c=e.path,r=e.sidebar,o=e.sidebarCollapsible,u=void 0===o||o,k=Object(n.useState)(!1),E=k[0],g=k[1],j=Object(i.a)(),C=j.siteConfig,N=(C=void 0===C?{}:C).themeConfig,w=(N=void 0===N?{}:N).navbar,y=(w=void 0===w?{}:w).title,M=void 0===y?"":y,I=w.hideOnScroll,P=void 0!==I&&I,L=j.isClient,x=Object(f.a)(),S=x.logoLink,W=x.logoLinkProps,R=x.logoImageUrl,A=x.logoAlt,B=Object(b.a)().isAnnouncementBarClosed,D=Object(h.a)().scrollY;Object(d.a)(E);var F=Object(v.a)();return Object(n.useEffect)((function(){F===v.b.desktop&&g(!1)}),[F]),l.a.createElement("div",{className:Object(m.a)(O.a.sidebar,(t={},t[O.a.sidebarWithHideableNavbar]=P,t))},P&&l.a.createElement(p.a,Object(s.a)({tabIndex:-1,className:O.a.sidebarLogo,to:S},W),null!=R&&l.a.createElement("img",{key:L,src:R,alt:A}),null!=M&&l.a.createElement("strong",null,M)),l.a.createElement("div",{className:Object(m.a)("menu","menu--responsive",O.a.menu,(a={"menu--show":E},a[O.a.menuWithAnnouncementBar]=!B&&0===D,a))},l.a.createElement("button",{"aria-label":E?"Close Menu":"Open Menu","aria-haspopup":"true",className:"button button--secondary button--sm menu__button",type:"button",onClick:function(){g(!E)}},E?l.a.createElement("span",{className:Object(m.a)(O.a.sidebarMenuIcon,O.a.sidebarMenuCloseIcon)},"\xd7"):l.a.createElement("svg",{"aria-label":"Menu",className:O.a.sidebarMenuIcon,xmlns:"http://www.w3.org/2000/svg",height:24,width:24,viewBox:"0 0 32 32",role:"img",focusable:"false"},l.a.createElement("title",null,"Menu"),l.a.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))),l.a.createElement("ul",{className:"menu__list"},r.map((function(e){return l.a.createElement(_,{key:e.label,item:e,onItemClick:function(e){e.target.blur(),g(!1)},collapsible:u,activePath:c})})))))},w=a(159),y=a(163),M=a(157),I=a(155),P=a(67),L=a.n(P);function x(e){var t=e.version,a=e.isLast?[t,"latest"]:[t];return l.a.createElement(I.a,null,l.a.createElement("meta",{name:"docsearch:version",content:a.join(",")}))}function S(e){var t,a,n=e.currentDocRoute,r=e.versionMetadata,s=e.children,u=Object(i.a)(),m=u.siteConfig,b=u.isClient,d=r.permalinkToSidebar,v=r.docsSidebars,f=r.version,h=r.isLast,p=d[n.path],k=v[p];return l.a.createElement(l.a.Fragment,null,l.a.createElement(x,{version:f,isLast:h}),l.a.createElement(o.a,{key:b},l.a.createElement("div",{className:L.a.docPage},k&&l.a.createElement("div",{className:L.a.docSidebarContainer,role:"complementary"},l.a.createElement(N,{key:p,sidebar:k,path:n.path,sidebarCollapsible:null===(t=null===(a=m.themeConfig)||void 0===a?void 0:a.sidebarCollapsible)||void 0===t||t})),l.a.createElement("main",{className:L.a.docMainContainer},l.a.createElement(c.a,{components:w.a},s)))))}t.default=function(e){var t=e.route.routes,a=e.versionMetadata,n=e.location,c=t.find((function(e){return Object(M.matchPath)(n.pathname,e)}));return c?l.a.createElement(S,{currentDocRoute:c,versionMetadata:a},Object(r.a)(t)):l.a.createElement(y.default,e)}},154:function(e,t,a){"use strict";var n=a(152);a.d(t,"a",(function(){return n.a}))},163:function(e,t,a){"use strict";a.r(t);var n=a(0),l=a.n(n),c=a(153);t.default=function(){return l.a.createElement(c.a,{title:"Page Not Found"},l.a.createElement("div",{className:"container margin-vert--xl"},l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col col--6 col--offset-3"},l.a.createElement("h1",{className:"hero__title"},"Page Not Found"),l.a.createElement("p",null,"We could not find what you were looking for."),l.a.createElement("p",null,"Please contact the owner of the site that linked you to the original URL and let them know their link is broken.")))))}}}]); \ No newline at end of file diff --git a/docs/1d7b962e.4baa59fe.js b/docs/1d7b962e.0af032df.js similarity index 99% rename from docs/1d7b962e.4baa59fe.js rename to docs/1d7b962e.0af032df.js index 7f17b2e3c7c..68f086d7f2a 100644 --- a/docs/1d7b962e.4baa59fe.js +++ b/docs/1d7b962e.0af032df.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{142:function(e,n,r){"use strict";r.d(n,"a",(function(){return i})),r.d(n,"b",(function(){return m}));var t=r(0),a=r.n(t);function u(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function s(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function c(e){for(var n=1;n=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var d=a.a.createContext({}),p=function(e){var n=a.a.useContext(d),r=n;return e&&(r="function"==typeof e?e(n):c(c({},n),e)),r},i=function(e){var n=p(e.components);return a.a.createElement(d.Provider,{value:n},e.children)},l={inlineCode:"code",wrapper:function(e){var n=e.children;return a.a.createElement(a.a.Fragment,{},n)}},O=a.a.forwardRef((function(e,n){var r=e.components,t=e.mdxType,u=e.originalType,s=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),i=p(r),O=t,m=i["".concat(s,".").concat(O)]||i[O]||l[O]||u;return r?a.a.createElement(m,c(c({ref:n},d),{},{components:r})):a.a.createElement(m,c({ref:n},d))}));function m(e,n){var r=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var u=r.length,s=new Array(u);s[0]=O;var c={};for(var o in n)hasOwnProperty.call(n,o)&&(c[o]=n[o]);c.originalType=e,c.mdxType="string"==typeof e?e:t,s[1]=c;for(var d=2;du.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.InsertOrUpdateInclude(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.InsertOrUpdateInclude(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.InsertOrUpdateInclude(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.InsertOrUpdateInclude(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.InsertOrUpdateInclude("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.InsertOrUpdateInclude(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.InsertOrUpdateInclude(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.InsertOrUpdateIncludeAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.InsertOrUpdateIncludeAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.InsertOrUpdateIncludeAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.InsertOrUpdateIncludeAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.InsertOrUpdateIncludeAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.InsertOrUpdateIncludeAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.InsertOrUpdateIncludeAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.InsertOrUpdateIncludeAsync(new[] {"Age", "Name"});\n')),Object(u.b)("h2",{id:"974-\u65b0\u589e\u6216\u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.7.4 \u65b0\u589e\u6216\u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(u.b)("pre",null,Object(u.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.InsertOrUpdateIncludeNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.InsertOrUpdateIncludeNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.InsertOrUpdateIncludeNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.InsertOrUpdateIncludeNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.InsertOrUpdateIncludeNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.InsertOrUpdateIncludeNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.InsertOrUpdateIncludeNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.InsertOrUpdateIncludeNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.InsertOrUpdateIncludeNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.InsertOrUpdateIncludeNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.InsertOrUpdateIncludeNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.InsertOrUpdateIncludeNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.InsertOrUpdateIncludeNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.InsertOrUpdateIncludeNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.InsertOrUpdateIncludeNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.InsertOrUpdateIncludeNowAsync(new[] {"Age", "Name"});\n')),Object(u.b)("h2",{id:"975-\u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.7.5 \u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(u.b)("pre",null,Object(u.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.InsertOrUpdateExclude(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.InsertOrUpdateExclude(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.InsertOrUpdateExclude(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.InsertOrUpdateExclude(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.InsertOrUpdateExclude(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.InsertOrUpdateExclude("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.InsertOrUpdateExclude(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.InsertOrUpdateExclude(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.InsertOrUpdateExcludeAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.InsertOrUpdateExcludeAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.InsertOrUpdateExcludeAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.InsertOrUpdateExcludeAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.InsertOrUpdateExcludeAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.InsertOrUpdateExcludeAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.InsertOrUpdateExcludeAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.InsertOrUpdateExcludeAsync(new[] {"Age", "Name"});\n')),Object(u.b)("h2",{id:"976-\u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.7.6 \u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(u.b)("pre",null,Object(u.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.InsertOrUpdateExcludeNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.InsertOrUpdateExcludeNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.InsertOrUpdateExcludeNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.InsertOrUpdateExcludeNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.InsertOrUpdateExcludeNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.InsertOrUpdateExcludeNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.InsertOrUpdateExcludeNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.InsertOrUpdateExcludeNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.InsertOrUpdateExcludeNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.InsertOrUpdateExcludeNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.InsertOrUpdateExcludeNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.InsertOrUpdateExcludeNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.InsertOrUpdateExcludeNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.InsertOrUpdateExcludeNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.InsertOrUpdateExcludeNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.InsertOrUpdateExcludeNowAsync(new[] {"Age", "Name"});\n')),Object(u.b)("h2",{id:"957-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.5.7 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(u.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(u.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-heading"}),Object(u.b)("h5",{parentName:"div"},Object(u.b)("span",Object(t.a)({parentName:"h5"},{className:"admonition-icon"}),Object(u.b)("svg",Object(t.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(u.b)("path",Object(t.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(u.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-content"}),Object(u.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(u.b)("a",Object(t.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}p.isMDXComponent=!0}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{142:function(e,n,r){"use strict";r.d(n,"a",(function(){return i})),r.d(n,"b",(function(){return m}));var t=r(0),a=r.n(t);function u(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function s(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function c(e){for(var n=1;n=0||(a[r]=e[r]);return a}(e,n);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var d=a.a.createContext({}),p=function(e){var n=a.a.useContext(d),r=n;return e&&(r="function"==typeof e?e(n):c(c({},n),e)),r},i=function(e){var n=p(e.components);return a.a.createElement(d.Provider,{value:n},e.children)},l={inlineCode:"code",wrapper:function(e){var n=e.children;return a.a.createElement(a.a.Fragment,{},n)}},O=a.a.forwardRef((function(e,n){var r=e.components,t=e.mdxType,u=e.originalType,s=e.parentName,d=o(e,["components","mdxType","originalType","parentName"]),i=p(r),O=t,m=i["".concat(s,".").concat(O)]||i[O]||l[O]||u;return r?a.a.createElement(m,c(c({ref:n},d),{},{components:r})):a.a.createElement(m,c({ref:n},d))}));function m(e,n){var r=arguments,t=n&&n.mdxType;if("string"==typeof e||t){var u=r.length,s=new Array(u);s[0]=O;var c={};for(var o in n)hasOwnProperty.call(n,o)&&(c[o]=n[o]);c.originalType=e,c.mdxType="string"==typeof e?e:t,s[1]=c;for(var d=2;du.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.InsertOrUpdateInclude(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.InsertOrUpdateInclude(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.InsertOrUpdateInclude(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.InsertOrUpdateInclude(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.InsertOrUpdateInclude("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.InsertOrUpdateInclude(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.InsertOrUpdateInclude(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.InsertOrUpdateIncludeAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.InsertOrUpdateIncludeAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.InsertOrUpdateIncludeAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.InsertOrUpdateIncludeAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.InsertOrUpdateIncludeAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.InsertOrUpdateIncludeAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.InsertOrUpdateIncludeAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.InsertOrUpdateIncludeAsync(new[] {"Age", "Name"});\n')),Object(u.b)("h2",{id:"974-\u65b0\u589e\u6216\u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.7.4 \u65b0\u589e\u6216\u66f4\u65b0\u90e8\u5206\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(u.b)("pre",null,Object(u.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.InsertOrUpdateIncludeNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.InsertOrUpdateIncludeNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.InsertOrUpdateIncludeNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.InsertOrUpdateIncludeNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.InsertOrUpdateIncludeNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.InsertOrUpdateIncludeNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.InsertOrUpdateIncludeNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.InsertOrUpdateIncludeNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.InsertOrUpdateIncludeNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.InsertOrUpdateIncludeNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.InsertOrUpdateIncludeNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.InsertOrUpdateIncludeNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.InsertOrUpdateIncludeNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.InsertOrUpdateIncludeNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.InsertOrUpdateIncludeNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.InsertOrUpdateIncludeNowAsync(new[] {"Age", "Name"});\n')),Object(u.b)("h2",{id:"975-\u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"},"9.7.5 \u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\uff08\u4e0d\u7acb\u5373\u63d0\u4ea4\uff09"),Object(u.b)("pre",null,Object(u.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.InsertOrUpdateExclude(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.InsertOrUpdateExclude(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.InsertOrUpdateExclude(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.InsertOrUpdateExclude(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.InsertOrUpdateExclude(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.InsertOrUpdateExclude("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.InsertOrUpdateExclude(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.InsertOrUpdateExclude(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.InsertOrUpdateExcludeAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.InsertOrUpdateExcludeAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.InsertOrUpdateExcludeAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.InsertOrUpdateExcludeAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.InsertOrUpdateExcludeAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.InsertOrUpdateExcludeAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.InsertOrUpdateExcludeAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.InsertOrUpdateExcludeAsync(new[] {"Age", "Name"});\n')),Object(u.b)("h2",{id:"976-\u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"},"9.7.6 \u65b0\u589e\u6216\u66f4\u65b0\u6392\u9664\u7279\u5b9a\u5217\uff08\u7acb\u5373\u63d0\u4ea4\uff09"),Object(u.b)("pre",null,Object(u.b)("code",Object(t.a)({parentName:"pre"},{className:"language-cs"}),'// ==== \u540c\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nrepository.InsertOrUpdateExcludeNow(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nrepository.InsertOrUpdateExcludeNow(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nrepository.InsertOrUpdateExcludeNow(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nrepository.InsertOrUpdateExcludeNow(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nuser.InsertOrUpdateExcludeNow(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nuser.InsertOrUpdateExcludeNow("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nuser.InsertOrUpdateExcludeNow(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nuser.InsertOrUpdateExcludeNow(new[] {"Age", "Name"});\n\n// ==== \u5f02\u6b65\u64cd\u4f5c ====\n\n// \u793a\u4f8b\u4e00\nawait repository.InsertOrUpdateExcludeNowAsync(user, u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u4e8c\nawait repository.InsertOrUpdateExcludeNowAsync(user, "Age", "Name");\n\n// \u793a\u4f8b\u4e09\nawait repository.InsertOrUpdateExcludeNowAsync(user, new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u56db\nawait repository.InsertOrUpdateExcludeNowAsync(user, new[] {"Age", "Name"});\n\n// \u793a\u4f8b\u4e94\nawait user.InsertOrUpdateExcludeNowAsync(u=>u.Name, u=>u.Age);\n\n// \u793a\u4f8b\u516d\nawait user.InsertOrUpdateExcludeNowAsync("Age", "Name");\n\n// \u793a\u4f8b\u4e03\nawait user.InsertOrUpdateExcludeNowAsync(new[] { u=>u.Name, u=>u.Age});\n\n// \u793a\u4f8b\u516b\nawait user.InsertOrUpdateExcludeNowAsync(new[] {"Age", "Name"});\n')),Object(u.b)("h2",{id:"957-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.5.7 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(u.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(u.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-heading"}),Object(u.b)("h5",{parentName:"div"},Object(u.b)("span",Object(t.a)({parentName:"h5"},{className:"admonition-icon"}),Object(u.b)("svg",Object(t.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(u.b)("path",Object(t.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(u.b)("div",Object(t.a)({parentName:"div"},{className:"admonition-content"}),Object(u.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(u.b)("a",Object(t.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/1e961311.fef4867f.js b/docs/1e961311.8fde9f00.js similarity index 99% rename from docs/1e961311.fef4867f.js rename to docs/1e961311.8fde9f00.js index 1752807277f..98a4467f4a2 100644 --- a/docs/1e961311.fef4867f.js +++ b/docs/1e961311.8fde9f00.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return m}));var a=n(0),r=n.n(a);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function b(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=r.a.createContext({}),l=function(e){var t=r.a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):b(b({},t),e)),n},p=function(e){var t=l(e.components);return r.a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},O=r.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),p=l(n),O=a,m=p["".concat(c,".").concat(O)]||p[O]||d[O]||i;return n?r.a.createElement(m,b(b({ref:t},s),{},{components:n})):r.a.createElement(m,b({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,c=new Array(i);c[0]=O;var b={};for(var o in t)hasOwnProperty.call(t,o)&&(b[o]=t[o]);b.originalType=e,b.mdxType="string"==typeof e?e:a,c[1]=b;for(var s=2;sEFCore.BulkExtensions \u4f7f\u7528",id:"992-efcorebulkextensions-\u4f7f\u7528",children:[{value:"9.9.2.1 \u5e38\u89c1\u6279\u91cf\u64cd\u4f5c",id:"9921-\u5e38\u89c1\u6279\u91cf\u64cd\u4f5c",children:[]},{value:"9.9.2.2 \u67e5\u8be2\u540e\u6279\u91cf\u64cd\u4f5c",id:"9922-\u67e5\u8be2\u540e\u6279\u91cf\u64cd\u4f5c",children:[]}]},{value:"9.9.3 \u6279\u91cf\u64cd\u4f5c\u6027\u80fd",id:"993-\u6279\u91cf\u64cd\u4f5c\u6027\u80fd",children:[]},{value:"9.9.4 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"994-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],s={rightToc:o};function l(e){var t=e.components,n=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(a.a)({},s,n,{components:t,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"991-\u5173\u4e8e\u6279\u91cf\u64cd\u4f5c"},"9.9.1 \u5173\u4e8e\u6279\u91cf\u64cd\u4f5c"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u9ed8\u8ba4\u53ea\u63d0\u4f9b\u5c0f\u6570\u636e\uff08100 \u4ee5\u5185\uff09\u6279\u91cf\u6570\u636e\u64cd\u4f5c\uff0c\u5982\u679c\u9700\u8981\u66f4\u5927\u7684\u6570\u636e\u6279\u91cf\u5904\u7406\uff0c\u63a8\u8350\u4f7f\u7528\u7b2c\u4e09\u65b9\u5305 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/borisdj/EFCore.BulkExtensions"}),"EFCore.BulkExtensions"),"\uff0c\u652f\u6301\u548c ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u65e0\u7f1d\u8854\u63a5\u3002"),Object(i.b)("h2",{id:"992-efcorebulkextensions-\u4f7f\u7528"},"9.9.2 ",Object(i.b)("inlineCode",{parentName:"h2"},"EFCore.BulkExtensions")," \u4f7f\u7528"),Object(i.b)("h3",{id:"9921-\u5e38\u89c1\u6279\u91cf\u64cd\u4f5c"},"9.9.2.1 \u5e38\u89c1\u6279\u91cf\u64cd\u4f5c"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u6279\u91cf\u63d2\u5165\nrepository.DbContext.BulkInsert(entitiesList);\nrepository.DbContext.BulkInsertAsync(entitiesList);\n\n// \u6279\u91cf\u66f4\u65b0\nrepository.DbContext.BulkUpdate(entitiesList);\nrepository.DbContext.BulkUpdateAsync(entitiesList);\n\n// \u6279\u91cf\u5220\u9664\nrepository.DbContext.BulkDelete(entitiesList);\nrepository.DbContext.BulkDeleteAsync(entitiesList);\n\n// \u6279\u91cf\u63d2\u5165\u6216\u66f4\u65b0\nrepository.DbContext.BulkInsertOrUpdate(entitiesList);\nrepository.DbContext.BulkInsertOrUpdateAsync(entitiesList);\n\n// \u6279\u91cf\u63d2\u5165\u6216\u66f4\u65b0\u6216\u5220\u9664\nrepository.DbContext.BulkInsertOrUpdateOrDelete(entitiesList);\nrepository.DbContext.BulkInsertOrUpdateOrDeleteAsync(entitiesList);\n\n// \u6279\u91cf\u8bfb\u53d6\u591a\u4e2a\u5b9e\u4f53\nrepository.DbContext.BulkRead(entitiesList);\nrepository.DbContext.BulkReadAsync(entitiesList);\n\n// \u6279\u91cf\u6e05\u7a7a\u8868\uff08\u614e\u7528\uff01\uff01\uff01\uff01\uff01\uff09\nrepository.DbContext.Truncate();\nrepository.DbContext.TruncateAsync();\n")),Object(i.b)("h3",{id:"9922-\u67e5\u8be2\u540e\u6279\u91cf\u64cd\u4f5c"},"9.9.2.2 \u67e5\u8be2\u540e\u6279\u91cf\u64cd\u4f5c"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u6839\u636e\u6761\u4ef6\u6279\u91cf\u5220\u9664\nrepository.Where(a => a.ItemId > 500).BatchDelete();\nawait repository.Where(a => a.ItemId > 500).BatchDeleteAsync();\n\n// \u6839\u636e\u6761\u4ef6\u6279\u91cf\u66f4\u65b0\nrepository.Where(a => a.ItemId <= 500).BatchUpdate(a => new Item { Quantity = a.Quantity + 100 });\nrepository.Where(a => a.ItemId <= 500).BatchUpdate(new Item { Description = "Updated" });\nawait repository.Where(a => a.ItemId <= 500).BatchUpdateAsync(new Item { Description = "Updated" });\n\n// \u6279\u91cf\u66f4\u65b0\u6307\u5b9a\u5217\nvar updateColumns = new List { nameof(Item.Quantity) };\nvar q = repository.Where(a => a.ItemId <= 500);\nint affected = q.BatchUpdate(new Item { Description = "Updated" }, updateColumns);\n')),Object(i.b)("h2",{id:"993-\u6279\u91cf\u64cd\u4f5c\u6027\u80fd"},"9.9.3 \u6279\u91cf\u64cd\u4f5c\u6027\u80fd"),Object(i.b)("table",null,Object(i.b)("thead",{parentName:"table"},Object(i.b)("tr",{parentName:"thead"},Object(i.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Operations\\Rows"),Object(i.b)("th",Object(a.a)({parentName:"tr"},{align:"right"}),"100,000 EF"),Object(i.b)("th",Object(a.a)({parentName:"tr"},{align:"right"}),"100,000 EFBulk"),Object(i.b)("th",Object(a.a)({parentName:"tr"},{align:"right"}),"1,000,000 EFBulk"))),Object(i.b)("tbody",{parentName:"table"},Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"Insert"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"38.98 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"2.10 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"17.99 s")),Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"Update"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"109.25 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"3.96 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"31.45 s")),Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"Delete"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"7.26 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"2.04 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"12.18 s")),Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"-----------------"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"------------"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"----------------"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"------------------")),Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:null}),Object(i.b)("strong",{parentName:"td"},"Together")),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"70.70 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"5.88 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"56.84 s")))),Object(i.b)("h2",{id:"994-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.9.4 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(i.b)("hr",null),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(i.b)("inlineCode",{parentName:"p"},"EFCore.BulkExtensions")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/borisdj/EFCore.BulkExtensions"}),"EFCore.BulkExtensions \u5f00\u6e90\u4ed3\u5e93"),"\u3002"))))}l.isMDXComponent=!0}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return m}));var a=n(0),r=n.n(a);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function b(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=r.a.createContext({}),l=function(e){var t=r.a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):b(b({},t),e)),n},p=function(e){var t=l(e.components);return r.a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},O=r.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),p=l(n),O=a,m=p["".concat(c,".").concat(O)]||p[O]||d[O]||i;return n?r.a.createElement(m,b(b({ref:t},s),{},{components:n})):r.a.createElement(m,b({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,c=new Array(i);c[0]=O;var b={};for(var o in t)hasOwnProperty.call(t,o)&&(b[o]=t[o]);b.originalType=e,b.mdxType="string"==typeof e?e:a,c[1]=b;for(var s=2;sEFCore.BulkExtensions \u4f7f\u7528",id:"992-efcorebulkextensions-\u4f7f\u7528",children:[{value:"9.9.2.1 \u5e38\u89c1\u6279\u91cf\u64cd\u4f5c",id:"9921-\u5e38\u89c1\u6279\u91cf\u64cd\u4f5c",children:[]},{value:"9.9.2.2 \u67e5\u8be2\u540e\u6279\u91cf\u64cd\u4f5c",id:"9922-\u67e5\u8be2\u540e\u6279\u91cf\u64cd\u4f5c",children:[]}]},{value:"9.9.3 \u6279\u91cf\u64cd\u4f5c\u6027\u80fd",id:"993-\u6279\u91cf\u64cd\u4f5c\u6027\u80fd",children:[]},{value:"9.9.4 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"994-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],s={rightToc:o};function l(e){var t=e.components,n=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(a.a)({},s,n,{components:t,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"991-\u5173\u4e8e\u6279\u91cf\u64cd\u4f5c"},"9.9.1 \u5173\u4e8e\u6279\u91cf\u64cd\u4f5c"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u9ed8\u8ba4\u53ea\u63d0\u4f9b\u5c0f\u6570\u636e\uff08100 \u4ee5\u5185\uff09\u6279\u91cf\u6570\u636e\u64cd\u4f5c\uff0c\u5982\u679c\u9700\u8981\u66f4\u5927\u7684\u6570\u636e\u6279\u91cf\u5904\u7406\uff0c\u63a8\u8350\u4f7f\u7528\u7b2c\u4e09\u65b9\u5305 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/borisdj/EFCore.BulkExtensions"}),"EFCore.BulkExtensions"),"\uff0c\u652f\u6301\u548c ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u65e0\u7f1d\u8854\u63a5\u3002"),Object(i.b)("h2",{id:"992-efcorebulkextensions-\u4f7f\u7528"},"9.9.2 ",Object(i.b)("inlineCode",{parentName:"h2"},"EFCore.BulkExtensions")," \u4f7f\u7528"),Object(i.b)("h3",{id:"9921-\u5e38\u89c1\u6279\u91cf\u64cd\u4f5c"},"9.9.2.1 \u5e38\u89c1\u6279\u91cf\u64cd\u4f5c"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u6279\u91cf\u63d2\u5165\nrepository.DbContext.BulkInsert(entitiesList);\nrepository.DbContext.BulkInsertAsync(entitiesList);\n\n// \u6279\u91cf\u66f4\u65b0\nrepository.DbContext.BulkUpdate(entitiesList);\nrepository.DbContext.BulkUpdateAsync(entitiesList);\n\n// \u6279\u91cf\u5220\u9664\nrepository.DbContext.BulkDelete(entitiesList);\nrepository.DbContext.BulkDeleteAsync(entitiesList);\n\n// \u6279\u91cf\u63d2\u5165\u6216\u66f4\u65b0\nrepository.DbContext.BulkInsertOrUpdate(entitiesList);\nrepository.DbContext.BulkInsertOrUpdateAsync(entitiesList);\n\n// \u6279\u91cf\u63d2\u5165\u6216\u66f4\u65b0\u6216\u5220\u9664\nrepository.DbContext.BulkInsertOrUpdateOrDelete(entitiesList);\nrepository.DbContext.BulkInsertOrUpdateOrDeleteAsync(entitiesList);\n\n// \u6279\u91cf\u8bfb\u53d6\u591a\u4e2a\u5b9e\u4f53\nrepository.DbContext.BulkRead(entitiesList);\nrepository.DbContext.BulkReadAsync(entitiesList);\n\n// \u6279\u91cf\u6e05\u7a7a\u8868\uff08\u614e\u7528\uff01\uff01\uff01\uff01\uff01\uff09\nrepository.DbContext.Truncate();\nrepository.DbContext.TruncateAsync();\n")),Object(i.b)("h3",{id:"9922-\u67e5\u8be2\u540e\u6279\u91cf\u64cd\u4f5c"},"9.9.2.2 \u67e5\u8be2\u540e\u6279\u91cf\u64cd\u4f5c"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u6839\u636e\u6761\u4ef6\u6279\u91cf\u5220\u9664\nrepository.Where(a => a.ItemId > 500).BatchDelete();\nawait repository.Where(a => a.ItemId > 500).BatchDeleteAsync();\n\n// \u6839\u636e\u6761\u4ef6\u6279\u91cf\u66f4\u65b0\nrepository.Where(a => a.ItemId <= 500).BatchUpdate(a => new Item { Quantity = a.Quantity + 100 });\nrepository.Where(a => a.ItemId <= 500).BatchUpdate(new Item { Description = "Updated" });\nawait repository.Where(a => a.ItemId <= 500).BatchUpdateAsync(new Item { Description = "Updated" });\n\n// \u6279\u91cf\u66f4\u65b0\u6307\u5b9a\u5217\nvar updateColumns = new List { nameof(Item.Quantity) };\nvar q = repository.Where(a => a.ItemId <= 500);\nint affected = q.BatchUpdate(new Item { Description = "Updated" }, updateColumns);\n')),Object(i.b)("h2",{id:"993-\u6279\u91cf\u64cd\u4f5c\u6027\u80fd"},"9.9.3 \u6279\u91cf\u64cd\u4f5c\u6027\u80fd"),Object(i.b)("table",null,Object(i.b)("thead",{parentName:"table"},Object(i.b)("tr",{parentName:"thead"},Object(i.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Operations\\Rows"),Object(i.b)("th",Object(a.a)({parentName:"tr"},{align:"right"}),"100,000 EF"),Object(i.b)("th",Object(a.a)({parentName:"tr"},{align:"right"}),"100,000 EFBulk"),Object(i.b)("th",Object(a.a)({parentName:"tr"},{align:"right"}),"1,000,000 EFBulk"))),Object(i.b)("tbody",{parentName:"table"},Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"Insert"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"38.98 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"2.10 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"17.99 s")),Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"Update"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"109.25 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"3.96 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"31.45 s")),Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"Delete"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"7.26 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"2.04 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"12.18 s")),Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"-----------------"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"------------"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"----------------"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"------------------")),Object(i.b)("tr",{parentName:"tbody"},Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:null}),Object(i.b)("strong",{parentName:"td"},"Together")),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"70.70 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"5.88 s"),Object(i.b)("td",Object(a.a)({parentName:"tr"},{align:"right"}),"56.84 s")))),Object(i.b)("h2",{id:"994-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.9.4 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(i.b)("hr",null),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(i.b)("inlineCode",{parentName:"p"},"EFCore.BulkExtensions")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/borisdj/EFCore.BulkExtensions"}),"EFCore.BulkExtensions \u5f00\u6e90\u4ed3\u5e93"),"\u3002"))))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/1ea356f4.543c45ed.js b/docs/1ea356f4.543c45ed.js new file mode 100644 index 00000000000..0b10d0f3aef --- /dev/null +++ b/docs/1ea356f4.543c45ed.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return d})),t.d(n,"b",(function(){return m}));var a=t(0),i=t.n(a);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function c(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=i.a.createContext({}),l=function(e){var n=i.a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},d=function(e){var n=l(e.components);return i.a.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},u=i.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,o=e.parentName,s=b(e,["components","mdxType","originalType","parentName"]),d=l(t),u=a,m=d["".concat(o,".").concat(u)]||d[u]||p[u]||r;return t?i.a.createElement(m,c(c({ref:n},s),{},{components:t})):i.a.createElement(m,c({ref:n},s))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,o=new Array(r);o[0]=u;var c={};for(var b in n)hasOwnProperty.call(n,b)&&(c[b]=n[b]);c.originalType=e,c.mdxType="string"==typeof e?e:a,o[1]=c;for(var s=2;sfunction(e,n,t,{forcePrependBaseUrl:a=!1,absolute:r=!1}={}){if(!t)return t;if(t.startsWith("#"))return t;if(Object(i.b)(t))return t;if(a)return n+t;const o=t.startsWith(n)?t:n+t.replace(/^\//,"");return r?e+o:o}(n,e,t,a)}}function o(e,n={}){const{withBaseUrl:t}=r();return t(e,n)}},145:function(e,n,t){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function i(e){return void 0!==e&&!a(e)}t.d(n,"b",(function(){return a})),t.d(n,"a",(function(){return i}))},69:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return c})),t.d(n,"metadata",(function(){return b})),t.d(n,"rightToc",(function(){return s})),t.d(n,"default",(function(){return d}));var a=t(2),i=t(6),r=(t(0),t(142)),o=t(144),c={id:"saas",title:"10. SaaS \u591a\u79df\u6237",sidebar_label:"10. SaaS \u591a\u79df\u6237"},b={unversionedId:"saas",id:"saas",isDocsHomePage:!1,title:"10. SaaS \u591a\u79df\u6237",description:"10.1 \u4ec0\u4e48\u662f SaaS",source:"@site/docs\\saas.mdx",slug:"/saas",permalink:"/docs/saas",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/saas.mdx",version:"current",sidebar_label:"10. SaaS \u591a\u79df\u6237",sidebar:"docs",previous:{title:"9.27 \u5206\u8868\u5206\u5e93",permalink:"/docs/split-db"},next:{title:"11. \u4f9d\u8d56\u6ce8\u5165/\u63a7\u5236\u53cd\u8f6c",permalink:"/docs/dependency-injection"}},s=[{value:"10.1 \u4ec0\u4e48\u662f SaaS",id:"101-\u4ec0\u4e48\u662f-saas",children:[]},{value:"10.2 \u4ec0\u4e48\u662f\u591a\u79df\u6237",id:"102-\u4ec0\u4e48\u662f\u591a\u79df\u6237",children:[]},{value:"10.3 \u5b9e\u73b0\u591a\u79df\u6237\u65b9\u6848",id:"103-\u5b9e\u73b0\u591a\u79df\u6237\u65b9\u6848",children:[{value:"10.3.1 \u72ec\u7acb\u6570\u636e\u5e93",id:"1031-\u72ec\u7acb\u6570\u636e\u5e93",children:[]},{value:"10.3.2 \u5171\u4eab\u6570\u636e\u5e93\uff0c\u72ec\u7acb Schema",id:"1032-\u5171\u4eab\u6570\u636e\u5e93\uff0c\u72ec\u7acb-schema",children:[]},{value:"10.3.3 \u5171\u4eab\u6570\u636e\u5e93\uff0c\u5171\u4eab Schema",id:"1033-\u5171\u4eab\u6570\u636e\u5e93\uff0c\u5171\u4eab-schema",children:[]}]},{value:"10.4 \u591a\u79df\u6237\u4f7f\u7528\u65b9\u6848",id:"104-\u591a\u79df\u6237\u4f7f\u7528\u65b9\u6848",children:[]},{value:"10.5 \u57fa\u4e8e TenantId \u7684\u65b9\u5f0f",id:"105-\u57fa\u4e8e-tenantid-\u7684\u65b9\u5f0f",children:[{value:"10.5.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1051-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.5.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1052-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.5.3 \u6dfb\u52a0 Tenant \u79cd\u5b50\u6570\u636e",id:"1053-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e",children:[]},{value:"10.5.4 \u6839\u636e\u6a21\u578b\u521b\u5efa Tenant \u8868",id:"1054-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868",children:[]},{value:"10.5.5 \u5b9e\u73b0 IMultiTenantOnTable \u63a5\u53e3",id:"1055-\u5b9e\u73b0-imultitenantontable-\u63a5\u53e3",children:[]},{value:"10.5.6 \u5b9e\u73b0 IModelBuilderFilter \u63a5\u53e3",id:"1056-\u5b9e\u73b0-imodelbuilderfilter-\u63a5\u53e3",children:[]},{value:"10.5.7 \u91cd\u5199 SavingChangesEvent \u4e8b\u4ef6\u65b9\u6cd5",id:"1057-\u91cd\u5199-savingchangesevent-\u4e8b\u4ef6\u65b9\u6cd5",children:[]}]},{value:"10.6 \u57fa\u4e8e Database \u7684\u65b9\u5f0f",id:"106-\u57fa\u4e8e-database-\u7684\u65b9\u5f0f",children:[{value:"10.6.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1061-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.6.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1062-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.6.3 \u6dfb\u52a0 Tenant \u79cd\u5b50\u6570\u636e",id:"1063-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e",children:[]},{value:"10.6.4 \u6839\u636e\u6a21\u578b\u521b\u5efa Tenant \u8868",id:"1064-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868",children:[]},{value:"10.6.5 \u5b9e\u73b0 IMultiTenantOnDatabase \u63a5\u53e3",id:"1065-\u5b9e\u73b0-imultitenantondatabase-\u63a5\u53e3",children:[]},{value:"10.6.6 \u91cd\u5199 OnConfiguring \u65b9\u6cd5",id:"1066-\u91cd\u5199-onconfiguring-\u65b9\u6cd5",children:[]}]},{value:"10.7 \u57fa\u4e8e Schema \u7684\u65b9\u5f0f",id:"107-\u57fa\u4e8e-schema-\u7684\u65b9\u5f0f",children:[{value:"10.7.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1071-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.7.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1072-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.7.3 \u6dfb\u52a0 Tenant \u79cd\u5b50\u6570\u636e",id:"1073-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e",children:[]},{value:"10.7.4 \u6839\u636e\u6a21\u578b\u521b\u5efa Tenant \u8868",id:"1074-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868",children:[]},{value:"10.7.5 \u5b9e\u73b0 IMultiTenantOnSchema \u63a5\u53e3",id:"1075-\u5b9e\u73b0-imultitenantonschema-\u63a5\u53e3",children:[]},{value:"10.7.6 \u5173\u4e8e Code First \u6570\u636e\u8fc1\u79fb",id:"1076-\u5173\u4e8e-code-first-\u6570\u636e\u8fc1\u79fb",children:[]}]},{value:"10.8 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"108-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],l={rightToc:s};function d(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"101-\u4ec0\u4e48\u662f-saas"},"10.1 \u4ec0\u4e48\u662f ",Object(r.b)("inlineCode",{parentName:"h2"},"SaaS")),Object(r.b)("blockquote",null,Object(r.b)("p",{parentName:"blockquote"},"SaaS \u662f Software-as-a-Service\uff08\u8f6f\u4ef6\u5373\u670d\u52a1\uff09\u7684\u7b80\u79f0\uff0c\u968f\u7740\u4e92\u8054\u7f51\u6280\u672f\u7684\u53d1\u5c55\u548c\u5e94\u7528\u8f6f\u4ef6\u7684\u6210\u719f\uff0c \u5728 21 \u4e16\u7eaa\u5f00\u59cb\u5174\u8d77\u7684\u4e00\u79cd\u5b8c\u5168\u521b\u65b0\u7684\u8f6f\u4ef6\u5e94\u7528\u6a21\u5f0f\u3002\u5b83\u4e0e\u201con-demand software\u201d\uff0cthe application service provider(ASP\uff0c\u5e94\u7528\u670d\u52a1\u63d0\u4f9b\u5546)\uff0chosted software(\u6258\u7ba1\u8f6f\u4ef6)\u6240\u5177\u6709\u76f8\u4f3c\u7684\u542b\u4e49\u3002"),Object(r.b)("p",{parentName:"blockquote"},"\u5b83\u662f\u4e00\u79cd\u901a\u8fc7 Internet \u63d0\u4f9b\u8f6f\u4ef6\u7684\u6a21\u5f0f\uff0c\u5382\u5546\u5c06\u5e94\u7528\u8f6f\u4ef6\u7edf\u4e00\u90e8\u7f72\u5728\u81ea\u5df1\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u5ba2\u6237\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u5b9e\u9645\u9700\u6c42\uff0c\u901a\u8fc7\u4e92\u8054\u7f51\u5411\u5382\u5546\u5b9a\u8d2d\u6240\u9700\u7684\u5e94\u7528\u8f6f\u4ef6\u670d\u52a1\uff0c\u6309\u5b9a\u8d2d\u7684\u670d\u52a1\u591a\u5c11\u548c\u65f6\u95f4\u957f\u77ed\u5411\u5382\u5546\u652f\u4ed8\u8d39\u7528\uff0c\u5e76\u901a\u8fc7\u4e92\u8054\u7f51\u83b7\u5f97\u5382\u5546\u63d0\u4f9b\u7684\u670d\u52a1\u3002\u7528\u6237\u4e0d\u7528\u518d\u8d2d\u4e70\u8f6f\u4ef6\uff0c\u800c\u6539\u7528\u5411\u63d0\u4f9b\u5546\u79df\u7528\u57fa\u4e8e Web \u7684\u8f6f\u4ef6\uff0c\u6765\u7ba1\u7406\u4f01\u4e1a\u7ecf\u8425\u6d3b\u52a8\uff0c\u4e14\u65e0\u9700\u5bf9\u8f6f\u4ef6\u8fdb\u884c\u7ef4\u62a4\uff0c\u670d\u52a1\u63d0\u4f9b\u5546\u4f1a\u5168\u6743\u7ba1\u7406\u548c\u7ef4\u62a4\u8f6f\u4ef6\uff0c\u8f6f\u4ef6\u5382\u5546\u5728\u5411\u5ba2\u6237\u63d0\u4f9b\u4e92\u8054\u7f51\u5e94\u7528\u7684\u540c\u65f6\uff0c\u4e5f\u63d0\u4f9b\u8f6f\u4ef6\u7684\u79bb\u7ebf\u64cd\u4f5c\u548c\u672c\u5730\u6570\u636e\u5b58\u50a8\uff0c\u8ba9\u7528\u6237\u968f\u65f6\u968f\u5730\u90fd\u53ef\u4ee5\u4f7f\u7528\u5176\u5b9a\u8d2d\u7684\u8f6f\u4ef6\u548c\u670d\u52a1\u3002"),Object(r.b)("p",{parentName:"blockquote"},"\u5bf9\u4e8e\u8bb8\u591a\u5c0f\u578b\u4f01\u4e1a\u6765\u8bf4\uff0cSaaS \u662f\u91c7\u7528\u5148\u8fdb\u6280\u672f\u7684\u6700\u597d\u9014\u5f84\uff0c\u5b83\u6d88\u9664\u4e86\u4f01\u4e1a\u8d2d\u4e70\u3001\u6784\u5efa\u548c\u7ef4\u62a4\u57fa\u7840\u8bbe\u65bd\u548c\u5e94\u7528\u7a0b\u5e8f\u7684\u9700\u8981\u3002")),Object(r.b)("h2",{id:"102-\u4ec0\u4e48\u662f\u591a\u79df\u6237"},"10.2 \u4ec0\u4e48\u662f\u591a\u79df\u6237"),Object(r.b)("p",null,"\u591a\u79df\u6237\u6280\u672f\u6216\u79f0\u591a\u91cd\u79df\u8d41\u6280\u672f\uff0c\u7b80\u79f0 ",Object(r.b)("inlineCode",{parentName:"p"},"SaaS"),"\uff0c\u662f\u4e00\u79cd\u8f6f\u4ef6\u67b6\u6784\u6280\u672f\uff0c\u662f\u5b9e\u73b0\u5982\u4f55\u5728\u591a\u7528\u6237\u73af\u5883\u4e0b\uff08\u6b64\u5904\u7684\u591a\u7528\u6237\u4e00\u822c\u662f\u9762\u5411\u4f01\u4e1a\u7528\u6237\uff09\u5171\u7528\u76f8\u540c\u7684\u7cfb\u7edf\u6216\u7a0b\u5e8f\u7ec4\u4ef6\uff0c\u5e76\u4e14\u53ef\u786e\u4fdd\u5404\u7528\u6237\u95f4\u6570\u636e\u7684\u9694\u79bb\u6027\u3002"),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u7b80\u5355\u8bb2\uff1a\u5728\u4e00\u53f0\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u5355\u4e2a\u5e94\u7528\u5b9e\u4f8b\uff0c\u5b83\u4e3a\u591a\u4e2a\u79df\u6237\uff08\u5ba2\u6237\uff09\u63d0\u4f9b\u670d\u52a1\u3002"),"\u4ece\u5b9a\u4e49\u4e2d\u6211\u4eec\u53ef\u4ee5\u7406\u89e3\uff1a\u591a\u79df\u6237\u662f\u4e00\u79cd\u67b6\u6784\uff0c\u76ee\u7684\u662f\u4e3a\u4e86\u8ba9\u591a\u7528\u6237\u73af\u5883\u4e0b\u4f7f\u7528\u540c\u4e00\u5957\u7a0b\u5e8f\uff0c\u4e14\u4fdd\u8bc1\u7528\u6237\u95f4\u6570\u636e\u9694\u79bb\u3002\u90a3\u4e48\u91cd\u70b9\u5c31\u5f88\u6d45\u663e\u6613\u61c2\u4e86\uff0c\u591a\u79df\u6237\u7684\u91cd\u70b9\u5c31\u662f\u540c\u4e00\u5957\u7a0b\u5e8f\u4e0b\u5b9e\u73b0\u591a\u7528\u6237\u6570\u636e\u7684\u9694\u79bb\u3002"),Object(r.b)("h2",{id:"103-\u5b9e\u73b0\u591a\u79df\u6237\u65b9\u6848"},"10.3 \u5b9e\u73b0\u591a\u79df\u6237\u65b9\u6848"),Object(r.b)("h3",{id:"1031-\u72ec\u7acb\u6570\u636e\u5e93"},"10.3.1 \u72ec\u7acb\u6570\u636e\u5e93"),Object(r.b)("p",null,"\u8fd9\u662f\u7b2c\u4e00\u79cd\u65b9\u6848\uff0c\u5373\u4e00\u4e2a\u79df\u6237\u4e00\u4e2a\u6570\u636e\u5e93\uff0c\u8fd9\u79cd\u65b9\u6848\u7684\u7528\u6237\u6570\u636e\u9694\u79bb\u7ea7\u522b\u6700\u9ad8\uff0c\u5b89\u5168\u6027\u6700\u597d\uff0c\u4f46\u6210\u672c\u8f83\u9ad8\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u4f18\u70b9\uff1a"),"\n\u4e3a\u4e0d\u540c\u7684\u79df\u6237\u63d0\u4f9b\u72ec\u7acb\u7684\u6570\u636e\u5e93\uff0c\u6709\u52a9\u4e8e\u7b80\u5316\u6570\u636e\u6a21\u578b\u7684\u6269\u5c55\u8bbe\u8ba1\uff0c\u6ee1\u8db3\u4e0d\u540c\u79df\u6237\u7684\u72ec\u7279\u9700\u6c42\uff1b\u5982\u679c\u51fa\u73b0\u6545\u969c\uff0c\u6062\u590d\u6570\u636e\u6bd4\u8f83\u7b80\u5355\u3002")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u7f3a\u70b9\uff1a"),"\n\u589e\u591a\u4e86\u6570\u636e\u5e93\u7684\u5b89\u88c5\u6570\u91cf\uff0c\u968f\u4e4b\u5e26\u6765\u7ef4\u62a4\u6210\u672c\u548c\u8d2d\u7f6e\u6210\u672c\u7684\u589e\u52a0\u3002 \u8fd9\u79cd\u65b9\u6848\u4e0e\u4f20\u7edf\u7684\u4e00\u4e2a\u5ba2\u6237\u3001\u4e00\u5957\u6570\u636e\u3001\u4e00\u5957\u90e8\u7f72\u7c7b\u4f3c\uff0c\u5dee\u522b\u53ea\u5728\u4e8e\u8f6f\u4ef6\u7edf\u4e00\u90e8\u7f72\u5728\u8fd0\u8425\u5546\u90a3\u91cc\u3002\u5982\u679c\u9762\u5bf9\u7684\u662f\u94f6\u884c\u3001\u533b\u9662\u7b49\u9700\u8981\u975e\u5e38\u9ad8\u6570\u636e\u9694\u79bb\u7ea7\u522b\u7684\u79df\u6237\uff0c\u53ef\u4ee5\u9009\u62e9\u8fd9\u79cd\u6a21\u5f0f\uff0c\u63d0\u9ad8\u79df\u7528\u7684\u5b9a\u4ef7\u3002\u5982\u679c\u5b9a\u4ef7\u8f83\u4f4e\uff0c\u4ea7\u54c1\u8d70\u4f4e\u4ef7\u8def\u7ebf\uff0c\u8fd9\u79cd\u65b9\u6848\u4e00\u822c\u5bf9\u8fd0\u8425\u5546\u6765\u8bf4\u662f\u65e0\u6cd5\u627f\u53d7\u7684\u3002"))),Object(r.b)("h3",{id:"1032-\u5171\u4eab\u6570\u636e\u5e93\uff0c\u72ec\u7acb-schema"},"10.3.2 \u5171\u4eab\u6570\u636e\u5e93\uff0c\u72ec\u7acb ",Object(r.b)("inlineCode",{parentName:"h3"},"Schema")),Object(r.b)("p",null,"\u8fd9\u662f\u7b2c\u4e8c\u79cd\u65b9\u6848\uff0c\u5373\u591a\u4e2a\u6216\u6240\u6709\u79df\u6237\u5171\u4eab ",Object(r.b)("inlineCode",{parentName:"p"},"Database"),"\uff0c\u4f46\u662f\u6bcf\u4e2a\u79df\u6237\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"Schema"),"\uff08\u4e5f\u53ef\u53eb\u505a\u4e00\u4e2a user\uff09\u3002\u5e95\u5c42\u5e93\u6bd4\u5982\u662f\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"SqlServer"),"\u3001",Object(r.b)("inlineCode",{parentName:"p"},"Oracle")," \u7b49\uff0c\u4e00\u4e2a\u6570\u636e\u5e93\u4e0b\u53ef\u4ee5\u6709\u591a\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"Schema"),"\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u4f18\u70b9\uff1a"),"\n\u4e3a\u5b89\u5168\u6027\u8981\u6c42\u8f83\u9ad8\u7684\u79df\u6237\u63d0\u4f9b\u4e86\u4e00\u5b9a\u7a0b\u5ea6\u7684\u903b\u8f91\u6570\u636e\u9694\u79bb\uff0c\u5e76\u4e0d\u662f\u5b8c\u5168\u9694\u79bb\uff1b\u6bcf\u4e2a\u6570\u636e\u5e93\u53ef\u652f\u6301\u66f4\u591a\u7684\u79df\u6237\u6570\u91cf\u3002")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u7f3a\u70b9\uff1a"),"\n\u5982\u679c\u51fa\u73b0\u6545\u969c\uff0c\u6570\u636e\u6062\u590d\u6bd4\u8f83\u56f0\u96be\uff0c\u56e0\u4e3a\u6062\u590d\u6570\u636e\u5e93\u5c06\u7275\u6d89\u5230\u5176\u4ed6\u79df\u6237\u7684\u6570\u636e\uff1b \u5982\u679c\u9700\u8981\u8de8\u79df\u6237\u7edf\u8ba1\u6570\u636e\uff0c\u5b58\u5728\u4e00\u5b9a\u56f0\u96be\u3002"))),Object(r.b)("h3",{id:"1033-\u5171\u4eab\u6570\u636e\u5e93\uff0c\u5171\u4eab-schema"},"10.3.3 \u5171\u4eab\u6570\u636e\u5e93\uff0c\u5171\u4eab ",Object(r.b)("inlineCode",{parentName:"h3"},"Schema")),Object(r.b)("p",null,"\u5171\u4eab\u6570\u636e\u8868 \u8fd9\u662f\u7b2c\u4e09\u79cd\u65b9\u6848\uff0c\u5373\u79df\u6237\u5171\u4eab\u540c\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"Database"),"\u3001\u540c\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"Schema"),"\uff0c\u4f46\u5728\u8868\u4e2d\u589e\u52a0 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"TenantId"))," \u591a\u79df\u6237\u7684\u6570\u636e\u5b57\u6bb5\u3002\u8fd9\u662f\u5171\u4eab\u7a0b\u5ea6\u6700\u9ad8\u3001\u9694\u79bb\u7ea7\u522b\u6700\u4f4e\u7684\u6a21\u5f0f\u3002 \u5373\u6bcf\u63d2\u5165\u4e00\u6761\u6570\u636e\u65f6\u90fd\u9700\u8981\u6709\u4e00\u4e2a\u5ba2\u6237\u7684\u6807\u8bc6\u3002\u8fd9\u6837\u624d\u80fd\u5728\u540c\u4e00\u5f20\u8868\u4e2d\u533a\u5206\u51fa\u4e0d\u540c\u5ba2\u6237\u7684\u6570\u636e\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u4f18\u70b9\uff1a"),"\n\u4e09\u79cd\u65b9\u6848\u6bd4\u8f83\uff0c\u7b2c\u4e09\u79cd\u65b9\u6848\u7684\u7ef4\u62a4\u548c\u8d2d\u7f6e\u6210\u672c\u6700\u4f4e\uff0c\u5141\u8bb8\u6bcf\u4e2a\u6570\u636e\u5e93\u652f\u6301\u7684\u79df\u6237\u6570\u91cf\u6700\u591a\u3002")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u7f3a\u70b9\uff1a"),"\n\u9694\u79bb\u7ea7\u522b\u6700\u4f4e\uff0c\u5b89\u5168\u6027\u6700\u4f4e\uff0c\u9700\u8981\u5728\u8bbe\u8ba1\u5f00\u53d1\u65f6\u52a0\u5927\u5bf9\u5b89\u5168\u7684\u5f00\u53d1\u91cf\uff1b \u6570\u636e\u5907\u4efd\u548c\u6062\u590d\u6700\u56f0\u96be\uff0c\u9700\u8981\u9010\u8868\u9010\u6761\u5907\u4efd\u548c\u8fd8\u539f\u3002"))),Object(r.b)("h2",{id:"104-\u591a\u79df\u6237\u4f7f\u7528\u65b9\u6848"},"10.4 \u591a\u79df\u6237\u4f7f\u7528\u65b9\u6848"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u652f\u6301\u4ee5\u4e0a\u4e09\u79cd\u591a\u79df\u6237\u5b9e\u73b0\u65b9\u6848\uff0c\u4f7f\u7528\u7b80\u5355\u4e14\u5bb9\u6613\u7ef4\u62a4\u3002\u4e0b\u9762\u5206\u522b\u4f7f\u7528\u4e09\u79cd\u4e0d\u540c\u65b9\u5f0f\u6f14\u793a\u591a\u79df\u6237\u65b9\u6848\u7528\u6cd5\u3002"),Object(r.b)("h2",{id:"105-\u57fa\u4e8e-tenantid-\u7684\u65b9\u5f0f"},"10.5 \u57fa\u4e8e ",Object(r.b)("inlineCode",{parentName:"h2"},"TenantId")," \u7684\u65b9\u5f0f"),Object(r.b)("p",null,"\u6b64\u65b9\u5f0f\u5728\u4e2d\u5c0f\u578b\u4f01\u4e1a\u7cfb\u7edf\u4e2d\u6700\u4e3a\u5e38\u7528\uff0c\u7ef4\u62a4\u6210\u672c\u4f4e\uff0c\u8d2d\u7f6e\u6210\u672c\u4f4e\u3002"),Object(r.b)("h3",{id:"1051-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.5.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{6-7} title="Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"',"{6-7}":!0,title:'"Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class MultiTenantDbContext : AppDbContext\n {\n public MultiTenantDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u591a\u79df\u6237\u64cd\u4f5c\u5efa\u8bae\u5355\u72ec\u4e00\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u800c\u4e14\u9700\u6307\u5b9a ",Object(r.b)("inlineCode",{parentName:"p"},"MultiTenantDbContextLocator")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u3002"))),Object(r.b)("h3",{id:"1052-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.5.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{14}","{14}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n options.AddDbPool(DbProvider.Sqlite);\n options.AddDbPool(DbProvider.Sqlite);\n });\n }\n }\n}\n")),Object(r.b)("h3",{id:"1053-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e"},"10.5.3 \u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u79cd\u5b50\u6570\u636e"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{8,12-28} title="Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"',"{8,12-28}":!0,title:'"Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.EntityFramework.Core\n{\n public class TenantSeedData : IEntitySeedData\n {\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Tenant\n {\n TenantId=Guid.Parse("383AFB88-F519-FFF8-B364-6D563BF3687F"),\n Name="\u9ed8\u8ba4\u79df\u6237",\n Host="localhost:44313",\n CreatedTime=DateTime.Parse("2020-10-06 20:19:07")\n },\n new Tenant\n {\n TenantId=Guid.Parse("C5798CB6-16D6-0F42-EB56-59C695353BC0"),\n Name="\u5176\u4ed6\u79df\u6237",\n Host="localhost:5000",\n CreatedTime=DateTime.Parse("2020-10-06 20:20:32")\n }\n };\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u8be5\u6b65\u9aa4\u53ea\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Code First")," \u65b9\u5f0f\u6267\u884c\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Database First")," \u65e0\u9700\u914d\u7f6e\u79cd\u5b50\u6570\u636e\u3002"))),Object(r.b)("h3",{id:"1054-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868"},"10.5.4 \u6839\u636e\u6a21\u578b\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u8868"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration add_tenant_table -Context MultiTenantDbContext\n")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database -Context MultiTenantDbContext\n")),Object(r.b)("h3",{id:"1055-\u5b9e\u73b0-imultitenantontable-\u63a5\u53e3"},"10.5.5 \u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"h3"},"IMultiTenantOnTable")," \u63a5\u53e3"),Object(r.b)("p",null,"\u5728\u9700\u8981\u591a\u79df\u6237\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u4e2d\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"IMultiTenantOnTable")," \u63a5\u53e3\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{8,14-17}","{8,14-17}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing System;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext, IMultiTenantOnTable, IModelBuilderFilter\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public Guid? GetTenantId()\n {\n base.Tenant?.TenantId ?? Guid.Empty;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"GetTenantId()")," \u65b9\u6cd5\u4e2d\uff0c\u9996\u5148\u83b7\u53d6\u8bf7\u6c42\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"\u4e3b\u673a\u5730\u5740"),"\uff0c\u7136\u540e\u6839\u636e\u4e3b\u673a\u5730\u5740\u67e5\u8be2\u5bf9\u5e94\u7684\u79df\u6237 ",Object(r.b)("inlineCode",{parentName:"p"},"TenantIdId"),"\uff0c\u907f\u514d\u591a\u6b21\u67e5\u8be2\u6570\u636e\u5e93\uff0c\u8fd9\u91cc\u4f7f\u7528\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"IMemoryCache")," \u5185\u5b58\u7f13\u5b58\u3002"),Object(r.b)("h3",{id:"1056-\u5b9e\u73b0-imodelbuilderfilter-\u63a5\u53e3"},"10.5.6 \u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"h3"},"IModelBuilderFilter")," \u63a5\u53e3"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"IModelBuilderFilter")," \u63a5\u53e3\u662f\u5168\u5c40\u67e5\u8be2\u8fc7\u6ee4\u5668\u5b9e\u73b0\u63a5\u53e3\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u914d\u7f6e\u5b9e\u4f53 ",Object(r.b)("inlineCode",{parentName:"p"},"TenantId")," \u8fc7\u6ee4\u5668"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{9,20-23}","{9,20-23}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext, IMultiTenantOnTable, IModelBuilderFilter\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public Guid? GetTenantId()\n {\n base.Tenant?.TenantId ?? Guid.Empty;\n }\n\n public void OnCreating(ModelBuilder modelBuilder, EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasQueryFilter(TenantIdQueryFilterExpression(entityBuilder, GetTenantId().Value));\n }\n }\n}\n')),Object(r.b)("h3",{id:"1057-\u91cd\u5199-savingchangesevent-\u4e8b\u4ef6\u65b9\u6cd5"},"10.5.7 \u91cd\u5199 ",Object(r.b)("inlineCode",{parentName:"h3"},"SavingChangesEvent")," \u4e8b\u4ef6\u65b9\u6cd5"),Object(r.b)("p",null,"\u901a\u8fc7\u4e0a\u9762\u7684\u6b65\u9aa4\uff0c\u6211\u4eec\u5df2\u7ecf\u89e3\u51b3\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"\u67e5\u8be2")," \u79df\u6237\u8fc7\u6ee4\u529f\u80fd\uff0c\u4f46\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"\u65b0\u589e")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"\u66f4\u65b0")," \u8fd8\u672a\u5904\u7406\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u65b0\u589e")," \u6570\u636e\u7684\u65f6\u5019\u81ea\u52a8\u8bbe\u7f6e ",Object(r.b)("inlineCode",{parentName:"li"},"TenantId")," \u7684\u503c"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u66f4\u65b0")," \u6570\u636e\u7684\u65f6\u5019\u6392\u9664 ",Object(r.b)("inlineCode",{parentName:"li"},"TenantId")," \u5c5e\u6027\u66f4\u65b0")),Object(r.b)("p",null,"\u5b9e\u73b0\u4e0a\u9762\u7684\u6b65\u9aa4\u5f88\u7b80\u5355\uff0c\u53ea\u9700\u8981\u91cd\u5199 ",Object(r.b)("inlineCode",{parentName:"p"},"SavingChangesEvent")," \u4e8b\u4ef6\u65b9\u6cd5\u5373\u53ef\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{26-48}","{26-48}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Linq;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext, IMultiTenantOnTable, IModelBuilderFilter\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public Guid? GetTenantId()\n {\n base.Tenant?.TenantId ?? Guid.Empty;\n }\n\n public void OnCreating(ModelBuilder modelBuilder, EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasQueryFilter(TenantIdQueryFilterExpression(entityBuilder, GetTenantId().Value));\n }\n\n protected override void SavingChangesEvent(object sender, SavingChangesEventArgs e)\n {\n // \u83b7\u53d6\u5f53\u524d\u4e8b\u4ef6\u5bf9\u5e94\u4e0a\u4e0b\u6587\n var dbContext = sender as FurDbContext;\n\n // \u83b7\u53d6\u6240\u6709\u65b0\u589e\u548c\u66f4\u65b0\u7684\u5b9e\u4f53\n var entities = dbContext.ChangeTracker.Entries().Where(u => u.State == EntityState.Added || u.State == EntityState.Modified);\n\n foreach (var entity in entities)\n {\n switch (entity.State)\n {\n // \u81ea\u52a8\u8bbe\u7f6e\u79df\u6237Id\n case EntityState.Added:\n entity.Property(nameof(Entity.TenantId)).CurrentValue = GetTenantId();\n break;\n // \u6392\u9664\u79df\u6237Id\n case EntityState.Modified:\n entity.Property(nameof(Entity.TenantId)).IsModified = false;\n break;\n }\n }\n }\n }\n}\n')),Object(r.b)("img",{src:Object(o.a)("img/saas1.png")}),Object(r.b)("h2",{id:"106-\u57fa\u4e8e-database-\u7684\u65b9\u5f0f"},"10.6 \u57fa\u4e8e ",Object(r.b)("inlineCode",{parentName:"h2"},"Database")," \u7684\u65b9\u5f0f"),Object(r.b)("p",null,"\u6b64\u65b9\u5f0f\u5728\u4e2d\u5927\u578b\u4f01\u4e1a\u7cfb\u7edf\u4e2d\u6700\u4e3a\u5e38\u7528\uff0c\u4e00\u4e2a\u79df\u6237\uff08\u5ba2\u6237\uff09\u4e00\u4e2a\u72ec\u7acb\u7684\u6570\u636e\u5e93\u3002"),Object(r.b)("h3",{id:"1061-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.6.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{6-7} title="Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"',"{6-7}":!0,title:'"Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class MultiTenantDbContext : AppDbContext\n {\n public MultiTenantDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u591a\u79df\u6237\u64cd\u4f5c\u5efa\u8bae\u5355\u72ec\u4e00\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u800c\u4e14\u9700\u6307\u5b9a ",Object(r.b)("inlineCode",{parentName:"p"},"MultiTenantDbContextLocator")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u3002"))),Object(r.b)("h3",{id:"1062-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.6.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{13,14}","{13,14}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n options.AddDb(DbProvider.Sqlite);\n options.AddDbPool(DbProvider.Sqlite);\n });\n }\n }\n}\n")),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u9700\u8981 ",Object(r.b)("inlineCode",{parentName:"p"},"Database")," \u591a\u79df\u6237\u65b9\u6848\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u9700\u8981\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"AddDb")," \u6ce8\u518c\uff0c\u800c\u4e0d\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"AddDbPool"),"\u3002\u539f\u56e0\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"AddDbPool")," \u65b9\u5f0f\u6ce8\u518c\u540e\u7eed\u4e0d\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},"OnConfiguring")," \u91cd\u5199\uff01\uff01\uff01"))),Object(r.b)("h3",{id:"1063-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e"},"10.6.3 \u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u79cd\u5b50\u6570\u636e"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{8,12-30} title="Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"',"{8,12-30}":!0,title:'"Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.EntityFramework.Core\n{\n public class TenantSeedData : IEntitySeedData\n {\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Tenant\n {\n TenantId=Guid.Parse("383AFB88-F519-FFF8-B364-6D563BF3687F"),\n Name="\u9ed8\u8ba4\u79df\u6237",\n Host="localhost:44313",\n CreatedTime=DateTime.Parse("2020-10-06 20:19:07"),\n ConnectionString="Data Source=./Fur.db" // \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32\n },\n new Tenant\n {\n TenantId=Guid.Parse("C5798CB6-16D6-0F42-EB56-59C695353BC0"),\n Name="\u5176\u4ed6\u79df\u6237",\n Host="localhost:5000",\n CreatedTime=DateTime.Parse("2020-10-06 20:20:32"),\n ConnectionString="Data Source=./Fur2.db" // \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32\n }\n };\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u8be5\u6b65\u9aa4\u53ea\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Code First")," \u65b9\u5f0f\u6267\u884c\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Database First")," \u65e0\u9700\u914d\u7f6e\u79cd\u5b50\u6570\u636e\u3002"))),Object(r.b)("h3",{id:"1064-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868"},"10.6.4 \u6839\u636e\u6a21\u578b\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u8868"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration add_tenant_table -Context MultiTenantDbContext\n")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database -Context MultiTenantDbContext\n")),Object(r.b)("h3",{id:"1065-\u5b9e\u73b0-imultitenantondatabase-\u63a5\u53e3"},"10.6.5 \u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"h3"},"IMultiTenantOnDatabase")," \u63a5\u53e3"),Object(r.b)("p",null,"\u5728\u9700\u8981\u591a\u79df\u6237\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u4e2d\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"IMultiTenantOnDatabase")," \u63a5\u53e3\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6,12-15}","{6,12-15}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n public class FurDbContext : AppDbContext, IMultiTenantOnDatabase\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public string GetDatabaseConnectionString()\n {\n return base.Tenant?.ConnectionString;\n }\n }\n}\n")),Object(r.b)("h3",{id:"1066-\u91cd\u5199-onconfiguring-\u65b9\u6cd5"},"10.6.6 \u91cd\u5199 ",Object(r.b)("inlineCode",{parentName:"h3"},"OnConfiguring")," \u65b9\u6cd5"),Object(r.b)("p",null,"\u5728\u9700\u8981\u591a\u79df\u6237\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u4e2d\u91cd\u5199 ",Object(r.b)("inlineCode",{parentName:"p"},"OnConfiguring")," \u65b9\u6cd5\u5e76\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{12-17}","{12-17}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n public class FurDbContext : AppDbContext, IMultiTenantOnDatabase\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)\n {\n optionsBuilder.UseSqlite(GetDatabaseConnectionString());\n\n base.OnConfiguring(optionsBuilder);\n }\n\n public string GetDatabaseConnectionString()\n {\n return base.Tenant?.ConnectionString;\n }\n }\n}\n")),Object(r.b)("img",{src:Object(o.a)("img/saas2.png")}),Object(r.b)("h2",{id:"107-\u57fa\u4e8e-schema-\u7684\u65b9\u5f0f"},"10.7 \u57fa\u4e8e ",Object(r.b)("inlineCode",{parentName:"h2"},"Schema")," \u7684\u65b9\u5f0f"),Object(r.b)("p",null,"\u6b64\u65b9\u5f0f\u5728\u4e2d\u5c0f\u578b\u4f01\u4e1a\u7cfb\u7edf\u4e2d\u4e5f\u4e0d\u5c11\u89c1\uff0c\u4e00\u4e2a\u79df\u6237\uff08\u5ba2\u6237\uff09\u5171\u4eab\u6570\u636e\u5e93\u4e14\u4e0d\u540c ",Object(r.b)("inlineCode",{parentName:"p"},"Schema"),"\u3002"),Object(r.b)("h3",{id:"1071-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.7.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{6-7} title="Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"',"{6-7}":!0,title:'"Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class MultiTenantDbContext : AppDbContext\n {\n public MultiTenantDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u591a\u79df\u6237\u64cd\u4f5c\u5efa\u8bae\u5355\u72ec\u4e00\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u800c\u4e14\u9700\u6307\u5b9a ",Object(r.b)("inlineCode",{parentName:"p"},"MultiTenantDbContextLocator")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u3002"))),Object(r.b)("h3",{id:"1072-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.7.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{14}","{14}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n options.AddDbPool(DbProvider.Sqlite);\n options.AddDbPool(DbProvider.Sqlite);\n });\n }\n }\n}\n")),Object(r.b)("h3",{id:"1073-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e"},"10.7.3 \u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u79cd\u5b50\u6570\u636e"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{8,12-30} title="Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"',"{8,12-30}":!0,title:'"Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.EntityFramework.Core\n{\n public class TenantSeedData : IEntitySeedData\n {\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Tenant\n {\n TenantId=Guid.Parse("383AFB88-F519-FFF8-B364-6D563BF3687F"),\n Name="\u9ed8\u8ba4\u79df\u6237",\n Host="localhost:44313",\n CreatedTime=DateTime.Parse("2020-10-06 20:19:07"),\n Schema="dbo" // Schema\n },\n new Tenant\n {\n TenantId=Guid.Parse("C5798CB6-16D6-0F42-EB56-59C695353BC0"),\n Name="\u5176\u4ed6\u79df\u6237",\n Host="localhost:5000",\n CreatedTime=DateTime.Parse("2020-10-06 20:20:32"),\n Schema="fur" // Schema\n }\n };\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u8be5\u6b65\u9aa4\u53ea\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Code First")," \u65b9\u5f0f\u6267\u884c\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Database First")," \u65e0\u9700\u914d\u7f6e\u79cd\u5b50\u6570\u636e\u3002"))),Object(r.b)("h3",{id:"1074-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868"},"10.7.4 \u6839\u636e\u6a21\u578b\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u8868"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration add_tenant_table -Context MultiTenantDbContext\n")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database -Context MultiTenantDbContext\n")),Object(r.b)("h3",{id:"1075-\u5b9e\u73b0-imultitenantonschema-\u63a5\u53e3"},"10.7.5 \u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"h3"},"IMultiTenantOnSchema")," \u63a5\u53e3"),Object(r.b)("p",null,"\u5728\u9700\u8981\u591a\u79df\u6237\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u4e2d\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"IMultiTenantOnSchema")," \u63a5\u53e3\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6,12-15}","{6,12-15}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext, IMultiTenantOnSchema\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public string GetSchemaName()\n {\n return base.Tenant?.Schema;\n }\n }\n}\n')),Object(r.b)("h3",{id:"1076-\u5173\u4e8e-code-first-\u6570\u636e\u8fc1\u79fb"},"10.7.6 \u5173\u4e8e ",Object(r.b)("inlineCode",{parentName:"h3"},"Code First \u6570\u636e\u8fc1\u79fb")),Object(r.b)("p",null,"\u57fa\u4e8e ",Object(r.b)("inlineCode",{parentName:"p"},"Schema")," \u65b9\u5f0f\u6bd4\u8f83\u7279\u522b\uff0c\u751f\u6210\u6570\u636e\u8fc1\u79fb\u7684\u65f6\u5019\u6ca1\u529e\u6cd5\u83b7\u53d6\u79df\u6237\u4fe1\u606f\uff0c\u6240\u4ee5\u5efa\u8bae",Object(r.b)("strong",{parentName:"p"},"\u5206\u5f00\u591a\u6b21\u8fc1\u79fb"),"\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'public string GetSchemaName()\n{\n return base.Tenant?.Schema?? "\u79df\u6237\u4e00Schema";\n}\n')),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'public string GetSchemaName()\n{\n return base.Tenant?.Schema?? "\u79df\u6237\u4e8cSchema";\n}\n')),Object(r.b)("p",null,"\u8fd9\u6837\u5c31\u53ef\u4ee5\u5728\u8fc1\u79fb\u7684\u65f6\u5019\u751f\u6210\u591a\u6b21\u8fc1\u79fb\u4e86\u3002"),Object(r.b)("h2",{id:"108-\u53cd\u9988\u4e0e\u5efa\u8bae"},"10.8 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/1ea356f4.c545d4f3.js b/docs/1ea356f4.c545d4f3.js deleted file mode 100644 index 9af1b5c8953..00000000000 --- a/docs/1ea356f4.c545d4f3.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return d})),t.d(n,"b",(function(){return m}));var a=t(0),i=t.n(a);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function c(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=i.a.createContext({}),l=function(e){var n=i.a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},d=function(e){var n=l(e.components);return i.a.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},u=i.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,o=e.parentName,s=b(e,["components","mdxType","originalType","parentName"]),d=l(t),u=a,m=d["".concat(o,".").concat(u)]||d[u]||p[u]||r;return t?i.a.createElement(m,c(c({ref:n},s),{},{components:t})):i.a.createElement(m,c({ref:n},s))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,o=new Array(r);o[0]=u;var c={};for(var b in n)hasOwnProperty.call(n,b)&&(c[b]=n[b]);c.originalType=e,c.mdxType="string"==typeof e?e:a,o[1]=c;for(var s=2;sSaaS",id:"101-\u4ec0\u4e48\u662f-saas",children:[]},{value:"10.2 \u4ec0\u4e48\u662f\u591a\u79df\u6237",id:"102-\u4ec0\u4e48\u662f\u591a\u79df\u6237",children:[]},{value:"10.3 \u5b9e\u73b0\u591a\u79df\u6237\u65b9\u6848",id:"103-\u5b9e\u73b0\u591a\u79df\u6237\u65b9\u6848",children:[{value:"10.3.1 \u72ec\u7acb\u6570\u636e\u5e93",id:"1031-\u72ec\u7acb\u6570\u636e\u5e93",children:[]},{value:"10.3.2 \u5171\u4eab\u6570\u636e\u5e93\uff0c\u72ec\u7acb Schema",id:"1032-\u5171\u4eab\u6570\u636e\u5e93\uff0c\u72ec\u7acb-schema",children:[]},{value:"10.3.3 \u5171\u4eab\u6570\u636e\u5e93\uff0c\u5171\u4eab Schema",id:"1033-\u5171\u4eab\u6570\u636e\u5e93\uff0c\u5171\u4eab-schema",children:[]}]},{value:"10.4 \u591a\u79df\u6237\u4f7f\u7528\u65b9\u6848",id:"104-\u591a\u79df\u6237\u4f7f\u7528\u65b9\u6848",children:[]},{value:"10.5 \u57fa\u4e8e TenantId \u7684\u65b9\u5f0f",id:"105-\u57fa\u4e8e-tenantid-\u7684\u65b9\u5f0f",children:[{value:"10.5.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1051-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.5.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1052-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.5.3 \u6dfb\u52a0 Tenant \u79cd\u5b50\u6570\u636e",id:"1053-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e",children:[]},{value:"10.5.4 \u6839\u636e\u6a21\u578b\u521b\u5efa Tenant \u8868",id:"1054-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868",children:[]},{value:"10.5.5 \u5b9e\u73b0 IMultiTenantOnTable \u63a5\u53e3",id:"1055-\u5b9e\u73b0-imultitenantontable-\u63a5\u53e3",children:[]},{value:"10.5.6 \u5b9e\u73b0 IModelBuilderFilter \u63a5\u53e3",id:"1056-\u5b9e\u73b0-imodelbuilderfilter-\u63a5\u53e3",children:[]},{value:"10.5.7 \u91cd\u5199 SavingChangesEvent \u4e8b\u4ef6\u65b9\u6cd5",id:"1057-\u91cd\u5199-savingchangesevent-\u4e8b\u4ef6\u65b9\u6cd5",children:[]}]},{value:"10.6 \u57fa\u4e8e Database \u7684\u65b9\u5f0f",id:"106-\u57fa\u4e8e-database-\u7684\u65b9\u5f0f",children:[{value:"10.6.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1061-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.6.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1062-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.6.3 \u6dfb\u52a0 Tenant \u79cd\u5b50\u6570\u636e",id:"1063-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e",children:[]},{value:"10.6.4 \u6839\u636e\u6a21\u578b\u521b\u5efa Tenant \u8868",id:"1064-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868",children:[]},{value:"10.6.5 \u5b9e\u73b0 IMultiTenantOnDatabase \u63a5\u53e3",id:"1065-\u5b9e\u73b0-imultitenantondatabase-\u63a5\u53e3",children:[]},{value:"10.6.6 \u91cd\u5199 OnConfiguring \u65b9\u6cd5",id:"1066-\u91cd\u5199-onconfiguring-\u65b9\u6cd5",children:[]}]},{value:"10.7 \u57fa\u4e8e Schema \u7684\u65b9\u5f0f",id:"107-\u57fa\u4e8e-schema-\u7684\u65b9\u5f0f",children:[{value:"10.7.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1071-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.7.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"1072-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"10.7.3 \u6dfb\u52a0 Tenant \u79cd\u5b50\u6570\u636e",id:"1073-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e",children:[]},{value:"10.7.4 \u6839\u636e\u6a21\u578b\u521b\u5efa Tenant \u8868",id:"1074-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868",children:[]},{value:"10.7.5 \u5b9e\u73b0 IMultiTenantOnSchema \u63a5\u53e3",id:"1075-\u5b9e\u73b0-imultitenantonschema-\u63a5\u53e3",children:[]},{value:"10.7.6 \u5173\u4e8e Code First \u6570\u636e\u8fc1\u79fb",id:"1076-\u5173\u4e8e-code-first-\u6570\u636e\u8fc1\u79fb",children:[]}]},{value:"10.8 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"108-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],l={rightToc:s};function d(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"101-\u4ec0\u4e48\u662f-saas"},"10.1 \u4ec0\u4e48\u662f ",Object(r.b)("inlineCode",{parentName:"h2"},"SaaS")),Object(r.b)("blockquote",null,Object(r.b)("p",{parentName:"blockquote"},"SaaS \u662f Software-as-a-Service\uff08\u8f6f\u4ef6\u5373\u670d\u52a1\uff09\u7684\u7b80\u79f0\uff0c\u968f\u7740\u4e92\u8054\u7f51\u6280\u672f\u7684\u53d1\u5c55\u548c\u5e94\u7528\u8f6f\u4ef6\u7684\u6210\u719f\uff0c \u5728 21 \u4e16\u7eaa\u5f00\u59cb\u5174\u8d77\u7684\u4e00\u79cd\u5b8c\u5168\u521b\u65b0\u7684\u8f6f\u4ef6\u5e94\u7528\u6a21\u5f0f\u3002\u5b83\u4e0e\u201con-demand software\u201d\uff0cthe application service provider(ASP\uff0c\u5e94\u7528\u670d\u52a1\u63d0\u4f9b\u5546)\uff0chosted software(\u6258\u7ba1\u8f6f\u4ef6)\u6240\u5177\u6709\u76f8\u4f3c\u7684\u542b\u4e49\u3002"),Object(r.b)("p",{parentName:"blockquote"},"\u5b83\u662f\u4e00\u79cd\u901a\u8fc7 Internet \u63d0\u4f9b\u8f6f\u4ef6\u7684\u6a21\u5f0f\uff0c\u5382\u5546\u5c06\u5e94\u7528\u8f6f\u4ef6\u7edf\u4e00\u90e8\u7f72\u5728\u81ea\u5df1\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u5ba2\u6237\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u5b9e\u9645\u9700\u6c42\uff0c\u901a\u8fc7\u4e92\u8054\u7f51\u5411\u5382\u5546\u5b9a\u8d2d\u6240\u9700\u7684\u5e94\u7528\u8f6f\u4ef6\u670d\u52a1\uff0c\u6309\u5b9a\u8d2d\u7684\u670d\u52a1\u591a\u5c11\u548c\u65f6\u95f4\u957f\u77ed\u5411\u5382\u5546\u652f\u4ed8\u8d39\u7528\uff0c\u5e76\u901a\u8fc7\u4e92\u8054\u7f51\u83b7\u5f97\u5382\u5546\u63d0\u4f9b\u7684\u670d\u52a1\u3002\u7528\u6237\u4e0d\u7528\u518d\u8d2d\u4e70\u8f6f\u4ef6\uff0c\u800c\u6539\u7528\u5411\u63d0\u4f9b\u5546\u79df\u7528\u57fa\u4e8e Web \u7684\u8f6f\u4ef6\uff0c\u6765\u7ba1\u7406\u4f01\u4e1a\u7ecf\u8425\u6d3b\u52a8\uff0c\u4e14\u65e0\u9700\u5bf9\u8f6f\u4ef6\u8fdb\u884c\u7ef4\u62a4\uff0c\u670d\u52a1\u63d0\u4f9b\u5546\u4f1a\u5168\u6743\u7ba1\u7406\u548c\u7ef4\u62a4\u8f6f\u4ef6\uff0c\u8f6f\u4ef6\u5382\u5546\u5728\u5411\u5ba2\u6237\u63d0\u4f9b\u4e92\u8054\u7f51\u5e94\u7528\u7684\u540c\u65f6\uff0c\u4e5f\u63d0\u4f9b\u8f6f\u4ef6\u7684\u79bb\u7ebf\u64cd\u4f5c\u548c\u672c\u5730\u6570\u636e\u5b58\u50a8\uff0c\u8ba9\u7528\u6237\u968f\u65f6\u968f\u5730\u90fd\u53ef\u4ee5\u4f7f\u7528\u5176\u5b9a\u8d2d\u7684\u8f6f\u4ef6\u548c\u670d\u52a1\u3002"),Object(r.b)("p",{parentName:"blockquote"},"\u5bf9\u4e8e\u8bb8\u591a\u5c0f\u578b\u4f01\u4e1a\u6765\u8bf4\uff0cSaaS \u662f\u91c7\u7528\u5148\u8fdb\u6280\u672f\u7684\u6700\u597d\u9014\u5f84\uff0c\u5b83\u6d88\u9664\u4e86\u4f01\u4e1a\u8d2d\u4e70\u3001\u6784\u5efa\u548c\u7ef4\u62a4\u57fa\u7840\u8bbe\u65bd\u548c\u5e94\u7528\u7a0b\u5e8f\u7684\u9700\u8981\u3002")),Object(r.b)("h2",{id:"102-\u4ec0\u4e48\u662f\u591a\u79df\u6237"},"10.2 \u4ec0\u4e48\u662f\u591a\u79df\u6237"),Object(r.b)("p",null,"\u591a\u79df\u6237\u6280\u672f\u6216\u79f0\u591a\u91cd\u79df\u8d41\u6280\u672f\uff0c\u7b80\u79f0 ",Object(r.b)("inlineCode",{parentName:"p"},"SaaS"),"\uff0c\u662f\u4e00\u79cd\u8f6f\u4ef6\u67b6\u6784\u6280\u672f\uff0c\u662f\u5b9e\u73b0\u5982\u4f55\u5728\u591a\u7528\u6237\u73af\u5883\u4e0b\uff08\u6b64\u5904\u7684\u591a\u7528\u6237\u4e00\u822c\u662f\u9762\u5411\u4f01\u4e1a\u7528\u6237\uff09\u5171\u7528\u76f8\u540c\u7684\u7cfb\u7edf\u6216\u7a0b\u5e8f\u7ec4\u4ef6\uff0c\u5e76\u4e14\u53ef\u786e\u4fdd\u5404\u7528\u6237\u95f4\u6570\u636e\u7684\u9694\u79bb\u6027\u3002"),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u7b80\u5355\u8bb2\uff1a\u5728\u4e00\u53f0\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u5355\u4e2a\u5e94\u7528\u5b9e\u4f8b\uff0c\u5b83\u4e3a\u591a\u4e2a\u79df\u6237\uff08\u5ba2\u6237\uff09\u63d0\u4f9b\u670d\u52a1\u3002"),"\u4ece\u5b9a\u4e49\u4e2d\u6211\u4eec\u53ef\u4ee5\u7406\u89e3\uff1a\u591a\u79df\u6237\u662f\u4e00\u79cd\u67b6\u6784\uff0c\u76ee\u7684\u662f\u4e3a\u4e86\u8ba9\u591a\u7528\u6237\u73af\u5883\u4e0b\u4f7f\u7528\u540c\u4e00\u5957\u7a0b\u5e8f\uff0c\u4e14\u4fdd\u8bc1\u7528\u6237\u95f4\u6570\u636e\u9694\u79bb\u3002\u90a3\u4e48\u91cd\u70b9\u5c31\u5f88\u6d45\u663e\u6613\u61c2\u4e86\uff0c\u591a\u79df\u6237\u7684\u91cd\u70b9\u5c31\u662f\u540c\u4e00\u5957\u7a0b\u5e8f\u4e0b\u5b9e\u73b0\u591a\u7528\u6237\u6570\u636e\u7684\u9694\u79bb\u3002"),Object(r.b)("h2",{id:"103-\u5b9e\u73b0\u591a\u79df\u6237\u65b9\u6848"},"10.3 \u5b9e\u73b0\u591a\u79df\u6237\u65b9\u6848"),Object(r.b)("h3",{id:"1031-\u72ec\u7acb\u6570\u636e\u5e93"},"10.3.1 \u72ec\u7acb\u6570\u636e\u5e93"),Object(r.b)("p",null,"\u8fd9\u662f\u7b2c\u4e00\u79cd\u65b9\u6848\uff0c\u5373\u4e00\u4e2a\u79df\u6237\u4e00\u4e2a\u6570\u636e\u5e93\uff0c\u8fd9\u79cd\u65b9\u6848\u7684\u7528\u6237\u6570\u636e\u9694\u79bb\u7ea7\u522b\u6700\u9ad8\uff0c\u5b89\u5168\u6027\u6700\u597d\uff0c\u4f46\u6210\u672c\u8f83\u9ad8\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u4f18\u70b9\uff1a"),"\n\u4e3a\u4e0d\u540c\u7684\u79df\u6237\u63d0\u4f9b\u72ec\u7acb\u7684\u6570\u636e\u5e93\uff0c\u6709\u52a9\u4e8e\u7b80\u5316\u6570\u636e\u6a21\u578b\u7684\u6269\u5c55\u8bbe\u8ba1\uff0c\u6ee1\u8db3\u4e0d\u540c\u79df\u6237\u7684\u72ec\u7279\u9700\u6c42\uff1b\u5982\u679c\u51fa\u73b0\u6545\u969c\uff0c\u6062\u590d\u6570\u636e\u6bd4\u8f83\u7b80\u5355\u3002")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u7f3a\u70b9\uff1a"),"\n\u589e\u591a\u4e86\u6570\u636e\u5e93\u7684\u5b89\u88c5\u6570\u91cf\uff0c\u968f\u4e4b\u5e26\u6765\u7ef4\u62a4\u6210\u672c\u548c\u8d2d\u7f6e\u6210\u672c\u7684\u589e\u52a0\u3002 \u8fd9\u79cd\u65b9\u6848\u4e0e\u4f20\u7edf\u7684\u4e00\u4e2a\u5ba2\u6237\u3001\u4e00\u5957\u6570\u636e\u3001\u4e00\u5957\u90e8\u7f72\u7c7b\u4f3c\uff0c\u5dee\u522b\u53ea\u5728\u4e8e\u8f6f\u4ef6\u7edf\u4e00\u90e8\u7f72\u5728\u8fd0\u8425\u5546\u90a3\u91cc\u3002\u5982\u679c\u9762\u5bf9\u7684\u662f\u94f6\u884c\u3001\u533b\u9662\u7b49\u9700\u8981\u975e\u5e38\u9ad8\u6570\u636e\u9694\u79bb\u7ea7\u522b\u7684\u79df\u6237\uff0c\u53ef\u4ee5\u9009\u62e9\u8fd9\u79cd\u6a21\u5f0f\uff0c\u63d0\u9ad8\u79df\u7528\u7684\u5b9a\u4ef7\u3002\u5982\u679c\u5b9a\u4ef7\u8f83\u4f4e\uff0c\u4ea7\u54c1\u8d70\u4f4e\u4ef7\u8def\u7ebf\uff0c\u8fd9\u79cd\u65b9\u6848\u4e00\u822c\u5bf9\u8fd0\u8425\u5546\u6765\u8bf4\u662f\u65e0\u6cd5\u627f\u53d7\u7684\u3002"))),Object(r.b)("h3",{id:"1032-\u5171\u4eab\u6570\u636e\u5e93\uff0c\u72ec\u7acb-schema"},"10.3.2 \u5171\u4eab\u6570\u636e\u5e93\uff0c\u72ec\u7acb ",Object(r.b)("inlineCode",{parentName:"h3"},"Schema")),Object(r.b)("p",null,"\u8fd9\u662f\u7b2c\u4e8c\u79cd\u65b9\u6848\uff0c\u5373\u591a\u4e2a\u6216\u6240\u6709\u79df\u6237\u5171\u4eab ",Object(r.b)("inlineCode",{parentName:"p"},"Database"),"\uff0c\u4f46\u662f\u6bcf\u4e2a\u79df\u6237\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"Schema"),"\uff08\u4e5f\u53ef\u53eb\u505a\u4e00\u4e2a user\uff09\u3002\u5e95\u5c42\u5e93\u6bd4\u5982\u662f\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"SqlServer"),"\u3001",Object(r.b)("inlineCode",{parentName:"p"},"Oracle")," \u7b49\uff0c\u4e00\u4e2a\u6570\u636e\u5e93\u4e0b\u53ef\u4ee5\u6709\u591a\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"Schema"),"\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u4f18\u70b9\uff1a"),"\n\u4e3a\u5b89\u5168\u6027\u8981\u6c42\u8f83\u9ad8\u7684\u79df\u6237\u63d0\u4f9b\u4e86\u4e00\u5b9a\u7a0b\u5ea6\u7684\u903b\u8f91\u6570\u636e\u9694\u79bb\uff0c\u5e76\u4e0d\u662f\u5b8c\u5168\u9694\u79bb\uff1b\u6bcf\u4e2a\u6570\u636e\u5e93\u53ef\u652f\u6301\u66f4\u591a\u7684\u79df\u6237\u6570\u91cf\u3002")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u7f3a\u70b9\uff1a"),"\n\u5982\u679c\u51fa\u73b0\u6545\u969c\uff0c\u6570\u636e\u6062\u590d\u6bd4\u8f83\u56f0\u96be\uff0c\u56e0\u4e3a\u6062\u590d\u6570\u636e\u5e93\u5c06\u7275\u6d89\u5230\u5176\u4ed6\u79df\u6237\u7684\u6570\u636e\uff1b \u5982\u679c\u9700\u8981\u8de8\u79df\u6237\u7edf\u8ba1\u6570\u636e\uff0c\u5b58\u5728\u4e00\u5b9a\u56f0\u96be\u3002"))),Object(r.b)("h3",{id:"1033-\u5171\u4eab\u6570\u636e\u5e93\uff0c\u5171\u4eab-schema"},"10.3.3 \u5171\u4eab\u6570\u636e\u5e93\uff0c\u5171\u4eab ",Object(r.b)("inlineCode",{parentName:"h3"},"Schema")),Object(r.b)("p",null,"\u5171\u4eab\u6570\u636e\u8868 \u8fd9\u662f\u7b2c\u4e09\u79cd\u65b9\u6848\uff0c\u5373\u79df\u6237\u5171\u4eab\u540c\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"Database"),"\u3001\u540c\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"Schema"),"\uff0c\u4f46\u5728\u8868\u4e2d\u589e\u52a0 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"TenantId"))," \u591a\u79df\u6237\u7684\u6570\u636e\u5b57\u6bb5\u3002\u8fd9\u662f\u5171\u4eab\u7a0b\u5ea6\u6700\u9ad8\u3001\u9694\u79bb\u7ea7\u522b\u6700\u4f4e\u7684\u6a21\u5f0f\u3002 \u5373\u6bcf\u63d2\u5165\u4e00\u6761\u6570\u636e\u65f6\u90fd\u9700\u8981\u6709\u4e00\u4e2a\u5ba2\u6237\u7684\u6807\u8bc6\u3002\u8fd9\u6837\u624d\u80fd\u5728\u540c\u4e00\u5f20\u8868\u4e2d\u533a\u5206\u51fa\u4e0d\u540c\u5ba2\u6237\u7684\u6570\u636e\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u4f18\u70b9\uff1a"),"\n\u4e09\u79cd\u65b9\u6848\u6bd4\u8f83\uff0c\u7b2c\u4e09\u79cd\u65b9\u6848\u7684\u7ef4\u62a4\u548c\u8d2d\u7f6e\u6210\u672c\u6700\u4f4e\uff0c\u5141\u8bb8\u6bcf\u4e2a\u6570\u636e\u5e93\u652f\u6301\u7684\u79df\u6237\u6570\u91cf\u6700\u591a\u3002")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},Object(r.b)("strong",{parentName:"p"},"\u7f3a\u70b9\uff1a"),"\n\u9694\u79bb\u7ea7\u522b\u6700\u4f4e\uff0c\u5b89\u5168\u6027\u6700\u4f4e\uff0c\u9700\u8981\u5728\u8bbe\u8ba1\u5f00\u53d1\u65f6\u52a0\u5927\u5bf9\u5b89\u5168\u7684\u5f00\u53d1\u91cf\uff1b \u6570\u636e\u5907\u4efd\u548c\u6062\u590d\u6700\u56f0\u96be\uff0c\u9700\u8981\u9010\u8868\u9010\u6761\u5907\u4efd\u548c\u8fd8\u539f\u3002"))),Object(r.b)("h2",{id:"104-\u591a\u79df\u6237\u4f7f\u7528\u65b9\u6848"},"10.4 \u591a\u79df\u6237\u4f7f\u7528\u65b9\u6848"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u652f\u6301\u4ee5\u4e0a\u4e09\u79cd\u591a\u79df\u6237\u5b9e\u73b0\u65b9\u6848\uff0c\u4f7f\u7528\u7b80\u5355\u4e14\u5bb9\u6613\u7ef4\u62a4\u3002\u4e0b\u9762\u5206\u522b\u4f7f\u7528\u4e09\u79cd\u4e0d\u540c\u65b9\u5f0f\u6f14\u793a\u591a\u79df\u6237\u65b9\u6848\u7528\u6cd5\u3002"),Object(r.b)("h2",{id:"105-\u57fa\u4e8e-tenantid-\u7684\u65b9\u5f0f"},"10.5 \u57fa\u4e8e ",Object(r.b)("inlineCode",{parentName:"h2"},"TenantId")," \u7684\u65b9\u5f0f"),Object(r.b)("p",null,"\u6b64\u65b9\u5f0f\u5728\u4e2d\u5c0f\u578b\u4f01\u4e1a\u7cfb\u7edf\u4e2d\u6700\u4e3a\u5e38\u7528\uff0c\u7ef4\u62a4\u6210\u672c\u4f4e\uff0c\u8d2d\u7f6e\u6210\u672c\u4f4e\u3002"),Object(r.b)("h3",{id:"1051-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.5.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{6-7} title="Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"',"{6-7}":!0,title:'"Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class MultiTenantDbContext : AppDbContext\n {\n public MultiTenantDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u591a\u79df\u6237\u64cd\u4f5c\u5efa\u8bae\u5355\u72ec\u4e00\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u800c\u4e14\u9700\u6307\u5b9a ",Object(r.b)("inlineCode",{parentName:"p"},"MultiTenantDbContextLocator")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u3002"))),Object(r.b)("h3",{id:"1052-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.5.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{14}","{14}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n options.AddDbPool(DbProvider.Sqlite);\n options.AddDbPool(DbProvider.Sqlite);\n });\n }\n }\n}\n")),Object(r.b)("h3",{id:"1053-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e"},"10.5.3 \u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u79cd\u5b50\u6570\u636e"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{8,12-28} title="Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"',"{8,12-28}":!0,title:'"Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.EntityFramework.Core\n{\n public class TenantSeedData : IEntitySeedData\n {\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Tenant\n {\n TenantId=Guid.Parse("383AFB88-F519-FFF8-B364-6D563BF3687F"),\n Name="\u9ed8\u8ba4\u79df\u6237",\n Host="localhost:44313",\n CreatedTime=DateTime.Parse("2020-10-06 20:19:07")\n },\n new Tenant\n {\n TenantId=Guid.Parse("C5798CB6-16D6-0F42-EB56-59C695353BC0"),\n Name="\u5176\u4ed6\u79df\u6237",\n Host="localhost:5000",\n CreatedTime=DateTime.Parse("2020-10-06 20:20:32")\n }\n };\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u8be5\u6b65\u9aa4\u53ea\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Code First")," \u65b9\u5f0f\u6267\u884c\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Database First")," \u65e0\u9700\u914d\u7f6e\u79cd\u5b50\u6570\u636e\u3002"))),Object(r.b)("h3",{id:"1054-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868"},"10.5.4 \u6839\u636e\u6a21\u578b\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u8868"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration add_tenant_table -Context MultiTenantDbContext\n")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database -Context MultiTenantDbContext\n")),Object(r.b)("h3",{id:"1055-\u5b9e\u73b0-imultitenantontable-\u63a5\u53e3"},"10.5.5 \u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"h3"},"IMultiTenantOnTable")," \u63a5\u53e3"),Object(r.b)("p",null,"\u5728\u9700\u8981\u591a\u79df\u6237\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u4e2d\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"IMultiTenantOnTable")," \u63a5\u53e3\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{8,14-17}","{8,14-17}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing System;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext, IMultiTenantOnTable, IModelBuilderFilter\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public Guid? GetTenantId()\n {\n base.Tenant?.TenantId ?? Guid.Empty;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"GetTenantId()")," \u65b9\u6cd5\u4e2d\uff0c\u9996\u5148\u83b7\u53d6\u8bf7\u6c42\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"\u4e3b\u673a\u5730\u5740"),"\uff0c\u7136\u540e\u6839\u636e\u4e3b\u673a\u5730\u5740\u67e5\u8be2\u5bf9\u5e94\u7684\u79df\u6237 ",Object(r.b)("inlineCode",{parentName:"p"},"TenantIdId"),"\uff0c\u907f\u514d\u591a\u6b21\u67e5\u8be2\u6570\u636e\u5e93\uff0c\u8fd9\u91cc\u4f7f\u7528\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"IMemoryCache")," \u5185\u5b58\u7f13\u5b58\u3002"),Object(r.b)("h3",{id:"1056-\u5b9e\u73b0-imodelbuilderfilter-\u63a5\u53e3"},"10.5.6 \u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"h3"},"IModelBuilderFilter")," \u63a5\u53e3"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"IModelBuilderFilter")," \u63a5\u53e3\u662f\u5168\u5c40\u67e5\u8be2\u8fc7\u6ee4\u5668\u5b9e\u73b0\u63a5\u53e3\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u914d\u7f6e\u5b9e\u4f53 ",Object(r.b)("inlineCode",{parentName:"p"},"TenantId")," \u8fc7\u6ee4\u5668"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{9,20-23}","{9,20-23}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext, IMultiTenantOnTable, IModelBuilderFilter\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public Guid? GetTenantId()\n {\n base.Tenant?.TenantId ?? Guid.Empty;\n }\n\n public void OnCreating(ModelBuilder modelBuilder, EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasQueryFilter(TenantIdQueryFilterExpression(entityBuilder, GetTenantId().Value));\n }\n }\n}\n')),Object(r.b)("h3",{id:"1057-\u91cd\u5199-savingchangesevent-\u4e8b\u4ef6\u65b9\u6cd5"},"10.5.7 \u91cd\u5199 ",Object(r.b)("inlineCode",{parentName:"h3"},"SavingChangesEvent")," \u4e8b\u4ef6\u65b9\u6cd5"),Object(r.b)("p",null,"\u901a\u8fc7\u4e0a\u9762\u7684\u6b65\u9aa4\uff0c\u6211\u4eec\u5df2\u7ecf\u89e3\u51b3\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"\u67e5\u8be2")," \u79df\u6237\u8fc7\u6ee4\u529f\u80fd\uff0c\u4f46\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"\u65b0\u589e")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"\u66f4\u65b0")," \u8fd8\u672a\u5904\u7406\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u65b0\u589e")," \u6570\u636e\u7684\u65f6\u5019\u81ea\u52a8\u8bbe\u7f6e ",Object(r.b)("inlineCode",{parentName:"li"},"TenantId")," \u7684\u503c"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u66f4\u65b0")," \u6570\u636e\u7684\u65f6\u5019\u6392\u9664 ",Object(r.b)("inlineCode",{parentName:"li"},"TenantId")," \u5c5e\u6027\u66f4\u65b0")),Object(r.b)("p",null,"\u5b9e\u73b0\u4e0a\u9762\u7684\u6b65\u9aa4\u5f88\u7b80\u5355\uff0c\u53ea\u9700\u8981\u91cd\u5199 ",Object(r.b)("inlineCode",{parentName:"p"},"SavingChangesEvent")," \u4e8b\u4ef6\u65b9\u6cd5\u5373\u53ef\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{26-48}","{26-48}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Linq;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext, IMultiTenantOnTable, IModelBuilderFilter\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public Guid? GetTenantId()\n {\n base.Tenant?.TenantId ?? Guid.Empty;\n }\n\n public void OnCreating(ModelBuilder modelBuilder, EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasQueryFilter(TenantIdQueryFilterExpression(entityBuilder, GetTenantId().Value));\n }\n\n protected override void SavingChangesEvent(object sender, SavingChangesEventArgs e)\n {\n // \u83b7\u53d6\u5f53\u524d\u4e8b\u4ef6\u5bf9\u5e94\u4e0a\u4e0b\u6587\n var dbContext = sender as FurDbContext;\n\n // \u83b7\u53d6\u6240\u6709\u65b0\u589e\u548c\u66f4\u65b0\u7684\u5b9e\u4f53\n var entities = dbContext.ChangeTracker.Entries().Where(u => u.State == EntityState.Added || u.State == EntityState.Modified);\n\n foreach (var entity in entities)\n {\n switch (entity.State)\n {\n // \u81ea\u52a8\u8bbe\u7f6e\u79df\u6237Id\n case EntityState.Added:\n entity.Property(nameof(Entity.TenantId)).CurrentValue = GetTenantId();\n break;\n // \u6392\u9664\u79df\u6237Id\n case EntityState.Modified:\n entity.Property(nameof(Entity.TenantId)).IsModified = false;\n break;\n }\n }\n }\n }\n}\n')),Object(r.b)("img",{src:Object(o.a)("img/saas1.png")}),Object(r.b)("h2",{id:"106-\u57fa\u4e8e-database-\u7684\u65b9\u5f0f"},"10.6 \u57fa\u4e8e ",Object(r.b)("inlineCode",{parentName:"h2"},"Database")," \u7684\u65b9\u5f0f"),Object(r.b)("p",null,"\u6b64\u65b9\u5f0f\u5728\u4e2d\u5927\u578b\u4f01\u4e1a\u7cfb\u7edf\u4e2d\u6700\u4e3a\u5e38\u7528\uff0c\u4e00\u4e2a\u79df\u6237\uff08\u5ba2\u6237\uff09\u4e00\u4e2a\u72ec\u7acb\u7684\u6570\u636e\u5e93\u3002"),Object(r.b)("h3",{id:"1061-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.6.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{6-7} title="Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"',"{6-7}":!0,title:'"Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class MultiTenantDbContext : AppDbContext\n {\n public MultiTenantDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u591a\u79df\u6237\u64cd\u4f5c\u5efa\u8bae\u5355\u72ec\u4e00\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u800c\u4e14\u9700\u6307\u5b9a ",Object(r.b)("inlineCode",{parentName:"p"},"MultiTenantDbContextLocator")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u3002"))),Object(r.b)("h3",{id:"1062-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.6.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{13,14}","{13,14}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n options.AddDb(DbProvider.Sqlite);\n options.AddDbPool(DbProvider.Sqlite);\n });\n }\n }\n}\n")),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u9700\u8981 ",Object(r.b)("inlineCode",{parentName:"p"},"Database")," \u591a\u79df\u6237\u65b9\u6848\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u9700\u8981\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"AddDb")," \u6ce8\u518c\uff0c\u800c\u4e0d\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"AddDbPool"),"\u3002\u539f\u56e0\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"AddDbPool")," \u65b9\u5f0f\u6ce8\u518c\u540e\u7eed\u4e0d\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},"OnConfiguring")," \u91cd\u5199\uff01\uff01\uff01"))),Object(r.b)("h3",{id:"1063-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e"},"10.6.3 \u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u79cd\u5b50\u6570\u636e"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{8,12-30} title="Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"',"{8,12-30}":!0,title:'"Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.EntityFramework.Core\n{\n public class TenantSeedData : IEntitySeedData\n {\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Tenant\n {\n TenantId=Guid.Parse("383AFB88-F519-FFF8-B364-6D563BF3687F"),\n Name="\u9ed8\u8ba4\u79df\u6237",\n Host="localhost:44313",\n CreatedTime=DateTime.Parse("2020-10-06 20:19:07"),\n ConnectionString="Data Source=./Fur.db" // \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32\n },\n new Tenant\n {\n TenantId=Guid.Parse("C5798CB6-16D6-0F42-EB56-59C695353BC0"),\n Name="\u5176\u4ed6\u79df\u6237",\n Host="localhost:5000",\n CreatedTime=DateTime.Parse("2020-10-06 20:20:32"),\n ConnectionString="Data Source=./Fur2.db" // \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32\n }\n };\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u8be5\u6b65\u9aa4\u53ea\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Code First")," \u65b9\u5f0f\u6267\u884c\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Database First")," \u65e0\u9700\u914d\u7f6e\u79cd\u5b50\u6570\u636e\u3002"))),Object(r.b)("h3",{id:"1064-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868"},"10.6.4 \u6839\u636e\u6a21\u578b\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u8868"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration add_tenant_table -Context MultiTenantDbContext\n")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database -Context MultiTenantDbContext\n")),Object(r.b)("h3",{id:"1065-\u5b9e\u73b0-imultitenantondatabase-\u63a5\u53e3"},"10.6.5 \u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"h3"},"IMultiTenantOnDatabase")," \u63a5\u53e3"),Object(r.b)("p",null,"\u5728\u9700\u8981\u591a\u79df\u6237\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u4e2d\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"IMultiTenantOnDatabase")," \u63a5\u53e3\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6,12-15}","{6,12-15}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n public class FurDbContext : AppDbContext, IMultiTenantOnDatabase\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public string GetDatabaseConnectionString()\n {\n return base.Tenant?.ConnectionString;\n }\n }\n}\n")),Object(r.b)("h3",{id:"1066-\u91cd\u5199-onconfiguring-\u65b9\u6cd5"},"10.6.6 \u91cd\u5199 ",Object(r.b)("inlineCode",{parentName:"h3"},"OnConfiguring")," \u65b9\u6cd5"),Object(r.b)("p",null,"\u5728\u9700\u8981\u591a\u79df\u6237\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u4e2d\u91cd\u5199 ",Object(r.b)("inlineCode",{parentName:"p"},"OnConfiguring")," \u65b9\u6cd5\u5e76\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{12-17}","{12-17}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n public class FurDbContext : AppDbContext, IMultiTenantOnDatabase\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)\n {\n optionsBuilder.UseSqlite(GetDatabaseConnectionString());\n\n base.OnConfiguring(optionsBuilder);\n }\n\n public string GetDatabaseConnectionString()\n {\n return base.Tenant?.ConnectionString;\n }\n }\n}\n")),Object(r.b)("img",{src:Object(o.a)("img/saas2.png")}),Object(r.b)("h2",{id:"107-\u57fa\u4e8e-schema-\u7684\u65b9\u5f0f"},"10.7 \u57fa\u4e8e ",Object(r.b)("inlineCode",{parentName:"h2"},"Schema")," \u7684\u65b9\u5f0f"),Object(r.b)("p",null,"\u6b64\u65b9\u5f0f\u5728\u4e2d\u5c0f\u578b\u4f01\u4e1a\u7cfb\u7edf\u4e2d\u4e5f\u4e0d\u5c11\u89c1\uff0c\u4e00\u4e2a\u79df\u6237\uff08\u5ba2\u6237\uff09\u5171\u4eab\u6570\u636e\u5e93\u4e14\u4e0d\u540c ",Object(r.b)("inlineCode",{parentName:"p"},"Schema"),"\u3002"),Object(r.b)("h3",{id:"1071-\u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.7.1 \u521b\u5efa\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{6-7} title="Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"',"{6-7}":!0,title:'"Fur.EntityFramework.Core\\DbContexts\\MultiTenantDbContext.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class MultiTenantDbContext : AppDbContext\n {\n public MultiTenantDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u591a\u79df\u6237\u64cd\u4f5c\u5efa\u8bae\u5355\u72ec\u4e00\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u800c\u4e14\u9700\u6307\u5b9a ",Object(r.b)("inlineCode",{parentName:"p"},"MultiTenantDbContextLocator")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u3002"))),Object(r.b)("h3",{id:"1072-\u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"10.7.2 \u6ce8\u518c\u591a\u79df\u6237\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{14}","{14}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n options.AddDbPool(DbProvider.Sqlite);\n options.AddDbPool(DbProvider.Sqlite);\n });\n }\n }\n}\n")),Object(r.b)("h3",{id:"1073-\u6dfb\u52a0-tenant-\u79cd\u5b50\u6570\u636e"},"10.7.3 \u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u79cd\u5b50\u6570\u636e"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{8,12-30} title="Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"',"{8,12-30}":!0,title:'"Fur.EntityFramework.Core\\SeedDatas\\TenantSeedData.cs"'}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.EntityFramework.Core\n{\n public class TenantSeedData : IEntitySeedData\n {\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Tenant\n {\n TenantId=Guid.Parse("383AFB88-F519-FFF8-B364-6D563BF3687F"),\n Name="\u9ed8\u8ba4\u79df\u6237",\n Host="localhost:44313",\n CreatedTime=DateTime.Parse("2020-10-06 20:19:07"),\n Schema="dbo" // Schema\n },\n new Tenant\n {\n TenantId=Guid.Parse("C5798CB6-16D6-0F42-EB56-59C695353BC0"),\n Name="\u5176\u4ed6\u79df\u6237",\n Host="localhost:5000",\n CreatedTime=DateTime.Parse("2020-10-06 20:20:32"),\n Schema="fur" // Schema\n }\n };\n }\n }\n}\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u8be5\u6b65\u9aa4\u53ea\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Code First")," \u65b9\u5f0f\u6267\u884c\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Database First")," \u65e0\u9700\u914d\u7f6e\u79cd\u5b50\u6570\u636e\u3002"))),Object(r.b)("h3",{id:"1074-\u6839\u636e\u6a21\u578b\u521b\u5efa-tenant-\u8868"},"10.7.4 \u6839\u636e\u6a21\u578b\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"h3"},"Tenant")," \u8868"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration add_tenant_table -Context MultiTenantDbContext\n")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database -Context MultiTenantDbContext\n")),Object(r.b)("h3",{id:"1075-\u5b9e\u73b0-imultitenantonschema-\u63a5\u53e3"},"10.7.5 \u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"h3"},"IMultiTenantOnSchema")," \u63a5\u53e3"),Object(r.b)("p",null,"\u5728\u9700\u8981\u591a\u79df\u6237\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u4e2d\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"IMultiTenantOnSchema")," \u63a5\u53e3\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6,12-15}","{6,12-15}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext, IMultiTenantOnSchema\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public string GetSchemaName()\n {\n return base.Tenant?.Schema;\n }\n }\n}\n')),Object(r.b)("h3",{id:"1076-\u5173\u4e8e-code-first-\u6570\u636e\u8fc1\u79fb"},"10.7.6 \u5173\u4e8e ",Object(r.b)("inlineCode",{parentName:"h3"},"Code First \u6570\u636e\u8fc1\u79fb")),Object(r.b)("p",null,"\u57fa\u4e8e ",Object(r.b)("inlineCode",{parentName:"p"},"Schema")," \u65b9\u5f0f\u6bd4\u8f83\u7279\u522b\uff0c\u751f\u6210\u6570\u636e\u8fc1\u79fb\u7684\u65f6\u5019\u6ca1\u529e\u6cd5\u83b7\u53d6\u79df\u6237\u4fe1\u606f\uff0c\u6240\u4ee5\u5efa\u8bae",Object(r.b)("strong",{parentName:"p"},"\u5206\u5f00\u591a\u6b21\u8fc1\u79fb"),"\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'public string GetSchemaName()\n{\n return base.Tenant?.Schema?? "\u79df\u6237\u4e00Schema";\n}\n')),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'public string GetSchemaName()\n{\n return base.Tenant?.Schema?? "\u79df\u6237\u4e8cSchema";\n}\n')),Object(r.b)("p",null,"\u8fd9\u6837\u5c31\u53ef\u4ee5\u5728\u8fc1\u79fb\u7684\u65f6\u5019\u751f\u6210\u591a\u6b21\u8fc1\u79fb\u4e86\u3002"),Object(r.b)("h2",{id:"108-\u53cd\u9988\u4e0e\u5efa\u8bae"},"10.8 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/2.b29b510d.js b/docs/2.b29b510d.js new file mode 100644 index 00000000000..4dd8f02f6fb --- /dev/null +++ b/docs/2.b29b510d.js @@ -0,0 +1,2 @@ +/*! For license information please see 2.b29b510d.js.LICENSE.txt */ +(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{147:function(e,t,a){"use strict";var n=a(0);const r=Object(n.createContext)(void 0);t.a=r},148:function(e,t,a){"use strict";var n=a(0),r=a(147);t.a=function(){const e=Object(n.useContext)(r.a);if(null==e)throw new Error("`useUserPreferencesContext` is used outside of `Layout` Component.");return e}},151:function(e,t,a){"use strict";t.a=()=>null},153:function(e,t,a){"use strict";var n=a(2),r=a(0),c=a.n(r),o=a(146),l=a(155),s=a(143),i=a(144),u=a(10);const d="light",m="dark",f=e=>e===m?m:d,h=()=>u.a.canUseDOM?f(document.documentElement.getAttribute("data-theme")):d,b=e=>{try{localStorage.setItem("theme",f(e))}catch(t){console.error(t)}};var v=()=>{const{siteConfig:{themeConfig:{colorMode:{disableSwitch:e=!1}={}}={}}={}}=Object(s.a)(),[t,a]=Object(r.useState)(h),n=Object(r.useCallback)(()=>{a(d),b(d)},[]),c=Object(r.useCallback)(()=>{a(m),b(m)},[]);return Object(r.useEffect)(()=>{document.documentElement.setAttribute("data-theme",f(t))},[t]),Object(r.useEffect)(()=>{if(!e)try{const e=localStorage.getItem("theme");null!==e&&a(f(e))}catch(t){console.error(t)}},[a]),Object(r.useEffect)(()=>{e||window.matchMedia("(prefers-color-scheme: dark)").addListener(({matches:e})=>{a(e?m:d)})},[]),{isDarkTheme:t===m,setLightTheme:n,setDarkTheme:c}},p=a(166);var g=function(e){const{isDarkTheme:t,setLightTheme:a,setDarkTheme:n}=v();return c.a.createElement(p.a.Provider,{value:{isDarkTheme:t,setLightTheme:a,setDarkTheme:n}},e.children)};const k="docusaurus.tab.";var E=()=>{const[e,t]=Object(r.useState)({}),a=Object(r.useCallback)((e,t)=>{try{localStorage.setItem("docusaurus.tab."+e,t)}catch(a){console.error(a)}},[]);return Object(r.useEffect)(()=>{try{const e={};for(let t=0;t{t(t=>({...t,[e]:n})),a(e,n)}}};const O="docusaurus.announcement.dismiss",y="docusaurus.announcement.id";var j=()=>{const{announcementBar:e}=Object(s.a)().siteConfig.themeConfig,[t,a]=Object(r.useState)(!0),n=Object(r.useCallback)(()=>{localStorage.setItem(O,"true"),a(!0)},[]);return Object(r.useEffect)(()=>{if(!e)return;const{id:t}=e;let n=localStorage.getItem(y);"annoucement-bar"===n&&(n="announcement-bar");const r=t!==n;localStorage.setItem(y,t),r&&localStorage.setItem(O,"false"),(r||"false"===localStorage.getItem(O))&&a(!1)},[]),{isAnnouncementBarClosed:t,closeAnnouncementBar:n}},_=a(147);var w=function(e){const{tabGroupChoices:t,setTabGroupChoices:a}=E(),{isAnnouncementBarClosed:n,closeAnnouncementBar:r}=j();return c.a.createElement(_.a.Provider,{value:{tabGroupChoices:t,setTabGroupChoices:a,isAnnouncementBarClosed:n,closeAnnouncementBar:r}},e.children)},C=a(148),N=a(53),S=a.n(N);var T=function(){const{siteConfig:{themeConfig:{announcementBar:e={}}={}}={}}=Object(s.a)(),{content:t,backgroundColor:a,textColor:n,isCloseable:r}=e,{isAnnouncementBarClosed:l,closeAnnouncementBar:i}=Object(C.a)();return!t||r&&l?null:c.a.createElement("div",{className:S.a.announcementBar,style:{backgroundColor:a,color:n},role:"banner"},c.a.createElement("div",{className:Object(o.a)(S.a.announcementBarContent,{[S.a.announcementBarCloseable]:r}),dangerouslySetInnerHTML:{__html:t}}),r?c.a.createElement("button",{type:"button",className:S.a.announcementBarClose,onClick:i,"aria-label":"Close"},c.a.createElement("span",{"aria-hidden":"true"},"\xd7")):null)},L=a(152),x=a(154),B=a(174),I=a.n(B),D=a(54),M=a.n(D);const P=({icon:e,style:t})=>c.a.createElement("span",{className:Object(o.a)(M.a.toggle,M.a.dark),style:t},e),A=({icon:e,style:t})=>c.a.createElement("span",{className:Object(o.a)(M.a.toggle,M.a.light),style:t},e);var X=function(e){const{siteConfig:{themeConfig:{colorMode:{switchConfig:{darkIcon:t,darkIconStyle:a,lightIcon:r,lightIconStyle:o}}}},isClient:l}=Object(s.a)();return c.a.createElement(I.a,Object(n.a)({disabled:!l,icons:{checked:c.a.createElement(P,{icon:t,style:a}),unchecked:c.a.createElement(A,{icon:r,style:o})}},e))},V=a(156),F=a(157);var R=function(e){const[t,a]=Object(r.useState)(e);return Object(r.useEffect)(()=>{const e=()=>a(window.location.hash);return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]),[t,a]},U=a(167);var H=e=>{const[t,a]=Object(r.useState)(!0),[n,c]=Object(r.useState)(!1),[o,l]=Object(r.useState)(0),[s,i]=Object(r.useState)(0),u=Object(r.useCallback)(e=>{null!==e&&i(e.getBoundingClientRect().height)},[]),d=Object(F.useLocation)(),[m,f]=R(d.hash);return Object(U.a)(({scrollY:t})=>{if(!e)return;if(0===t&&a(!0),t=o?a(!1):t+i{e&&(a(!0),f(d.hash))},[d]),Object(r.useEffect)(()=>{e&&m&&c(!0)},[m]),{navbarRef:u,isNavbarVisible:t}},G=a(168),Y=a(169),W=a(170),$=a(55),K=a.n($),z=a(163);const J={default:()=>z.a,docsVersion:()=>a(179).default,docsVersionDropdown:()=>a(183).default};function q({type:e,...t}){const a=((e="default")=>{const t=J[e];if(!t)throw new Error(`No NavbarItem component found for type=${e}.`);return t()})(e);return c.a.createElement(a,t)}const Q="right";var Z=function(){const{siteConfig:{themeConfig:{navbar:{title:e="",items:t=[],hideOnScroll:a=!1,style:l}={},colorMode:{disableSwitch:i=!1}={}}},isClient:u}=Object(s.a)(),[d,m]=Object(r.useState)(!1),[f,h]=Object(r.useState)(!1),{isDarkTheme:b,setLightTheme:v,setDarkTheme:p}=Object(V.a)(),{navbarRef:g,isNavbarVisible:k}=H(a),{logoLink:E,logoLinkProps:O,logoImageUrl:y,logoAlt:j}=Object(W.a)();Object(G.a)(d);const _=Object(r.useCallback)(()=>{m(!0)},[m]),w=Object(r.useCallback)(()=>{m(!1)},[m]),C=Object(r.useCallback)(e=>e.target.checked?p():v(),[v,p]),N=Object(Y.a)();Object(r.useEffect)(()=>{N===Y.b.desktop&&m(!1)},[N]);const{leftItems:S,rightItems:T}=function(e){return{leftItems:e.filter(e=>{var t;return"left"===(null!==(t=e.position)&&void 0!==t?t:Q)}),rightItems:e.filter(e=>{var t;return"right"===(null!==(t=e.position)&&void 0!==t?t:Q)})}}(t);return c.a.createElement("nav",{ref:g,className:Object(o.a)("navbar","navbar--fixed-top",{"navbar--dark":"dark"===l,"navbar--primary":"primary"===l,"navbar-sidebar--show":d,[K.a.navbarHideable]:a,[K.a.navbarHidden]:!k})},c.a.createElement("div",{className:"navbar__inner"},c.a.createElement("div",{className:"navbar__items"},null!=t&&0!==t.length&&c.a.createElement("div",{"aria-label":"Navigation bar toggle",className:"navbar__toggle",role:"button",tabIndex:0,onClick:_,onKeyDown:_},c.a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 30 30",role:"img",focusable:"false"},c.a.createElement("title",null,"Menu"),c.a.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))),c.a.createElement(L.a,Object(n.a)({className:"navbar__brand",to:E},O),null!=y&&c.a.createElement("img",{key:u,className:"navbar__logo",src:y,alt:j}),null!=e&&c.a.createElement("strong",{className:Object(o.a)("navbar__title",{[K.a.hideLogoText]:f})},e)),S.map((e,t)=>c.a.createElement(q,Object(n.a)({},e,{key:t})))),c.a.createElement("div",{className:"navbar__items navbar__items--right"},T.map((e,t)=>c.a.createElement(q,Object(n.a)({},e,{key:t}))),!i&&c.a.createElement(X,{className:K.a.displayOnlyInLargeViewport,"aria-label":"Dark mode toggle",checked:b,onChange:C}),c.a.createElement(x.a,{handleSearchBarToggle:h,isSearchBarExpanded:f}))),c.a.createElement("div",{role:"presentation",className:"navbar-sidebar__backdrop",onClick:w}),c.a.createElement("div",{className:"navbar-sidebar"},c.a.createElement("div",{className:"navbar-sidebar__brand"},c.a.createElement(L.a,Object(n.a)({className:"navbar__brand",onClick:w,to:E},O),null!=y&&c.a.createElement("img",{key:u,className:"navbar__logo",src:y,alt:j}),null!=e&&c.a.createElement("strong",{className:"navbar__title"},e)),!i&&d&&c.a.createElement(X,{"aria-label":"Dark mode toggle in sidebar",checked:b,onChange:C})),c.a.createElement("div",{className:"navbar-sidebar__items"},c.a.createElement("div",{className:"menu"},c.a.createElement("ul",{className:"menu__list"},t.map((e,t)=>c.a.createElement(q,Object(n.a)({mobile:!0},e,{onClick:w,key:t}))))))))},ee=a(56),te=a.n(ee);function ae({to:e,href:t,label:a,prependBaseUrlToHref:r,...o}){const l=Object(i.a)(e),s=Object(i.a)(t,{forcePrependBaseUrl:!0});return c.a.createElement(L.a,Object(n.a)({className:"footer__link-item"},t?{target:"_blank",rel:"noopener noreferrer",href:r?s:t}:{to:l},o),a)}const ne=({url:e,alt:t})=>c.a.createElement("img",{className:"footer__logo",alt:t,src:e});var re=function(){const e=Object(s.a)(),{siteConfig:t={}}=e,{themeConfig:a={}}=t,{footer:n}=a,{copyright:r,links:l=[],logo:u={}}=n||{},d=Object(i.a)(u.src);return n?c.a.createElement("footer",{className:Object(o.a)("footer",{"footer--dark":"dark"===n.style})},c.a.createElement("div",{className:"container"},l&&l.length>0&&c.a.createElement("div",{className:"row footer__links"},l.map((e,t)=>c.a.createElement("div",{key:t,className:"col footer__col"},null!=e.title?c.a.createElement("h4",{className:"footer__title"},e.title):null,null!=e.items&&Array.isArray(e.items)&&e.items.length>0?c.a.createElement("ul",{className:"footer__items"},e.items.map((e,t)=>e.html?c.a.createElement("li",{key:t,className:"footer__item",dangerouslySetInnerHTML:{__html:e.html}}):c.a.createElement("li",{key:e.href||e.to,className:"footer__item"},c.a.createElement(ae,e)))):null))),(u||r)&&c.a.createElement("div",{className:"text--center"},u&&u.src&&c.a.createElement("div",{className:"margin-bottom--sm"},u.href?c.a.createElement("a",{href:u.href,target:"_blank",rel:"noopener noreferrer",className:te.a.footerLogoLink},c.a.createElement(ne,{alt:u.alt,url:d})):c.a.createElement(ne,{alt:u.alt,url:d})),c.a.createElement("div",{dangerouslySetInnerHTML:{__html:r}})))):null};a(57);function ce({children:e}){return c.a.createElement(g,null,c.a.createElement(w,null,e))}t.a=function(e){const{siteConfig:t}=Object(s.a)(),{favicon:a,title:r,themeConfig:{image:u,metadatas:d},url:m,titleDelimiter:f}=t,{children:h,title:b,noFooter:v,description:p,image:g,keywords:k,permalink:E,wrapperClassName:O}=e,y=b?`${b} ${f} ${r}`:r,j=g||u,_=Object(i.a)(j,{absolute:!0}),w=Object(i.a)(a);return c.a.createElement(ce,null,c.a.createElement(l.a,null,c.a.createElement("html",{lang:"en"}),y&&c.a.createElement("title",null,y),y&&c.a.createElement("meta",{property:"og:title",content:y}),a&&c.a.createElement("link",{rel:"shortcut icon",href:w}),p&&c.a.createElement("meta",{name:"description",content:p}),p&&c.a.createElement("meta",{property:"og:description",content:p}),k&&k.length&&c.a.createElement("meta",{name:"keywords",content:k.join(",")}),j&&c.a.createElement("meta",{property:"og:image",content:_}),j&&c.a.createElement("meta",{property:"twitter:image",content:_}),j&&c.a.createElement("meta",{name:"twitter:image:alt",content:"Image for "+y}),E&&c.a.createElement("meta",{property:"og:url",content:m+E}),E&&c.a.createElement("link",{rel:"canonical",href:m+E}),c.a.createElement("meta",{name:"twitter:card",content:"summary_large_image"})),c.a.createElement(l.a,null,d.map((e,t)=>c.a.createElement("meta",Object(n.a)({key:"metadata_"+t},e)))),c.a.createElement(T,null),c.a.createElement(Z,null),c.a.createElement("div",{className:Object(o.a)("main-wrapper",O)},h),!v&&c.a.createElement(re,null))}},156:function(e,t,a){"use strict";var n=a(0),r=a(166);t.a=function(){const e=Object(n.useContext)(r.a);if(null==e)throw new Error("`useThemeContext` is used outside of `Layout` Component. See https://v2.docusaurus.io/docs/theme-classic#usethemecontext.");return e}},163:function(e,t,a){"use strict";var n,r=a(2),c=a(0),o=a.n(c),l=a(146),s=a(152),i=a(144);var u=function(){if(void 0!==n)return n;var e=!1,t={get passive(){e=!0}},a=function(){};return window.addEventListener("t",a,t),window.removeEventListener("t",a,t),n=e,e},d=c.useLayoutEffect,m=function(e){var t=Object(c.useRef)(e);return d((function(){t.current=e})),t},f="touchstart",h=["mousedown",f],b=function(e){if(e===f)return u()?{passive:!0}:void 0};var v=function(e,t){var a=m(t);Object(c.useEffect)((function(){if(t){var n=function(t){e.current&&a.current&&!e.current.contains(t.target)&&a.current(t)};return h.forEach((function(e){document.addEventListener(e,n,b(e))})),function(){h.forEach((function(e){document.removeEventListener(e,n,b(e))}))}}}),[!t])};function p({activeBasePath:e,activeBaseRegex:t,to:a,href:n,label:c,activeClassName:l="navbar__link--active",prependBaseUrlToHref:u,...d}){const m=Object(i.a)(a),f=Object(i.a)(e),h=Object(i.a)(n,{forcePrependBaseUrl:!0});return o.a.createElement(s.a,Object(r.a)({},n?{target:"_blank",rel:"noopener noreferrer",href:u?h:n}:{isNavLink:!0,activeClassName:l,to:m,...e||t?{isActive:(e,a)=>t?new RegExp(t).test(a.pathname):a.pathname.startsWith(f)}:null},d),c)}function g({items:e,position:t,className:a,...n}){const s=o.a.useRef(null),i=o.a.useRef(null),[u,d]=Object(c.useState)(!1);function m(e){if(e){var t,a;const e=null==i||null===(t=i.current)||void 0===t||null===(a=t.firstChild)||void 0===a?void 0:a.firstChild;e&&e.focus()}d(e)}v(s,()=>m(!1));const f=(e,t=!1)=>Object(l.a)({"navbar__item navbar__link":!t,dropdown__link:t},e);return e?o.a.createElement("div",{ref:s,className:Object(l.a)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--left":"left"===t,"dropdown--right":"right"===t,"dropdown--show":u})},o.a.createElement(p,Object(r.a)({className:f(a)},n,{onClick:n.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{("Enter"===e.key&&!n.to||"Tab"===e.key)&&(e.preventDefault(),m(!0))}}),n.label),o.a.createElement("ul",{ref:i,className:"dropdown__menu"},e.map(({className:t,...a},n)=>o.a.createElement("li",{key:n},o.a.createElement(p,Object(r.a)({onKeyDown:t=>{n===e.length-1&&"Tab"===t.key&&(t.preventDefault(),m(!1))},activeClassName:"dropdown__link--active",className:f(t,!0)},a)))))):o.a.createElement(p,Object(r.a)({className:f(a)},n))}function k({items:e,position:t,className:a,...n}){const c=(e,t=!1)=>Object(l.a)("menu__link",{"menu__link--sublist":t},e);return e?o.a.createElement("li",{className:"menu__list-item"},o.a.createElement(p,Object(r.a)({className:c(a,!0)},n),n.label),o.a.createElement("ul",{className:"menu__list"},e.map(({className:e,...t},a)=>o.a.createElement("li",{className:"menu__list-item",key:a},o.a.createElement(p,Object(r.a)({activeClassName:"menu__link--active",className:c(e)},t,{onClick:n.onClick})))))):o.a.createElement("li",{className:"menu__list-item"},o.a.createElement(p,Object(r.a)({className:c(a)},n)))}t.a=function({mobile:e=!1,...t}){const a=e?k:g;return o.a.createElement(a,t)}},166:function(e,t,a){"use strict";var n=a(0);const r=a.n(n).a.createContext(void 0);t.a=r},167:function(e,t,a){"use strict";var n=a(0),r=a(10);const c=()=>({scrollX:r.a.canUseDOM?window.pageXOffset:0,scrollY:r.a.canUseDOM?window.pageYOffset:0});t.a=(e,t=[])=>{const[a,r]=Object(n.useState)(c()),o=()=>{const t=c();r(t),e&&e(t)};return Object(n.useEffect)(()=>(window.addEventListener("scroll",o),()=>window.removeEventListener("scroll",o,{passive:!0})),t),a}},168:function(e,t,a){"use strict";var n=a(0);t.a=function(e=!0){Object(n.useEffect)(()=>(document.body.style.overflow=e?"hidden":"visible",()=>{document.body.style.overflow="visible"}),[e])}},169:function(e,t,a){"use strict";a.d(t,"b",(function(){return r}));var n=a(0);const r={desktop:"desktop",mobile:"mobile"};t.a=function(){const e="undefined"!=typeof window;function t(){if(e)return window.innerWidth>996?r.desktop:r.mobile}const[a,c]=Object(n.useState)(t);return Object(n.useEffect)(()=>{if(e)return window.addEventListener("resize",a),()=>window.removeEventListener("resize",a);function a(){c(t())}},[]),a}},170:function(e,t,a){"use strict";var n=a(143),r=a(156),c=a(144),o=a(145);t.a=()=>{const{siteConfig:{themeConfig:{navbar:{logo:e={}}={}}={}}={}}=Object(n.a)(),{isDarkTheme:t}=Object(r.a)(),a=Object(c.a)(e.href||"/");let l={};e.target?l={target:e.target}:Object(o.a)(a)||(l={rel:"noopener noreferrer",target:"_blank"});const s=e.srcDark&&t?e.srcDark:e.src;return{logoLink:a,logoLinkProps:l,logoImageUrl:Object(c.a)(s),logoAlt:e.alt}}},174:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;tthis.startX&&(this.setState({checked:!0}),this.startX=t,this.activated=ta?this.previouslyChecked!==this.state.checked&&(this.setState({checked:!1}),this.previouslyChecked=this.state.checked,t.click()):this.startX-4=0||Object.prototype.hasOwnProperty.call(e,n)&&(a[n]=e[n]);return a}(t,["className","icons"])),c=(0,l.default)("react-toggle",{"react-toggle--checked":this.state.checked,"react-toggle--focus":this.state.hasFocus,"react-toggle--disabled":this.props.disabled},a);return o.default.createElement("div",{className:c,onClick:this.handleClick,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd},o.default.createElement("div",{className:"react-toggle-track"},o.default.createElement("div",{className:"react-toggle-track-check"},this.getIcon("checked")),o.default.createElement("div",{className:"react-toggle-track-x"},this.getIcon("unchecked"))),o.default.createElement("div",{className:"react-toggle-thumb"}),o.default.createElement("input",n({},r,{ref:function(t){e.input=t},onFocus:this.handleFocus,onBlur:this.handleBlur,className:"react-toggle-screenreader-only",type:"checkbox"})))}}]),t}(c.PureComponent);t.default=f,f.displayName="Toggle",f.defaultProps={icons:{checked:o.default.createElement(i.default,null),unchecked:o.default.createElement(u.default,null)}},f.propTypes={checked:s.default.bool,disabled:s.default.bool,defaultChecked:s.default.bool,onChange:s.default.func,onFocus:s.default.func,onBlur:s.default.func,className:s.default.string,name:s.default.string,value:s.default.string,id:s.default.string,"aria-labelledby":s.default.string,"aria-label":s.default.string,icons:s.default.oneOfType([s.default.bool,s.default.shape({checked:s.default.node,unchecked:s.default.node})])}},175:function(e,t,a){var n;!function(){"use strict";var a={}.hasOwnProperty;function r(){for(var e=[],t=0;t0){var a=t[0];return{x:a.clientX,y:a.clientY}}var n=e.pageX;if(void 0!==n)return{x:n,y:e.pageY}}return{x:0,y:0}}},179:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return s}));var n=a(2),r=a(0),c=a.n(r),o=a(163),l=a(158);function s({label:e,to:t,docsPluginId:a,...r}){const s=Object(l.useActiveVersion)(a),i=Object(l.useLatestVersion)(a),u=null!=s?s:i,d=null!=e?e:u.label,m=null!=t?t:(e=>e.docs.find(t=>t.id===e.mainDocId))(u).path;return c.a.createElement(o.a,Object(n.a)({},r,{label:d,to:m}))}},183:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return i}));var n=a(2),r=a(0),c=a.n(r),o=a(163),l=a(158);const s=e=>e.docs.find(t=>t.id===e.mainDocId);function i({mobile:e,docsPluginId:t,...a}){var r;const i=Object(l.useActiveDocContext)(t),u=Object(l.useVersions)(t),d=Object(l.useLatestVersion)(t);const m=null!==(r=i.activeVersion)&&void 0!==r?r:d,f=e?"Versions":m.label,h=e?void 0:s(m).path;return c.a.createElement(o.a,Object(n.a)({},a,{mobile:e,label:f,to:h,items:function(){if(!(u.length<=1))return u.map(e=>{const t=(null==i?void 0:i.alternateDocVersions[e.name])||s(e);return{isNavLink:!0,label:e.label,to:t.path,isActive:()=>e===(null==i?void 0:i.activeVersion)}})}()}))}}}]); \ No newline at end of file diff --git a/docs/2.da27712d.js.LICENSE.txt b/docs/2.b29b510d.js.LICENSE.txt similarity index 100% rename from docs/2.da27712d.js.LICENSE.txt rename to docs/2.b29b510d.js.LICENSE.txt diff --git a/docs/2.da27712d.js b/docs/2.da27712d.js deleted file mode 100644 index a6aa8087dec..00000000000 --- a/docs/2.da27712d.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see 2.da27712d.js.LICENSE.txt */ -(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{147:function(e,t,a){"use strict";var n=a(0),r=Object(n.createContext)(void 0);t.a=r},148:function(e,t,a){"use strict";var n=a(0),r=a(147);t.a=function(){var e=Object(n.useContext)(r.a);if(null==e)throw new Error("`useUserPreferencesContext` is used outside of `Layout` Component.");return e}},152:function(e,t,a){"use strict";t.a=function(){return null}},153:function(e,t,a){"use strict";var n=a(2),r=a(0),c=a.n(r),o=a(146),i=a(155),l=a(143),s=a(144),u=a(10),d="light",f="dark",m=function(e){return e===f?f:d},h=function(){return u.a.canUseDOM?m(document.documentElement.getAttribute("data-theme")):d},v=function(e){try{localStorage.setItem("theme",m(e))}catch(t){console.error(t)}},b=function(){var e=Object(l.a)().siteConfig,t=(e=void 0===e?{}:e).themeConfig,a=(t=void 0===t?{}:t).colorMode,n=(a=void 0===a?{}:a).disableSwitch,c=void 0!==n&&n,o=Object(r.useState)(h),i=o[0],s=o[1],u=Object(r.useCallback)((function(){s(d),v(d)}),[]),b=Object(r.useCallback)((function(){s(f),v(f)}),[]);return Object(r.useEffect)((function(){document.documentElement.setAttribute("data-theme",m(i))}),[i]),Object(r.useEffect)((function(){if(!c)try{var e=localStorage.getItem("theme");null!==e&&s(m(e))}catch(t){console.error(t)}}),[s]),Object(r.useEffect)((function(){c||window.matchMedia("(prefers-color-scheme: dark)").addListener((function(e){var t=e.matches;s(t?f:d)}))}),[]),{isDarkTheme:i===f,setLightTheme:u,setDarkTheme:b}},p=a(164);var g=function(e){var t=b(),a=t.isDarkTheme,n=t.setLightTheme,r=t.setDarkTheme;return c.a.createElement(p.a.Provider,{value:{isDarkTheme:a,setLightTheme:n,setDarkTheme:r}},e.children)},k="docusaurus.tab.",E=function(){var e=Object(r.useState)({}),t=e[0],a=e[1],n=Object(r.useCallback)((function(e,t){try{localStorage.setItem("docusaurus.tab."+e,t)}catch(a){console.error(a)}}),[]);return Object(r.useEffect)((function(){try{for(var e={},t=0;t=s?n(!1):a+c0&&c.a.createElement("div",{className:"row footer__links"},u.map((function(e,t){return c.a.createElement("div",{key:t,className:"col footer__col"},null!=e.title?c.a.createElement("h4",{className:"footer__title"},e.title):null,null!=e.items&&Array.isArray(e.items)&&e.items.length>0?c.a.createElement("ul",{className:"footer__items"},e.items.map((function(e,t){return e.html?c.a.createElement("li",{key:t,className:"footer__item",dangerouslySetInnerHTML:{__html:e.html}}):c.a.createElement("li",{key:e.href||e.to,className:"footer__item"},c.a.createElement(ne,e))}))):null)}))),(f||r)&&c.a.createElement("div",{className:"text--center"},f&&f.src&&c.a.createElement("div",{className:"margin-bottom--sm"},f.href?c.a.createElement("a",{href:f.href,target:"_blank",rel:"noopener noreferrer",className:ae.a.footerLogoLink},c.a.createElement(re,{alt:f.alt,url:m})):c.a.createElement(re,{alt:f.alt,url:m})),c.a.createElement("div",{dangerouslySetInnerHTML:{__html:r}})))):null};a(54);function oe(e){var t=e.children;return c.a.createElement(g,null,c.a.createElement(w,null,t))}t.a=function(e){var t=Object(l.a)().siteConfig,a=t.favicon,r=t.title,u=t.themeConfig,d=u.image,f=u.metadatas,m=t.url,h=t.titleDelimiter,v=e.children,b=e.title,p=e.noFooter,g=e.description,k=e.image,E=e.keywords,O=e.permalink,j=e.wrapperClassName,y=b?b+" "+h+" "+r:r,_=k||d,w=Object(s.a)(_,{absolute:!0}),C=Object(s.a)(a);return c.a.createElement(oe,null,c.a.createElement(i.a,null,c.a.createElement("html",{lang:"en"}),y&&c.a.createElement("title",null,y),y&&c.a.createElement("meta",{property:"og:title",content:y}),a&&c.a.createElement("link",{rel:"shortcut icon",href:C}),g&&c.a.createElement("meta",{name:"description",content:g}),g&&c.a.createElement("meta",{property:"og:description",content:g}),E&&E.length&&c.a.createElement("meta",{name:"keywords",content:E.join(",")}),_&&c.a.createElement("meta",{property:"og:image",content:w}),_&&c.a.createElement("meta",{property:"twitter:image",content:w}),_&&c.a.createElement("meta",{name:"twitter:image:alt",content:"Image for "+y}),O&&c.a.createElement("meta",{property:"og:url",content:m+O}),O&&c.a.createElement("link",{rel:"canonical",href:m+O}),c.a.createElement("meta",{name:"twitter:card",content:"summary_large_image"})),c.a.createElement(i.a,null,f.map((function(e,t){return c.a.createElement("meta",Object(n.a)({key:"metadata_"+t},e))}))),c.a.createElement(T,null),c.a.createElement(ee,null),c.a.createElement("div",{className:Object(o.a)("main-wrapper",j)},v),!p&&c.a.createElement(ce,null))}},160:function(e,t,a){"use strict";var n=a(0),r=a(164);t.a=function(){var e=Object(n.useContext)(r.a);if(null==e)throw new Error("`useThemeContext` is used outside of `Layout` Component. See https://v2.docusaurus.io/docs/theme-classic#usethemecontext.");return e}},161:function(e,t,a){"use strict";var n,r=a(2),c=a(6),o=a(0),i=a.n(o),l=a(146),s=a(151),u=a(144);var d=function(){if(void 0!==n)return n;var e=!1,t={get passive(){e=!0}},a=function(){};return window.addEventListener("t",a,t),window.removeEventListener("t",a,t),n=e,e},f=o.useLayoutEffect,m=function(e){var t=Object(o.useRef)(e);return f((function(){t.current=e})),t},h="touchstart",v=["mousedown",h],b=function(e){if(e===h)return d()?{passive:!0}:void 0};var p=function(e,t){var a=m(t);Object(o.useEffect)((function(){if(t){var n=function(t){e.current&&a.current&&!e.current.contains(t.target)&&a.current(t)};return v.forEach((function(e){document.addEventListener(e,n,b(e))})),function(){v.forEach((function(e){document.removeEventListener(e,n,b(e))}))}}}),[!t])};function g(e){var t=e.activeBasePath,a=e.activeBaseRegex,n=e.to,o=e.href,l=e.label,d=e.activeClassName,f=void 0===d?"navbar__link--active":d,m=e.prependBaseUrlToHref,h=Object(c.a)(e,["activeBasePath","activeBaseRegex","to","href","label","activeClassName","prependBaseUrlToHref"]),v=Object(u.a)(n),b=Object(u.a)(t),p=Object(u.a)(o,{forcePrependBaseUrl:!0});return i.a.createElement(s.a,Object(r.a)({},o?{target:"_blank",rel:"noopener noreferrer",href:m?p:o}:Object.assign({isNavLink:!0,activeClassName:f,to:v},t||a?{isActive:function(e,t){return a?new RegExp(a).test(t.pathname):t.pathname.startsWith(b)}}:null),h),l)}function k(e){var t=e.items,a=e.position,n=e.className,s=Object(c.a)(e,["items","position","className"]),u=i.a.useRef(null),d=i.a.useRef(null),f=Object(o.useState)(!1),m=f[0],h=f[1];function v(e){if(e){var t,a,n=null==d||null===(t=d.current)||void 0===t||null===(a=t.firstChild)||void 0===a?void 0:a.firstChild;n&&n.focus()}h(e)}p(u,(function(){return v(!1)}));var b=function(e,t){return void 0===t&&(t=!1),Object(l.a)({"navbar__item navbar__link":!t,dropdown__link:t},e)};return t?i.a.createElement("div",{ref:u,className:Object(l.a)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--left":"left"===a,"dropdown--right":"right"===a,"dropdown--show":m})},i.a.createElement(g,Object(r.a)({className:b(n)},s,{onClick:s.to?void 0:function(e){return e.preventDefault()},onKeyDown:function(e){("Enter"===e.key&&!s.to||"Tab"===e.key)&&(e.preventDefault(),v(!0))}}),s.label),i.a.createElement("ul",{ref:d,className:"dropdown__menu"},t.map((function(e,a){var n=e.className,o=Object(c.a)(e,["className"]);return i.a.createElement("li",{key:a},i.a.createElement(g,Object(r.a)({onKeyDown:function(e){a===t.length-1&&"Tab"===e.key&&(e.preventDefault(),v(!1))},activeClassName:"dropdown__link--active",className:b(n,!0)},o)))})))):i.a.createElement(g,Object(r.a)({className:b(n)},s))}function E(e){var t=e.items,a=(e.position,e.className),n=Object(c.a)(e,["items","position","className"]),o=function(e,t){return void 0===t&&(t=!1),Object(l.a)("menu__link",{"menu__link--sublist":t},e)};return t?i.a.createElement("li",{className:"menu__list-item"},i.a.createElement(g,Object(r.a)({className:o(a,!0)},n),n.label),i.a.createElement("ul",{className:"menu__list"},t.map((function(e,t){var a=e.className,l=Object(c.a)(e,["className"]);return i.a.createElement("li",{className:"menu__list-item",key:t},i.a.createElement(g,Object(r.a)({activeClassName:"menu__link--active",className:o(a)},l,{onClick:n.onClick})))})))):i.a.createElement("li",{className:"menu__list-item"},i.a.createElement(g,Object(r.a)({className:o(a)},n)))}t.a=function(e){var t=e.mobile,a=void 0!==t&&t,n=Object(c.a)(e,["mobile"]),r=a?E:k;return i.a.createElement(r,n)}},164:function(e,t,a){"use strict";var n=a(0),r=a.n(n).a.createContext(void 0);t.a=r},165:function(e,t,a){"use strict";var n=a(0),r=a(10),c=function(){return{scrollX:r.a.canUseDOM?window.pageXOffset:0,scrollY:r.a.canUseDOM?window.pageYOffset:0}};t.a=function(e,t){void 0===t&&(t=[]);var a=Object(n.useState)(c()),r=a[0],o=a[1],i=function(){var t=c();o(t),e&&e(t)};return Object(n.useEffect)((function(){return window.addEventListener("scroll",i),function(){return window.removeEventListener("scroll",i,{passive:!0})}}),t),r}},166:function(e,t,a){"use strict";var n=a(0);t.a=function(e){void 0===e&&(e=!0),Object(n.useEffect)((function(){return document.body.style.overflow=e?"hidden":"visible",function(){document.body.style.overflow="visible"}}),[e])}},167:function(e,t,a){"use strict";a.d(t,"b",(function(){return r}));var n=a(0),r={desktop:"desktop",mobile:"mobile"};t.a=function(){var e="undefined"!=typeof window;function t(){if(e)return window.innerWidth>996?r.desktop:r.mobile}var a=Object(n.useState)(t),c=a[0],o=a[1];return Object(n.useEffect)((function(){if(e)return window.addEventListener("resize",a),function(){return window.removeEventListener("resize",a)};function a(){o(t())}}),[]),c}},168:function(e,t,a){"use strict";var n=a(143),r=a(160),c=a(144),o=a(145);t.a=function(){var e=Object(n.a)().siteConfig,t=(e=void 0===e?{}:e).themeConfig,a=(t=void 0===t?{}:t).navbar,i=(a=void 0===a?{}:a).logo,l=void 0===i?{}:i,s=Object(r.a)().isDarkTheme,u=Object(c.a)(l.href||"/"),d={};l.target?d={target:l.target}:Object(o.a)(u)||(d={rel:"noopener noreferrer",target:"_blank"});var f=l.srcDark&&s?l.srcDark:l.src;return{logoLink:u,logoLinkProps:d,logoImageUrl:Object(c.a)(f),logoAlt:l.alt}}},172:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;tthis.startX&&(this.setState({checked:!0}),this.startX=t,this.activated=ta?this.previouslyChecked!==this.state.checked&&(this.setState({checked:!1}),this.previouslyChecked=this.state.checked,t.click()):this.startX-4=0||Object.prototype.hasOwnProperty.call(e,n)&&(a[n]=e[n]);return a}(t,["className","icons"])),c=(0,i.default)("react-toggle",{"react-toggle--checked":this.state.checked,"react-toggle--focus":this.state.hasFocus,"react-toggle--disabled":this.props.disabled},a);return o.default.createElement("div",{className:c,onClick:this.handleClick,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd},o.default.createElement("div",{className:"react-toggle-track"},o.default.createElement("div",{className:"react-toggle-track-check"},this.getIcon("checked")),o.default.createElement("div",{className:"react-toggle-track-x"},this.getIcon("unchecked"))),o.default.createElement("div",{className:"react-toggle-thumb"}),o.default.createElement("input",n({},r,{ref:function(t){e.input=t},onFocus:this.handleFocus,onBlur:this.handleBlur,className:"react-toggle-screenreader-only",type:"checkbox"})))}}]),t}(c.PureComponent);t.default=m,m.displayName="Toggle",m.defaultProps={icons:{checked:o.default.createElement(s.default,null),unchecked:o.default.createElement(u.default,null)}},m.propTypes={checked:l.default.bool,disabled:l.default.bool,defaultChecked:l.default.bool,onChange:l.default.func,onFocus:l.default.func,onBlur:l.default.func,className:l.default.string,name:l.default.string,value:l.default.string,id:l.default.string,"aria-labelledby":l.default.string,"aria-label":l.default.string,icons:l.default.oneOfType([l.default.bool,l.default.shape({checked:l.default.node,unchecked:l.default.node})])}},173:function(e,t,a){var n;!function(){"use strict";var a={}.hasOwnProperty;function r(){for(var e=[],t=0;t0){var a=t[0];return{x:a.clientX,y:a.clientY}}var n=e.pageX;if(void 0!==n)return{x:n,y:e.pageY}}return{x:0,y:0}}},177:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return s}));var n=a(2),r=a(6),c=a(0),o=a.n(c),i=a(161),l=a(158);function s(e){var t=e.label,a=e.to,c=e.docsPluginId,s=Object(r.a)(e,["label","to","docsPluginId"]),u=Object(l.useActiveVersion)(c),d=Object(l.useLatestVersion)(c),f=null!=u?u:d,m=null!=t?t:f.label,h=null!=a?a:function(e){return e.docs.find((function(t){return t.id===e.mainDocId}))}(f).path;return o.a.createElement(i.a,Object(n.a)({},s,{label:m,to:h}))}},181:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return u}));var n=a(2),r=a(6),c=a(0),o=a.n(c),i=a(161),l=a(158),s=function(e){return e.docs.find((function(t){return t.id===e.mainDocId}))};function u(e){var t,a=e.mobile,c=e.docsPluginId,u=Object(r.a)(e,["mobile","docsPluginId"]),d=Object(l.useActiveDocContext)(c),f=Object(l.useVersions)(c),m=Object(l.useLatestVersion)(c);var h=null!==(t=d.activeVersion)&&void 0!==t?t:m,v=a?"Versions":h.label,b=a?void 0:s(h).path;return o.a.createElement(i.a,Object(n.a)({},u,{mobile:a,label:v,to:b,items:function(){if(!(f.length<=1))return f.map((function(e){var t=(null==d?void 0:d.alternateDocVersions[e.name])||s(e);return{isNavLink:!0,label:e.label,to:t.path,isActive:function(){return e===(null==d?void 0:d.activeVersion)}}}))}()}))}}}]); \ No newline at end of file diff --git a/docs/24dcd402.dad85cd2.js b/docs/24dcd402.2112381e.js similarity index 98% rename from docs/24dcd402.dad85cd2.js rename to docs/24dcd402.2112381e.js index 2a62545a233..243f282769f 100644 --- a/docs/24dcd402.dad85cd2.js +++ b/docs/24dcd402.2112381e.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[15],{142:function(e,r,n){"use strict";n.d(r,"a",(function(){return s})),n.d(r,"b",(function(){return m}));var t=n(0),o=n.n(t);function a(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function c(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function i(e){for(var r=1;r=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=o.a.createContext({}),p=function(e){var r=o.a.useContext(u),n=r;return e&&(n="function"==typeof e?e(r):i(i({},r),e)),n},s=function(e){var r=p(e.components);return o.a.createElement(u.Provider,{value:r},e.children)},f={inlineCode:"code",wrapper:function(e){var r=e.children;return o.a.createElement(o.a.Fragment,{},r)}},d=o.a.forwardRef((function(e,r){var n=e.components,t=e.mdxType,a=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),s=p(n),d=t,m=s["".concat(c,".").concat(d)]||s[d]||f[d]||a;return n?o.a.createElement(m,i(i({ref:r},u),{},{components:n})):o.a.createElement(m,i({ref:r},u))}));function m(e,r){var n=arguments,t=r&&r.mdxType;if("string"==typeof e||t){var a=n.length,c=new Array(a);c[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:t,c[1]=i;for(var u=2;u=0||(o[n]=e[n]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var u=o.a.createContext({}),p=function(e){var r=o.a.useContext(u),n=r;return e&&(n="function"==typeof e?e(r):i(i({},r),e)),n},s=function(e){var r=p(e.components);return o.a.createElement(u.Provider,{value:r},e.children)},f={inlineCode:"code",wrapper:function(e){var r=e.children;return o.a.createElement(o.a.Fragment,{},r)}},d=o.a.forwardRef((function(e,r){var n=e.components,t=e.mdxType,a=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),s=p(n),d=t,m=s["".concat(c,".").concat(d)]||s[d]||f[d]||a;return n?o.a.createElement(m,i(i({ref:r},u),{},{components:n})):o.a.createElement(m,i({ref:r},u))}));function m(e,r){var n=arguments,t=r&&r.mdxType;if("string"==typeof e||t){var a=n.length,c=new Array(a);c[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:t,c[1]=i;for(var u=2;u=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var u=o.a.createContext({}),l=function(e){var r=o.a.useContext(u),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},s=function(e){var r=l(e.components);return o.a.createElement(u.Provider,{value:r},e.children)},f={inlineCode:"code",wrapper:function(e){var r=e.children;return o.a.createElement(o.a.Fragment,{},r)}},d=o.a.forwardRef((function(e,r){var t=e.components,n=e.mdxType,c=e.originalType,a=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),s=l(t),d=n,m=s["".concat(a,".").concat(d)]||s[d]||f[d]||c;return t?o.a.createElement(m,i(i({ref:r},u),{},{components:t})):o.a.createElement(m,i({ref:r},u))}));function m(e,r){var t=arguments,n=r&&r.mdxType;if("string"==typeof e||n){var c=t.length,a=new Array(c);a[0]=d;var i={};for(var p in r)hasOwnProperty.call(r,p)&&(i[p]=r[p]);i.originalType=e,i.mdxType="string"==typeof e?e:n,a[1]=i;for(var u=2;u=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var u=o.a.createContext({}),l=function(e){var r=o.a.useContext(u),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},s=function(e){var r=l(e.components);return o.a.createElement(u.Provider,{value:r},e.children)},f={inlineCode:"code",wrapper:function(e){var r=e.children;return o.a.createElement(o.a.Fragment,{},r)}},d=o.a.forwardRef((function(e,r){var t=e.components,n=e.mdxType,c=e.originalType,a=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),s=l(t),d=n,m=s["".concat(a,".").concat(d)]||s[d]||f[d]||c;return t?o.a.createElement(m,i(i({ref:r},u),{},{components:t})):o.a.createElement(m,i({ref:r},u))}));function m(e,r){var t=arguments,n=r&&r.mdxType;if("string"==typeof e||n){var c=t.length,a=new Array(c);a[0]=d;var i={};for(var p in r)hasOwnProperty.call(r,p)&&(i[p]=r[p]);i.originalType=e,i.mdxType="string"==typeof e?e:n,a[1]=i;for(var u=2;u=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var b=r.a.createContext({}),d=function(e){var n=r.a.useContext(b),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},l=function(e){var n=d(e.components);return r.a.createElement(b.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},m=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,b=s(e,["components","mdxType","originalType","parentName"]),l=d(t),m=a,u=l["".concat(i,".").concat(m)]||l[m]||p[m]||c;return t?r.a.createElement(u,o(o({ref:n},b),{},{components:t})):r.a.createElement(u,o({ref:n},b))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var c=t.length,i=new Array(c);i[0]=m;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var b=2;b")," \u4f9d\u8d56\u63a5\u53e3\u53ef\u4ee5\u5feb\u901f\u7684\u6784\u5efa\u79cd\u5b50\u6570\u636e\uff0c\u652f\u6301\u4efb\u4f55\u65e0\u53c2\u6784\u9020\u51fd\u6570\u5bf9\u8c61\u7c7b\u4e2d\u4f7f\u7528\u3002\u5982\u6211\u4eec\u9700\u8981\u4e3a ",Object(c.b)("inlineCode",{parentName:"p"},"Person")," \u8868\u63d2\u5165\u521d\u59cb\u5316\u6570\u636e\uff1a"),Object(c.b)("h3",{id:"92121-\u5728\u5b9e\u4f53\u5b9a\u4e49\u4e2d\u4f7f\u7528"},"9.21.2.1 \u5728\u5b9e\u4f53\u5b9a\u4e49\u4e2d\u4f7f\u7528"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,16-23}","{7,16-23}":!0}),'using Fur.DatabaseAccessor;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.Core\n{\n public class Person : EntityBase, IEntitySeedData\n {\n public string Name { get; set; }\n\n public int Age { get; set; }\n\n public string Address { get; set; }\n\n // \u914d\u7f6e\u79cd\u5b50\u6570\u636e\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Person { Id = 1, Name = "\u767e\u5c0f\u50e7", Address = "\u5e7f\u4e1c\u7701\u4e2d\u5c71\u5e02" },\n new Person { Id = 2, Name = "\u65b0\u751f\u5e1d", Address = "\u5e7f\u4e1c\u7701\u73e0\u6d77\u5e02" }\n };\n }\n }\n}\n')),Object(c.b)("div",{className:"admonition admonition-important alert alert--info"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},Object(c.b)("inlineCode",{parentName:"p"},"\u4e3b\u952e")," \u503c\u5fc5\u987b\u624b\u52a8\u63d2\u5165\uff0c\u56e0\u4e3a\u4f1a\u81ea\u52a8\u5173\u95ed\u4e3b\u952e\u6216\u81ea\u589e\u6807\u8bc6\u68c0\u67e5\u3002"))),Object(c.b)("h3",{id:"92122-\u5728\u4efb\u610f\u5bf9\u8c61\u7c7b\u4e2d\u4f7f\u7528"},"9.21.2.2 \u5728\u4efb\u610f\u5bf9\u8c61\u7c7b\u4e2d\u4f7f\u7528"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6,9-16}","{6,9-16}":!0}),'using Fur.DatabaseAccessor;\nusing System.Collections.Generic;\n\nnamespace Fur.Application\n{\n public class PersonSeedData : IEntitySeedData\n {\n // \u914d\u7f6e\u79cd\u5b50\u6570\u636e\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Person { Id = 1, Name = "\u767e\u5c0f\u50e7", Address = "\u5e7f\u4e1c\u7701\u4e2d\u5c71\u5e02" },\n new Person { Id = 2, Name = "\u65b0\u751f\u5e1d", Address = "\u5e7f\u4e1c\u7701\u73e0\u6d77\u5e02" }\n };\n }\n }\n}\n')),Object(c.b)("h2",{id:"9213-\u5bfc\u822a\u5c5e\u6027"},"9.21.3 \u5bfc\u822a\u5c5e\u6027"),Object(c.b)("p",null,"\u901a\u5e38\u6211\u4eec\u7684\u5b9e\u4f53\u6709 ",Object(c.b)("inlineCode",{parentName:"p"},"\u4e00\u5bf9\u591a"),"\uff0c",Object(c.b)("inlineCode",{parentName:"p"},"\u591a\u5bf9\u591a"),"\u7b49\u5916\u952e\u5173\u7cfb\uff0c\u90a3\u4e48",Object(c.b)("strong",{parentName:"p"},"\u6211\u4eec\u9700\u8981\u5355\u72ec\u4e3a\u6bcf\u4e00\u4e2a\u5b9e\u4f53\u6dfb\u52a0\u6570\u636e\u79cd\u5b50\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u5199\u5728\u4e3b\u8868\u4e2d\u3002")),Object(c.b)("h2",{id:"9214-\u591a\u4e2a\u6570\u636e\u5e93\u79cd\u5b50\u6570\u636e"},"9.21.4 \u591a\u4e2a\u6570\u636e\u5e93\u79cd\u5b50\u6570\u636e"),Object(c.b)("p",null,Object(c.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u6cdb\u578b\u7684\u65b9\u5f0f\u652f\u6301\u591a\u4e2a\u6570\u636e\u5e93\u79cd\u5b50\u6570\u636e\u8bbe\u5b9a\uff0c\u5982\uff1a"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6,9-16}","{6,9-16}":!0}),'using Fur.DatabaseAccessor;\nusing System.Collections.Generic;\n\nnamespace Fur.Application\n{\n public class PersonSeedData : IEntitySeedData\n {\n // \u914d\u7f6e\u79cd\u5b50\u6570\u636e\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Person { Id = 1, Name = "\u767e\u5c0f\u50e7", Address = "\u5e7f\u4e1c\u7701\u4e2d\u5c71\u5e02" },\n new Person { Id = 2, Name = "\u65b0\u751f\u5e1d", Address = "\u5e7f\u4e1c\u7701\u73e0\u6d77\u5e02" }\n };\n }\n }\n}\n')),Object(c.b)("p",null,"\u4e0a\u9762\u7684\u4f8b\u5b50\u8868\u793a\u540c\u65f6\u4e3a ",Object(c.b)("inlineCode",{parentName:"p"},"MySqlDbContext")," \u548c ",Object(c.b)("inlineCode",{parentName:"p"},"SqliteDbContext")," \u521b\u5efa\u79cd\u5b50\u6570\u636e\u3002"),Object(c.b)("h2",{id:"9215-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.21.5 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(c.b)("hr",null),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(c.b)("inlineCode",{parentName:"p"},"\u6570\u636e\u79cd\u5b50")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/ef/core/modeling/data-seeding"}),"EF Core - \u6570\u636e\u79cd\u5b50\u8bbe\u5b9a")," \u7ae0\u8282\u3002"))))}d.isMDXComponent=!0}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return l})),t.d(n,"b",(function(){return u}));var a=t(0),r=t.n(a);function c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var b=r.a.createContext({}),d=function(e){var n=r.a.useContext(b),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},l=function(e){var n=d(e.components);return r.a.createElement(b.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},m=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,b=s(e,["components","mdxType","originalType","parentName"]),l=d(t),m=a,u=l["".concat(i,".").concat(m)]||l[m]||p[m]||c;return t?r.a.createElement(u,o(o({ref:n},b),{},{components:t})):r.a.createElement(u,o({ref:n},b))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var c=t.length,i=new Array(c);i[0]=m;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var b=2;b")," \u4f9d\u8d56\u63a5\u53e3\u53ef\u4ee5\u5feb\u901f\u7684\u6784\u5efa\u79cd\u5b50\u6570\u636e\uff0c\u652f\u6301\u4efb\u4f55\u65e0\u53c2\u6784\u9020\u51fd\u6570\u5bf9\u8c61\u7c7b\u4e2d\u4f7f\u7528\u3002\u5982\u6211\u4eec\u9700\u8981\u4e3a ",Object(c.b)("inlineCode",{parentName:"p"},"Person")," \u8868\u63d2\u5165\u521d\u59cb\u5316\u6570\u636e\uff1a"),Object(c.b)("h3",{id:"92121-\u5728\u5b9e\u4f53\u5b9a\u4e49\u4e2d\u4f7f\u7528"},"9.21.2.1 \u5728\u5b9e\u4f53\u5b9a\u4e49\u4e2d\u4f7f\u7528"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,16-23}","{7,16-23}":!0}),'using Fur.DatabaseAccessor;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.Core\n{\n public class Person : EntityBase, IEntitySeedData\n {\n public string Name { get; set; }\n\n public int Age { get; set; }\n\n public string Address { get; set; }\n\n // \u914d\u7f6e\u79cd\u5b50\u6570\u636e\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Person { Id = 1, Name = "\u767e\u5c0f\u50e7", Address = "\u5e7f\u4e1c\u7701\u4e2d\u5c71\u5e02" },\n new Person { Id = 2, Name = "\u65b0\u751f\u5e1d", Address = "\u5e7f\u4e1c\u7701\u73e0\u6d77\u5e02" }\n };\n }\n }\n}\n')),Object(c.b)("div",{className:"admonition admonition-important alert alert--info"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},Object(c.b)("inlineCode",{parentName:"p"},"\u4e3b\u952e")," \u503c\u5fc5\u987b\u624b\u52a8\u63d2\u5165\uff0c\u56e0\u4e3a\u4f1a\u81ea\u52a8\u5173\u95ed\u4e3b\u952e\u6216\u81ea\u589e\u6807\u8bc6\u68c0\u67e5\u3002"))),Object(c.b)("h3",{id:"92122-\u5728\u4efb\u610f\u5bf9\u8c61\u7c7b\u4e2d\u4f7f\u7528"},"9.21.2.2 \u5728\u4efb\u610f\u5bf9\u8c61\u7c7b\u4e2d\u4f7f\u7528"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6,9-16}","{6,9-16}":!0}),'using Fur.DatabaseAccessor;\nusing System.Collections.Generic;\n\nnamespace Fur.Application\n{\n public class PersonSeedData : IEntitySeedData\n {\n // \u914d\u7f6e\u79cd\u5b50\u6570\u636e\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Person { Id = 1, Name = "\u767e\u5c0f\u50e7", Address = "\u5e7f\u4e1c\u7701\u4e2d\u5c71\u5e02" },\n new Person { Id = 2, Name = "\u65b0\u751f\u5e1d", Address = "\u5e7f\u4e1c\u7701\u73e0\u6d77\u5e02" }\n };\n }\n }\n}\n')),Object(c.b)("h2",{id:"9213-\u5bfc\u822a\u5c5e\u6027"},"9.21.3 \u5bfc\u822a\u5c5e\u6027"),Object(c.b)("p",null,"\u901a\u5e38\u6211\u4eec\u7684\u5b9e\u4f53\u6709 ",Object(c.b)("inlineCode",{parentName:"p"},"\u4e00\u5bf9\u591a"),"\uff0c",Object(c.b)("inlineCode",{parentName:"p"},"\u591a\u5bf9\u591a"),"\u7b49\u5916\u952e\u5173\u7cfb\uff0c\u90a3\u4e48",Object(c.b)("strong",{parentName:"p"},"\u6211\u4eec\u9700\u8981\u5355\u72ec\u4e3a\u6bcf\u4e00\u4e2a\u5b9e\u4f53\u6dfb\u52a0\u6570\u636e\u79cd\u5b50\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u5199\u5728\u4e3b\u8868\u4e2d\u3002")),Object(c.b)("h2",{id:"9214-\u591a\u4e2a\u6570\u636e\u5e93\u79cd\u5b50\u6570\u636e"},"9.21.4 \u591a\u4e2a\u6570\u636e\u5e93\u79cd\u5b50\u6570\u636e"),Object(c.b)("p",null,Object(c.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u6cdb\u578b\u7684\u65b9\u5f0f\u652f\u6301\u591a\u4e2a\u6570\u636e\u5e93\u79cd\u5b50\u6570\u636e\u8bbe\u5b9a\uff0c\u5982\uff1a"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6,9-16}","{6,9-16}":!0}),'using Fur.DatabaseAccessor;\nusing System.Collections.Generic;\n\nnamespace Fur.Application\n{\n public class PersonSeedData : IEntitySeedData\n {\n // \u914d\u7f6e\u79cd\u5b50\u6570\u636e\n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new Person { Id = 1, Name = "\u767e\u5c0f\u50e7", Address = "\u5e7f\u4e1c\u7701\u4e2d\u5c71\u5e02" },\n new Person { Id = 2, Name = "\u65b0\u751f\u5e1d", Address = "\u5e7f\u4e1c\u7701\u73e0\u6d77\u5e02" }\n };\n }\n }\n}\n')),Object(c.b)("p",null,"\u4e0a\u9762\u7684\u4f8b\u5b50\u8868\u793a\u540c\u65f6\u4e3a ",Object(c.b)("inlineCode",{parentName:"p"},"MySqlDbContext")," \u548c ",Object(c.b)("inlineCode",{parentName:"p"},"SqliteDbContext")," \u521b\u5efa\u79cd\u5b50\u6570\u636e\u3002"),Object(c.b)("h2",{id:"9215-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.21.5 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(c.b)("hr",null),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(c.b)("inlineCode",{parentName:"p"},"\u6570\u636e\u79cd\u5b50")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/ef/core/modeling/data-seeding"}),"EF Core - \u6570\u636e\u79cd\u5b50\u8bbe\u5b9a")," \u7ae0\u8282\u3002"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/2ae73ff4.b4cb8011.js b/docs/2ae73ff4.439f6355.js similarity index 98% rename from docs/2ae73ff4.b4cb8011.js rename to docs/2ae73ff4.439f6355.js index d670a952889..01dfd523e07 100644 --- a/docs/2ae73ff4.b4cb8011.js +++ b/docs/2ae73ff4.439f6355.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[18],{142:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return m}));var n=r(0),o=r.n(n);function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=o.a.createContext({}),l=function(e){var t=o.a.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=l(e.components);return o.a.createElement(p.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},d=o.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,c=e.originalType,a=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=l(r),d=n,m=s["".concat(a,".").concat(d)]||s[d]||f[d]||c;return r?o.a.createElement(m,i(i({ref:t},p),{},{components:r})):o.a.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var c=r.length,a=new Array(c);a[0]=d;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i.mdxType="string"==typeof e?e:n,a[1]=i;for(var p=2;p=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=o.a.createContext({}),l=function(e){var t=o.a.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=l(e.components);return o.a.createElement(p.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},d=o.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,c=e.originalType,a=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=l(r),d=n,m=s["".concat(a,".").concat(d)]||s[d]||f[d]||c;return r?o.a.createElement(m,i(i({ref:t},p),{},{components:r})):o.a.createElement(m,i({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var c=r.length,a=new Array(c);a[0]=d;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i.mdxType="string"==typeof e?e:n,a[1]=i;for(var p=2;p=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=o.a.createContext({}),p=function(e){var t=o.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return o.a.createElement(l.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},b=o.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,c=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),s=p(n),b=r,d=s["".concat(c,".").concat(b)]||s[b]||f[b]||a;return n?o.a.createElement(d,i(i({ref:t},l),{},{components:n})):o.a.createElement(d,i({ref:t},l))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,c=new Array(a);c[0]=b;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i.mdxType="string"==typeof e?e:r,c[1]=i;for(var l=2;l=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=o.a.createContext({}),p=function(e){var t=o.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return o.a.createElement(l.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},b=o.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,c=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),s=p(n),b=r,d=s["".concat(c,".").concat(b)]||s[b]||f[b]||a;return n?o.a.createElement(d,i(i({ref:t},l),{},{components:n})):o.a.createElement(d,i({ref:t},l))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,c=new Array(a);c[0]=b;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i.mdxType="string"==typeof e?e:r,c[1]=i;for(var l=2;l=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=r.a.createContext({}),p=function(e){var t=r.a.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):c(c({},t),e)),a},u=function(e){var t=p(e.components);return r.a.createElement(i.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},y=r.a.forwardRef((function(e,t){var a=e.components,n=e.mdxType,o=e.originalType,l=e.parentName,i=s(e,["components","mdxType","originalType","parentName"]),u=p(a),y=n,g=u["".concat(l,".").concat(y)]||u[y]||m[y]||o;return a?r.a.createElement(g,c(c({ref:t},i),{},{components:a})):r.a.createElement(g,c({ref:t},i))}));function g(e,t){var a=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=a.length,l=new Array(o);l[0]=y;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:n,l[1]=c;for(var i=2;i{const a=document.createElement("textarea"),n=document.activeElement;a.value=e,a.setAttribute("readonly",""),a.style.contain="strict",a.style.position="absolute",a.style.left="-9999px",a.style.fontSize="12pt";const r=document.getSelection();let o=!1;r.rangeCount>0&&(o=r.getRangeAt(0)),t.append(a),a.select(),a.selectionStart=0,a.selectionEnd=e.length;let l=!1;try{l=document.execCommand("copy")}catch(c){}return a.remove(),o&&(r.removeAllRanges(),r.addRange(o)),n&&n.focus(),l};e.exports=n,e.exports.default=n},160:function(e,t){e.exports.parse=function(e){var t=e.split(",").map((function(e){return function(e){if(/^-?\d+$/.test(e))return parseInt(e,10);var t;if(t=e.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){var a=t[1],n=t[2],r=t[3];if(a&&r){var o=[],l=(a=parseInt(a))<(r=parseInt(r))?1:-1;"-"!=n&&".."!=n&&"\u2025"!=n||(r+=l);for(var c=a;c!=r;c+=l)o.push(c);return o}}return[]}(e)}));return 0===t.length?[]:1===t.length?Array.isArray(t[0])?t[0]:t:t.reduce((function(e,t){return Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),e.concat(t)}))}},161:function(e,t,a){"use strict";var n=a(0),r=a.n(n),o=a(146),l=a(142),c=a(155),s=a(152),i=a(162),p=a(144),u=a(93),m=a.n(u);const y=["January","February","March","April","May","June","July","August","September","October","November","December"];t.a=function(e){const{children:t,frontMatter:a,metadata:n,truncated:u,isBlogPostPage:g=!1}=e,{date:d,permalink:h,tags:f,readingTime:b}=n,{author:v,title:k,image:E,keywords:j}=a,O=a.author_url||a.authorURL,N=a.author_title||a.authorTitle,x=a.author_image_url||a.authorImageURL,w=Object(p.a)(E,{absolute:!0});return r.a.createElement(r.a.Fragment,null,r.a.createElement(c.a,null,j&&j.length&&r.a.createElement("meta",{name:"keywords",content:j.join(",")}),E&&r.a.createElement("meta",{property:"og:image",content:w}),E&&r.a.createElement("meta",{property:"twitter:image",content:w}),E&&r.a.createElement("meta",{name:"twitter:image:alt",content:"Image for "+k})),r.a.createElement("article",{className:g?void 0:"margin-bottom--xl"},(()=>{const e=g?"h1":"h2",t=d.substring(0,10).split("-"),a=t[0],n=y[parseInt(t[1],10)-1],l=parseInt(t[2],10);return r.a.createElement("header",null,r.a.createElement(e,{className:Object(o.a)("margin-bottom--sm",m.a.blogPostTitle)},g?k:r.a.createElement(s.a,{to:h},k)),r.a.createElement("div",{className:"margin-vert--md"},r.a.createElement("time",{dateTime:d,className:m.a.blogPostDate},n," ",l,", ",a," ",b&&r.a.createElement(r.a.Fragment,null," \xb7 ",Math.ceil(b)," min read"))),r.a.createElement("div",{className:"avatar margin-vert--md"},x&&r.a.createElement("a",{className:"avatar__photo-link avatar__photo",href:O,target:"_blank",rel:"noreferrer noopener"},r.a.createElement("img",{src:x,alt:v})),r.a.createElement("div",{className:"avatar__intro"},v&&r.a.createElement(r.a.Fragment,null,r.a.createElement("h4",{className:"avatar__name"},r.a.createElement("a",{href:O,target:"_blank",rel:"noreferrer noopener"},v)),r.a.createElement("small",{className:"avatar__subtitle"},N)))))})(),r.a.createElement("section",{className:"markdown"},r.a.createElement(l.a,{components:i.a},t)),(f.length>0||u)&&r.a.createElement("footer",{className:"row margin-vert--lg"},f.length>0&&r.a.createElement("div",{className:"col"},r.a.createElement("strong",null,"Tags:"),f.map(({label:e,permalink:t})=>r.a.createElement(s.a,{key:t,className:"margin-horiz--sm",to:t},e))),u&&r.a.createElement("div",{className:"col text--right"},r.a.createElement(s.a,{to:n.permalink,"aria-label":"Read more about "+k},r.a.createElement("strong",null,"Read More"))))))}},162:function(e,t,a){"use strict";var n=a(2),r=a(0),o=a.n(r),l=a(152),c=a(146),s={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","at-rule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]},i={Prism:a(20).a,theme:s};function p(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function u(){return(u=Object.assign||function(e){for(var t=1;t0&&e[a-1]===t?e:e.concat(t)},d=function(e,t){var a=e.plain,n=Object.create(null),r=e.styles.reduce((function(e,a){var n=a.languages,r=a.style;return n&&!n.includes(t)||a.types.forEach((function(t){var a=u({},e[t],r);e[t]=a})),e}),n);return r.root=a,r.plain=u({},a,{backgroundColor:null}),r};function h(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&-1===t.indexOf(n)&&(a[n]=e[n]);return a}var f=function(e){function t(){for(var t=this,a=[],n=arguments.length;n--;)a[n]=arguments[n];e.apply(this,a),p(this,"getThemeDict",(function(e){if(void 0!==t.themeDict&&e.theme===t.prevTheme&&e.language===t.prevLanguage)return t.themeDict;t.prevTheme=e.theme,t.prevLanguage=e.language;var a=e.theme?d(e.theme,e.language):void 0;return t.themeDict=a})),p(this,"getLineProps",(function(e){var a=e.key,n=e.className,r=e.style,o=u({},h(e,["key","className","style","line"]),{className:"token-line",style:void 0,key:void 0}),l=t.getThemeDict(t.props);return void 0!==l&&(o.style=l.plain),void 0!==r&&(o.style=void 0!==o.style?u({},o.style,r):r),void 0!==a&&(o.key=a),n&&(o.className+=" "+n),o})),p(this,"getStyleForToken",(function(e){var a=e.types,n=e.empty,r=a.length,o=t.getThemeDict(t.props);if(void 0!==o){if(1===r&&"plain"===a[0])return n?{display:"inline-block"}:void 0;if(1===r&&!n)return o[a[0]];var l=n?{display:"inline-block"}:{},c=a.map((function(e){return o[e]}));return Object.assign.apply(Object,[l].concat(c))}})),p(this,"getTokenProps",(function(e){var a=e.key,n=e.className,r=e.style,o=e.token,l=u({},h(e,["key","className","style","token"]),{className:"token "+o.types.join(" "),children:o.content,style:t.getStyleForToken(o),key:void 0});return void 0!==r&&(l.style=void 0!==l.style?u({},l.style,r):r),void 0!==a&&(l.key=a),n&&(l.className+=" "+n),l}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(){var e=this.props,t=e.Prism,a=e.language,n=e.code,r=e.children,o=this.getThemeDict(this.props),l=t.languages[a];return r({tokens:function(e){for(var t=[[]],a=[e],n=[0],r=[e.length],o=0,l=0,c=[],s=[c];l>-1;){for(;(o=n[l]++)0?p:["plain"],i=u):(p=g(p,u.type),u.alias&&(p=g(p,u.alias)),i=u.content),"string"==typeof i){var d=i.split(m),h=d.length;c.push({types:p,content:d[0]});for(var f=1;f{const{siteConfig:{themeConfig:{prism:e={}}}}=Object(j.a)(),{isDarkTheme:t}=Object(N.a)(),a=e.theme||O,n=e.darkTheme||a;return t?n:a},w=a(49),P=a.n(w);const T=/{([\d,-]+)}/,C=(e=["js","jsBlock","jsx","python","html"])=>{const t={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},python:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}},a=["highlight-next-line","highlight-start","highlight-end"].join("|"),n=e.map(e=>`(?:${t[e].start}\\s*(${a})\\s*${t[e].end})`).join("|");return new RegExp(`^\\s*(?:${n})\\s*$`)},_=/title=".*"/;var D=({children:e,className:t,metastring:a})=>{const{siteConfig:{themeConfig:{prism:l={}}}}=Object(j.a)(),[s,p]=Object(r.useState)(!1),[u,m]=Object(r.useState)(!1);Object(r.useEffect)(()=>{m(!0)},[]);const y=Object(r.useRef)(null);let g=[],d="";const h=x();if(a&&T.test(a)){const e=a.match(T)[1];g=E.a.parse(e).filter(e=>e>0)}a&&_.test(a)&&(d=a.match(_)[0].split("title=")[1].replace(/"+/g,""));let b=t&&t.replace(/language-/,"");!b&&l.defaultLanguage&&(b=l.defaultLanguage);let k=e.replace(/\n$/,"");if(0===g.length&&void 0!==b){let t="";const a=(e=>{switch(e){case"js":case"javascript":case"ts":case"typescript":return C(["js","jsBlock"]);case"jsx":case"tsx":return C(["js","jsBlock","jsx"]);case"html":return C(["js","jsBlock","html"]);case"python":case"py":return C(["python"]);default:return C()}})(b),n=e.replace(/\n$/,"").split("\n");let r;for(let e=0;ee||t,void 0)){case"highlight-next-line":t+=o+",";break;case"highlight-start":r=o;break;case"highlight-end":t+=`${r}-${o-1},`}n.splice(e,1)}else e+=1}g=E.a.parse(t),k=n.join("\n")}const O=()=>{v()(k),p(!0),setTimeout(()=>p(!1),2e3)};return o.a.createElement(f,Object(n.a)({},i,{key:String(u),theme:h,code:k,language:b}),({className:e,style:t,tokens:a,getLineProps:r,getTokenProps:l})=>o.a.createElement(o.a.Fragment,null,d&&o.a.createElement("div",{style:t,className:P.a.codeBlockTitle},d),o.a.createElement("div",{className:P.a.codeBlockContent},o.a.createElement("button",{ref:y,type:"button","aria-label":"Copy code to clipboard",className:Object(c.a)(P.a.copyButton,{[P.a.copyButtonWithTitle]:d}),onClick:O},s?"Copied":"Copy"),o.a.createElement("div",{tabIndex:0,className:Object(c.a)(e,P.a.codeBlock,{[P.a.codeBlockWithTitle]:d})},o.a.createElement("div",{className:P.a.codeBlockLines,style:t},a.map((e,t)=>{1===e.length&&""===e[0].content&&(e[0].content="\n");const a=r({line:e,key:t});return g.includes(t+1)&&(a.className=a.className+" docusaurus-highlight-code-line"),o.a.createElement("div",Object(n.a)({key:t},a),e.map((e,t)=>o.a.createElement("span",Object(n.a)({key:t},l({token:e,key:t})))))}))))))},S=(a(50),a(51)),B=a.n(S);var A=e=>function({id:t,...a}){const{siteConfig:{themeConfig:{navbar:{hideOnScroll:n=!1}={}}={}}={}}=Object(j.a)();return t?o.a.createElement(e,a,o.a.createElement("a",{"aria-hidden":"true",tabIndex:-1,className:Object(c.a)("anchor",{[B.a.enhancedAnchor]:!n}),id:t}),a.children,o.a.createElement("a",{"aria-hidden":"true",tabIndex:-1,className:"hash-link",href:"#"+t,title:"Direct link to heading"},"#")):o.a.createElement(e,a)},L=a(52),I=a.n(L);const $={code:e=>{const{children:t}=e;return"string"==typeof t?t.includes("\n")?o.a.createElement(D,e):o.a.createElement("code",e):t},a:e=>o.a.createElement(l.a,e),pre:e=>o.a.createElement("div",Object(n.a)({className:I.a.mdxCodeBlock},e)),h1:A("h1"),h2:A("h2"),h3:A("h3"),h4:A("h4"),h5:A("h5"),h6:A("h6")};t.a=$}}]); \ No newline at end of file diff --git a/docs/3.b6ccd44c.js b/docs/3.b6ccd44c.js deleted file mode 100644 index 783af96b9aa..00000000000 --- a/docs/3.b6ccd44c.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return f}));var r=n(0),a=n.n(r);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=a.a.createContext({}),u=function(e){var t=a.a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=u(e.components);return a.a.createElement(s.Provider,{value:t},e.children)},y={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},d=a.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),p=u(n),d=r,f=p["".concat(c,".").concat(d)]||p[d]||y[d]||o;return n?a.a.createElement(f,l(l({ref:t},s),{},{components:n})):a.a.createElement(f,l({ref:t},s))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,c=new Array(o);c[0]=d;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var s=2;s0&&e[n-1]===t?e:e.concat(t)},h=function(e,t){var n=e.plain,r=Object.create(null),a=e.styles.reduce((function(e,n){var r=n.languages,a=n.style;return r&&!r.includes(t)||n.types.forEach((function(t){var n=p({},e[t],a);e[t]=n})),e}),r);return a.root=n,a.plain=p({},n,{backgroundColor:null}),a};function g(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&-1===t.indexOf(r)&&(n[r]=e[r]);return n}var m=function(e){function t(){for(var t=this,n=[],r=arguments.length;r--;)n[r]=arguments[r];e.apply(this,n),u(this,"getThemeDict",(function(e){if(void 0!==t.themeDict&&e.theme===t.prevTheme&&e.language===t.prevLanguage)return t.themeDict;t.prevTheme=e.theme,t.prevLanguage=e.language;var n=e.theme?h(e.theme,e.language):void 0;return t.themeDict=n})),u(this,"getLineProps",(function(e){var n=e.key,r=e.className,a=e.style,o=p({},g(e,["key","className","style","line"]),{className:"token-line",style:void 0,key:void 0}),c=t.getThemeDict(t.props);return void 0!==c&&(o.style=c.plain),void 0!==a&&(o.style=void 0!==o.style?p({},o.style,a):a),void 0!==n&&(o.key=n),r&&(o.className+=" "+r),o})),u(this,"getStyleForToken",(function(e){var n=e.types,r=e.empty,a=n.length,o=t.getThemeDict(t.props);if(void 0!==o){if(1===a&&"plain"===n[0])return r?{display:"inline-block"}:void 0;if(1===a&&!r)return o[n[0]];var c=r?{display:"inline-block"}:{},l=n.map((function(e){return o[e]}));return Object.assign.apply(Object,[c].concat(l))}})),u(this,"getTokenProps",(function(e){var n=e.key,r=e.className,a=e.style,o=e.token,c=p({},g(e,["key","className","style","token"]),{className:"token "+o.types.join(" "),children:o.content,style:t.getStyleForToken(o),key:void 0});return void 0!==a&&(c.style=void 0!==c.style?p({},c.style,a):a),void 0!==n&&(c.key=n),r&&(c.className+=" "+r),c}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(){var e=this.props,t=e.Prism,n=e.language,r=e.code,a=e.children,o=this.getThemeDict(this.props),c=t.languages[n];return a({tokens:function(e){for(var t=[[]],n=[e],r=[0],a=[e.length],o=0,c=0,l=[],i=[l];c>-1;){for(;(o=r[c]++)0?u:["plain"],s=p):(u=f(u,p.type),p.alias&&(u=f(u,p.alias)),s=p.content),"string"==typeof s){var h=s.split(y),g=h.length;l.push({types:u,content:h[0]});for(var m=1;m0}))}c&&S.test(c)&&(E=c.match(S)[0].split("title=")[1].replace(/"+/g,""));var D=n&&n.replace(/language-/,"");!D&&u.defaultLanguage&&(D=u.defaultLanguage);var B=t.replace(/\n$/,"");if(0===j.length&&void 0!==D){for(var A,L="",I=function(e){switch(e){case"js":case"javascript":case"ts":case"typescript":return C(["js","jsBlock"]);case"jsx":case"tsx":return C(["js","jsBlock","jsx"]);case"html":return C(["js","jsBlock","html"]);case"python":case"py":return C(["python"]);default:return C()}}(D),R=t.replace(/\n$/,"").split("\n"),F=0;F{const n=document.createElement("textarea"),r=document.activeElement;n.value=e,n.setAttribute("readonly",""),n.style.contain="strict",n.style.position="absolute",n.style.left="-9999px",n.style.fontSize="12pt";const a=document.getSelection();let o=!1;a.rangeCount>0&&(o=a.getRangeAt(0)),t.append(n),n.select(),n.selectionStart=0,n.selectionEnd=e.length;let c=!1;try{c=document.execCommand("copy")}catch(l){}return n.remove(),o&&(a.removeAllRanges(),a.addRange(o)),r&&r.focus(),c};e.exports=r,e.exports.default=r},183:function(e,t){e.exports.parse=function(e){var t=e.split(",").map((function(e){return function(e){if(/^-?\d+$/.test(e))return parseInt(e,10);var t;if(t=e.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){var n=t[1],r=t[2],a=t[3];if(n&&a){var o=[],c=(n=parseInt(n))<(a=parseInt(a))?1:-1;"-"!=r&&".."!=r&&"\u2025"!=r||(a+=c);for(var l=n;l!=a;l+=c)o.push(l);return o}}return[]}(e)}));return 0===t.length?[]:1===t.length?Array.isArray(t[0])?t[0]:t:t.reduce((function(e,t){return Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),e.concat(t)}))}}}]); \ No newline at end of file diff --git a/docs/34420422.bd14d00b.js b/docs/34420422.c3fd76ca.js similarity index 99% rename from docs/34420422.bd14d00b.js rename to docs/34420422.c3fd76ca.js index af7d8479284..b570d50f4da 100644 --- a/docs/34420422.bd14d00b.js +++ b/docs/34420422.c3fd76ca.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[20],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return u})),t.d(n,"b",(function(){return m}));var r=t(0),i=t.n(r);function s(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var l=i.a.createContext({}),p=function(e){var n=i.a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},u=function(e){var n=p(e.components);return i.a.createElement(l.Provider,{value:n},e.children)},b={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},d=i.a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,s=e.originalType,o=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=p(t),d=r,m=u["".concat(o,".").concat(d)]||u[d]||b[d]||s;return t?i.a.createElement(m,a(a({ref:n},l),{},{components:t})):i.a.createElement(m,a({ref:n},l))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var s=t.length,o=new Array(s);o[0]=d;var a={};for(var c in n)hasOwnProperty.call(n,c)&&(a[c]=n[c]);a.originalType=e,a.mdxType="string"==typeof e?e:r,o[1]=a;for(var l=2;lFur.Tests \u6d4b\u8bd5\u5c42",id:"122-furtests-\u6d4b\u8bd5\u5c42",children:[]},{value:"1.2.3 Solution Items \u89e3\u51b3\u65b9\u6848\u914d\u7f6e\u5c42",id:"123-solution-items-\u89e3\u51b3\u65b9\u6848\u914d\u7f6e\u5c42",children:[]},{value:"1.2.4 Fur \u6838\u5fc3\u5c42",id:"124-fur-\u6838\u5fc3\u5c42",children:[]},{value:"1.2.5 Fur.Application \u4e1a\u52a1\u5e94\u7528\u5c42",id:"125-furapplication-\u4e1a\u52a1\u5e94\u7528\u5c42",children:[]},{value:"1.2.6 Fur.Core \u4ed3\u50a8\u5b9e\u4f53\u5c42",id:"126-furcore-\u4ed3\u50a8\u5b9e\u4f53\u5c42",children:[]},{value:"1.2.7 Fur.Database.Migrations \u6570\u636e\u5e93\u67b6\u6784\u7ef4\u62a4\u5c42",id:"127-furdatabasemigrations-\u6570\u636e\u5e93\u67b6\u6784\u7ef4\u62a4\u5c42",children:[]},{value:"1.2.8 Fur.EntityFramework.Core \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u914d\u7f6e\u5c42",id:"128-furentityframeworkcore-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u914d\u7f6e\u5c42",children:[]},{value:"1.2.9 Fur.Web.Core \u5e94\u7528\u6838\u5fc3\u5c42",id:"129-furwebcore-\u5e94\u7528\u6838\u5fc3\u5c42",children:[]},{value:"1.2.10 Fur.Web.Entry \u5e94\u7528\u5165\u53e3\u5c42",id:"1210-furwebentry-\u5e94\u7528\u5165\u53e3\u5c42",children:[]}],l={rightToc:c};function p(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(s.b)("wrapper",Object(r.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(s.b)("h2",{id:"121-\u6e90\u7801\u67b6\u6784"},"1.2.1 \u6e90\u7801\u67b6\u6784"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur")," \u521b\u5efa\u91c7\u7528\u591a\u5c42\u5206\u5c42\u8bbe\u8ba1\uff0c\u4e3b\u8981\u8bbe\u8ba1\u662f ",Object(s.b)("inlineCode",{parentName:"p"},"\u81ea\u52a8\u62bd\u8c61\u5de5\u5382")," \u548c ",Object(s.b)("inlineCode",{parentName:"p"},"DDD \u9886\u57df\u9a71\u52a8\u8bbe\u8ba1")," \u76f8\u7ed3\u5408\u3002"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u9879\u76ee\u7ed3\u6784\u5982\u4e0b\uff1a"),Object(s.b)("ul",null,Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Tests"),"\uff1a\u6d4b\u8bd5\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Solution Items"),"\uff1a\u89e3\u51b3\u65b9\u6848\u914d\u7f6e\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur"),"\uff1a\u6846\u67b6\u6838\u5fc3\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Application"),"\uff1a\u4e1a\u52a1\u5e94\u7528\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Core"),"\uff1a\u4ed3\u50a8\u5b9e\u4f53\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Database.Migrations"),"\uff1a\u67b6\u6784\u7ef4\u62a4\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.EntityFramework.Core"),"\uff1aEF Core \u914d\u7f6e\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Web.Core"),"\uff1aWeb \u6838\u5fc3\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Web.Entry"),"\uff1aWeb \u5165\u53e3\u5c42/\u542f\u52a8\u5c42")),Object(s.b)("h2",{id:"122-furtests-\u6d4b\u8bd5\u5c42"},"1.2.2 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Tests")," \u6d4b\u8bd5\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Tests")," \u662f\u9879\u76ee\u7684\u6d4b\u8bd5\u5c42\uff0c\u76ee\u524d\u8fd8\u672a\u6574\u7406\u5b8c\u6210\u3002"),Object(s.b)("h2",{id:"123-solution-items-\u89e3\u51b3\u65b9\u6848\u914d\u7f6e\u5c42"},"1.2.3 ",Object(s.b)("inlineCode",{parentName:"h2"},"Solution Items")," \u89e3\u51b3\u65b9\u6848\u914d\u7f6e\u5c42"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{}),"Solution Items\n\u2514.editorconfig\n")),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Solution Items")," \u662f\u7528\u6765\u914d\u7f6e\u89e3\u51b3\u65b9\u6848\u4e2d\u4e00\u4e9b\u5168\u5c40\u914d\u7f6e\u7684\uff0c\u5982\u6bcf\u4e2a\u6587\u4ef6\u7684\u9876\u90e8\u7248\u6743\u4fe1\u606f\uff0c\u5982\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// -----------------------------------------------------------------------------\n// Fur \u662f .NET 5 \u5e73\u53f0\u4e0b\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u7684 Web \u5e94\u7528\u6846\u67b6\u3002\n// Copyright \xa9 2020 Fur, Baiqian Co.,Ltd.\n//\n// \u6846\u67b6\u540d\u79f0\uff1aFur\n// \u6846\u67b6\u4f5c\u8005\uff1a\u767e\u5c0f\u50e7\n// \u6846\u67b6\u7248\u672c\uff1a1.0.0\n// \u6e90\u7801\u5730\u5740\uff1aGitee\uff1ahttps://gitee.com/monksoul/Fur\n// Github\uff1ahttps://github.com/monksoul/Fur\n// \u5f00\u6e90\u534f\u8bae\uff1aApache-2.0\uff08http://www.apache.org/licenses/LICENSE-2.0\uff09\n// -----------------------------------------------------------------------------\n")),Object(s.b)("p",null,"\u76f8\u5173\u914d\u7f6e\u5728 ",Object(s.b)("inlineCode",{parentName:"p"},".editorconfig")," \u6700\u540e\u9762\u4e00\u884c\uff0c\u5982\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{127}","{127}":!0}),'# Rules in this file were initially inferred by Visual Studio IntelliCode from the D:\\MONK\\Fur\\framework codebase based on best match to current usage at 2020/9/2\n# You can modify the rules from these initially generated values to suit your own policies\n# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference\n[*.cs]\n\n\n#Core editorconfig formatting - indentation\n\n#use soft tabs (spaces) for indentation\nindent_style = space\n\n#Formatting - new line options\n\n#place else statements on a new line\ncsharp_new_line_before_else = true\n#require members of anonymous types to be on separate lines\ncsharp_new_line_before_members_in_anonymous_types = true\n#require members of object intializers to be on separate lines\ncsharp_new_line_before_members_in_object_initializers = true\n#require braces to be on a new line for accessors, methods, control_blocks, types, lambdas, object_collection_array_initializers, anonymous_types, and properties (also known as "Allman" style)\ncsharp_new_line_before_open_brace = accessors, methods, control_blocks, types, lambdas, object_collection_array_initializers, anonymous_types, properties\n\n#Formatting - organize using options\n\n#do not place System.* using directives before other using directives\ndotnet_sort_system_directives_first = false\n\n#Formatting - spacing options\n\n#require a space before the colon for bases or interfaces in a type declaration\ncsharp_space_after_colon_in_inheritance_clause = true\n#require a space after a keyword in a control flow statement such as a for loop\ncsharp_space_after_keywords_in_control_flow_statements = true\n#require a space before the colon for bases or interfaces in a type declaration\ncsharp_space_before_colon_in_inheritance_clause = true\n#remove space within empty argument list parentheses\ncsharp_space_between_method_call_empty_parameter_list_parentheses = false\n#remove space between method call name and opening parenthesis\ncsharp_space_between_method_call_name_and_opening_parenthesis = false\n#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call\ncsharp_space_between_method_call_parameter_list_parentheses = false\n#remove space within empty parameter list parentheses for a method declaration\ncsharp_space_between_method_declaration_empty_parameter_list_parentheses = false\n#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list.\ncsharp_space_between_method_declaration_parameter_list_parentheses = false\n\n#Formatting - wrapping options\n\n#leave code block on single line\ncsharp_preserve_single_line_blocks = true\n#leave statements and member declarations on the same line\ncsharp_preserve_single_line_statements = true\n\n#Style - Code block preferences\n\n#prefer no curly braces if allowed\ncsharp_prefer_braces = false:suggestion\n\n#Style - expression bodied member options\n\n#prefer expression-bodied members for accessors\ncsharp_style_expression_bodied_accessors = true:suggestion\n#prefer block bodies for constructors\ncsharp_style_expression_bodied_constructors = false:suggestion\n#prefer block bodies for methods\ncsharp_style_expression_bodied_methods = false:suggestion\n#prefer expression-bodied members for properties\ncsharp_style_expression_bodied_properties = true:suggestion\n\n#Style - expression level options\n\n#prefer out variables to be declared inline in the argument list of a method call when possible\ncsharp_style_inlined_variable_declaration = true:suggestion\n#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them\ndotnet_style_predefined_type_for_member_access = true:suggestion\n\n#Style - Expression-level preferences\n\n#prefer default over default(T)\ncsharp_prefer_simple_default_expression = true:suggestion\n#prefer objects to be initialized using object initializers when possible\ndotnet_style_object_initializer = true:suggestion\n#prefer inferred anonymous type member names\ndotnet_style_prefer_inferred_anonymous_type_member_names = false:suggestion\n#prefer inferred tuple element names\ndotnet_style_prefer_inferred_tuple_names = true:suggestion\n\n#Style - implicit and explicit types\n\n#prefer var over explicit type in all cases, unless overridden by another code style rule\ncsharp_style_var_elsewhere = true:suggestion\n#prefer var is used to declare variables with built-in system types such as int\ncsharp_style_var_for_built_in_types = true:suggestion\n#prefer var when the type is already mentioned on the right-hand side of a declaration expression\ncsharp_style_var_when_type_is_apparent = true:suggestion\n\n#Style - language keyword and framework type options\n\n#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them\ndotnet_style_predefined_type_for_locals_parameters_members = true:suggestion\n\n#Style - Miscellaneous preferences\n\n#prefer local functions over anonymous functions\ncsharp_style_pattern_local_over_anonymous_function = true:suggestion\n\n#Style - modifier options\n\n#prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods.\ndotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion\n\n#Style - Modifier preferences\n\n#when this rule is set to a list of modifiers, prefer the specified ordering.\ncsharp_preferred_modifier_order = public,private,internal,protected,virtual,static,async,abstract,readonly,sealed,override:suggestion\n\n#Style - qualification options\n\n#prefer fields not to be prefaced with this. or Me. in Visual Basic\ndotnet_style_qualification_for_field = false:suggestion\n#prefer methods not to be prefaced with this. or Me. in Visual Basic\ndotnet_style_qualification_for_method = false:suggestion\n#prefer properties not to be prefaced with this. or Me. in Visual Basic\ndotnet_style_qualification_for_property = false:suggestion\n\n# Add file header\nfile_header_template = -----------------------------------------------------------------------------\\nFur \u662f .NET 5 \u5e73\u53f0\u4e0b\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u7684 Web \u5e94\u7528\u6846\u67b6\u3002\\nCopyright \xa9 2020 Fur, Baiqian Co.,Ltd.\\n\\n\u6846\u67b6\u540d\u79f0\uff1aFur\\n\u6846\u67b6\u4f5c\u8005\uff1a\u767e\u5c0f\u50e7\\n\u6846\u67b6\u7248\u672c\uff1a1.0.0\\n\u6e90\u7801\u5730\u5740\uff1aGitee\uff1ahttps://gitee.com/monksoul/Fur \\n Github\uff1ahttps://github.com/monksoul/Fur \\n\u5f00\u6e90\u534f\u8bae\uff1aApache-2.0\uff08http://www.apache.org/licenses/LICENSE-2.0\uff09\\n-----------------------------------------------------------------------------\n')),Object(s.b)("h2",{id:"124-fur-\u6838\u5fc3\u5c42"},"1.2.4 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur")," \u6838\u5fc3\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur")," \u6838\u5fc3\u5c42\u662f ",Object(s.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u7684\u4e2d\u5fc3\uff0c\u4e5f\u662f ",Object(s.b)("inlineCode",{parentName:"p"},"Fur")," \u80fd\u591f\u652f\u6491\u8d77\u6765\u7684\u5fc5\u5907\u5c42\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{}),"Fur\n\u251c\u2500Fur.csproj\n\u251c\u2500Fur.csproj.user\n\u251c\u2500FurStartup.cs\n\u251c\u2500ViewEngine\n| \u251c\u2500IViewEngine.cs\n| \u251c\u2500ViewEngine.cs\n| \u251c\u2500Templates\n| | \u251c\u2500IViewEngineCompiledTemplate.cs\n| | \u251c\u2500IViewEngineTemplate.cs\n| | \u251c\u2500ViewEngineCompiledTemplate.cs\n| | \u2514ViewEngineTemplate.cs\n| \u251c\u2500Options\n| | \u2514ViewEngineCompilationOptions.cs\n| \u251c\u2500Models\n| | \u2514AnonymousTypeWrapper.cs\n| \u251c\u2500Exceptions\n| | \u251c\u2500ViewEngineCompilationException.cs\n| | \u2514ViewEngineException.cs\n| \u251c\u2500Compilations\n| | \u251c\u2500IViewEngineCompilationOptionsBuilder.cs\n| | \u2514ViewEngineCompilationOptionsBuilder.cs\n\u251c\u2500UnifyResult\n| \u251c\u2500Providers\n| | \u251c\u2500IUnifyResultProvider.cs\n| | \u2514RESTfulResultProvider.cs\n| \u251c\u2500Models\n| | \u2514RESTfulResult.cs\n| \u251c\u2500Filters\n| | \u2514SuccessUnifyResultFilter.cs\n| \u251c\u2500Extensions\n| | \u2514UnifyResultServiceCollectionExtensions.cs\n\u251c\u2500SpecificationDocument\n| \u251c\u2500Options\n| | \u2514SpecificationDocumentSettingsOptions.cs\n| \u251c\u2500Models\n| | \u251c\u2500GroupOrder.cs\n| | \u251c\u2500SpecificationOpenApiInfo.cs\n| | \u251c\u2500SpecificationOpenApiSecurityRequirementItem.cs\n| | \u2514SpecificationOpenApiSecurityScheme.cs\n| \u251c\u2500Extensions\n| | \u251c\u2500SpecificationDocumentApplicationBuilderExtensions.cs\n| | \u2514SpecificationDocumentServiceCollectionExtensions.cs\n| \u251c\u2500Builders\n| | \u2514SpecificationDocumentBuilder.cs\n| \u251c\u2500Assets\n| | \u2514index-mini-profiler.html\n\u251c\u2500ObjectMapper\n| \u251c\u2500Extensions\n| | \u2514ObjectMapperServiceCollectionExtensions.cs\n| \u251c\u2500Dependencies\n| | \u2514IObjectMapper.cs\n\u251c\u2500LinqBuilder\n| \u251c\u2500Visitors\n| | \u2514ParameterReplaceExpressionVisitor.cs\n| \u251c\u2500Extensions\n| | \u2514LinqExtensions.cs\n| \u251c\u2500Builders\n| | \u2514LinqExpression.cs\n\u251c\u2500FriendlyException\n| \u251c\u2500Oops.cs\n| \u251c\u2500Providers\n| | \u2514IErrorCodeTypeProvider.cs\n| \u251c\u2500Options\n| | \u2514ErrorCodeMessageSettingsOptions.cs\n| \u251c\u2500Models\n| | \u2514MethodIfException.cs\n| \u251c\u2500Filters\n| | \u2514FriendlyExceptionFilter.cs\n| \u251c\u2500Extensions\n| | \u2514FriendlyExceptionServiceCollectionExtensions.cs\n| \u251c\u2500Attributes\n| | \u251c\u2500ErrorCodeItemMetadataAttribute.cs\n| | \u251c\u2500ErrorCodeTypeAttribute.cs\n| | \u2514IfExceptionAttribute.cs\n\u251c\u2500DynamicApiController\n| \u251c\u2500Penetrates.cs\n| \u251c\u2500Providers\n| | \u2514DynamicApiControllerFeatureProvider.cs\n| \u251c\u2500Options\n| | \u2514DynamicApiControllerSettingsOptions.cs\n| \u251c\u2500Models\n| | \u2514ParameterRouteTemplate.cs\n| \u251c\u2500Extensions\n| | \u2514DynamicApiControllerServiceCollectionExtensions.cs\n| \u251c\u2500Enums\n| | \u2514ApiSeats.cs\n| \u251c\u2500Dependencies\n| | \u2514IDynamicApiController.cs\n| \u251c\u2500Conventions\n| | \u2514DynamicApiControllerApplicationModelConvention.cs\n| \u251c\u2500Attributes\n| | \u251c\u2500ApiDescriptionSettingsAttribute.cs\n| | \u251c\u2500ApiSeatAttribute.cs\n| | \u2514DynamicApiControllerAttribute.cs\n\u251c\u2500DependencyInjection\n| \u251c\u2500Options\n| | \u2514DependencyInjectionSettingsOptions.cs\n| \u251c\u2500Models\n| | \u2514ExternalService.cs\n| \u251c\u2500Extensions\n| | \u2514DependencyInjectionServiceCollectionExtensions.cs\n| \u251c\u2500Enums\n| | \u251c\u2500InjectionActions.cs\n| | \u251c\u2500InjectionPatterns.cs\n| | \u2514RegisterType.cs\n| \u251c\u2500Dependencies\n| | \u251c\u2500IPrivateDependency.cs\n| | \u251c\u2500IScoped.cs\n| | \u251c\u2500ISingleton.cs\n| | \u251c\u2500ITransient.cs\n| | \u251c\u2500Proxies\n| | | \u2514IDispatchProxy.cs\n| \u251c\u2500Attributes\n| | \u251c\u2500InjectionAttribute.cs\n| | \u2514SkipScanAttribute.cs\n\u251c\u2500DataValidation\n| \u251c\u2500Validators\n| | \u2514DataValidator.cs\n| \u251c\u2500Providers\n| | \u2514IValidationMessageTypeProvider.cs\n| \u251c\u2500Options\n| | \u2514ValidationTypeMessageSettingsOptions.cs\n| \u251c\u2500Models\n| | \u2514DataValidationResult.cs\n| \u251c\u2500Filters\n| | \u2514DataValidationFilter.cs\n| \u251c\u2500Extensions\n| | \u251c\u2500DataValidationExtensions.cs\n| | \u2514DataValidationServiceCollectionExtensions.cs\n| \u251c\u2500Enums\n| | \u251c\u2500ValidationPattern.cs\n| | \u2514ValidationTypes.cs\n| \u251c\u2500Attributes\n| | \u251c\u2500DataValidationAttribute.cs\n| | \u251c\u2500NonValidationAttribute.cs\n| | \u251c\u2500ValidationItemMetadataAttribute.cs\n| | \u251c\u2500ValidationMessageAttribute.cs\n| | \u251c\u2500ValidationMessageTypeAttribute.cs\n| | \u2514ValidationTypeAttribute.cs\n\u251c\u2500DataEncryption\n| \u251c\u2500AESEncryption.cs\n| \u251c\u2500DESCEncryption.cs\n| \u2514MD5Encryption.cs\n\u251c\u2500DatabaseAccessor\n| \u251c\u2500UnitOfWork\n| | \u251c\u2500Filters\n| | | \u2514UnitOfWorkFilter.cs\n| | \u251c\u2500Attributes\n| | | \u251c\u2500NonTransactAttribute.cs\n| | | \u2514UnitOfWorkAttribute.cs\n| \u251c\u2500Repositories\n| | \u251c\u2500EFCoreRepository.cs\n| | \u251c\u2500IMSRepository.cs\n| | \u251c\u2500IRepository.cs\n| | \u251c\u2500ISqlRepository.cs\n| | \u251c\u2500MSRepository.cs\n| | \u251c\u2500SqlRepository.cs\n| | \u251c\u2500Implantations\n| | | \u251c\u2500DeletableRepository.cs\n| | | \u251c\u2500InsertableRepository.cs\n| | | \u251c\u2500OperableRepository.cs\n| | | \u251c\u2500ReadableRepository.cs\n| | | \u251c\u2500SqlExecutableRepository.cs\n| | | \u251c\u2500SqlReaderRepository.cs\n| | | \u251c\u2500UpdateableRepository.cs\n| | | \u2514WritableRepository.cs\n| | \u251c\u2500Dependencies\n| | | \u251c\u2500IDeletableRepository.cs\n| | | \u251c\u2500IInsertableRepository.cs\n| | | \u251c\u2500IOperableRepository.cs\n| | | \u251c\u2500IReadableRepository.cs\n| | | \u251c\u2500IRepositoryDependency.cs\n| | | \u251c\u2500ISqlExecutableRepository.cs\n| | | \u251c\u2500ISqlReaderRepository.cs\n| | | \u251c\u2500IUpdateableRepository.cs\n| | | \u2514IWritableRepository.cs\n| \u251c\u2500Pools\n| | \u251c\u2500DbContextPool.cs\n| | \u2514IDbContextPool.cs\n| \u251c\u2500MultiTenants\n| | \u251c\u2500Locators\n| | | \u2514MultiTenantDbContextLocator.cs\n| | \u251c\u2500Enums\n| | | \u2514MultiTenantOptions.cs\n| | \u251c\u2500Entities\n| | | \u2514Tenant.cs\n| | \u251c\u2500Dependencies\n| | | \u251c\u2500IMultiTenantOnDatabase.cs\n| | | \u251c\u2500IMultiTenantOnSchema.cs\n| | | \u251c\u2500IMultiTenantOnTable.cs\n| | | \u2514IPrivateMultiTenant.cs\n| \u251c\u2500Models\n| | \u251c\u2500DbProvider.cs\n| | \u251c\u2500PagedList.cs\n| | \u251c\u2500ProcedureOutputResult.cs\n| | \u251c\u2500ProcedureOutputValue.cs\n| | \u251c\u2500SqlTemplate.cs\n| | \u2514SqlTemplateParameter.cs\n| \u251c\u2500Locators\n| | \u251c\u2500IDbContextLocator.cs\n| | \u2514MasterDbContextLocator.cs\n| \u251c\u2500Interceptors\n| | \u251c\u2500DbContextSaveChangesInterceptor.cs\n| | \u251c\u2500SqlCommandProfilerInterceptor.cs\n| | \u2514SqlConnectionProfilerInterceptor.cs\n| \u251c\u2500Helpers\n| | \u2514DbHelpers.cs\n| \u251c\u2500Extensions\n| | \u251c\u2500DatabaseAccessorServiceCollectionExtensions.cs\n| | \u251c\u2500PagedQueryableExtensions.cs\n| | \u251c\u2500Repositories\n| | | \u251c\u2500IEntityExtensions.cs\n| | | \u251c\u2500IEntityWithDbContextLocatorExtensions.cs\n| | | \u2514SqlExtensions.cs\n| | \u251c\u2500DatabaseProvider\n| | | \u251c\u2500DatabaseProviderServiceCollectionExtensions.cs\n| | | \u2514Penetrates.cs\n| | \u251c\u2500DatabaseFacade\n| | | \u251c\u2500DbDataConvertExtensions.cs\n| | | \u251c\u2500DbObjectExtensions.cs\n| | | \u2514SqlAdoNetExtensions.cs\n| \u251c\u2500Enums\n| | \u251c\u2500DbFunctionType.cs\n| | \u251c\u2500EFCoreErrorCodes.cs\n| | \u2514ManualOptions.cs\n| \u251c\u2500Entities\n| | \u251c\u2500Dependencies\n| | | \u251c\u2500Entity.cs\n| | | \u251c\u2500EntityBase.cs\n| | | \u251c\u2500EntityNotKey.cs\n| | | \u251c\u2500IEntity.cs\n| | | \u2514IEntityNotKey.cs\n| | \u251c\u2500Configures\n| | | \u251c\u2500IEntitySeedData.cs\n| | | \u251c\u2500IEntityTypeBuilder.cs\n| | | \u251c\u2500IModelBuilderFilter.cs\n| | | \u2514IPrivateModelBuilder.cs\n| | \u251c\u2500Attributes\n| | | \u251c\u2500FakeDeleteAttribute.cs\n| | | \u251c\u2500NonAutomaticAttribute.cs\n| | | \u2514QueryableFunctionAttribute.cs\n| \u251c\u2500DynamicModels\n| | \u251c\u2500DynamicModelCacheKeyFactory.cs\n| | \u2514IEntityMutableTable.cs\n| \u251c\u2500Contexts\n| | \u251c\u2500AppDbContext.cs\n| | \u251c\u2500Builders\n| | | \u251c\u2500AppDbContextBuilder.cs\n| | | \u251c\u2500Models\n| | | | \u2514DbContextCorrelationType.cs\n| | \u251c\u2500Attributes\n| | | \u2514AppDbContextAttribute.cs\n| \u251c\u2500Attributes\n| | \u2514DbParameterAttribute.cs\n| \u251c\u2500Advances\n| | \u251c\u2500Proxies\n| | | \u2514SqlDispatchProxy.cs\n| | \u251c\u2500Models\n| | | \u2514SqlProxyMethod.cs\n| | \u251c\u2500Dependencies\n| | | \u2514ISqlDispatchProxy.cs\n| | \u251c\u2500Attributes\n| | | \u251c\u2500SqlExecuteAttribute.cs\n| | | \u251c\u2500SqlFunctionAttribute.cs\n| | | \u251c\u2500SqlProcedureAttribute.cs\n| | | \u251c\u2500Basics\n| | | | \u251c\u2500SqlObjectProxyAttribute.cs\n| | | | \u251c\u2500SqlProxyAttribute.cs\n| | | | \u2514SqlSentenceProxyAttribute.cs\n\u251c\u2500CorsAccessor\n| \u251c\u2500Options\n| | \u2514CorsAccessorSettingsOptions.cs\n| \u251c\u2500Extensions\n| | \u251c\u2500CorsAccessorApplicationBuilderExtensions.cs\n| | \u2514CorsAccessorServiceCollectionExtensions.cs\n\u251c\u2500ConfigurableOptions\n| \u251c\u2500Options\n| | \u2514IConfigurableOptions.cs\n| \u251c\u2500Extensions\n| | \u2514ConfigurableOptionsServiceCollectionExtensions.cs\n| \u251c\u2500Attributes\n| | \u2514OptionsSettingsAttribute.cs\n\u251c\u2500Authorization\n| \u251c\u2500Penetrates.cs\n| \u251c\u2500Requirements\n| | \u2514AuthorizePolicyRequirement.cs\n| \u251c\u2500Providers\n| | \u2514AuthorizePolicyProvider.cs\n| \u251c\u2500Options\n| | \u2514JWTSettingsOptions.cs\n| \u251c\u2500Handlers\n| | \u2514AuthorizePolicyHandler.cs\n| \u251c\u2500Extensions\n| | \u2514PolicyAuthorizationServiceCollectionExtensions.cs\n| \u251c\u2500Attributes\n| | \u2514AuthorizePolicyAttribute.cs\n\u251c\u2500App\n| \u251c\u2500App.cs\n| \u251c\u2500Startups\n| | \u251c\u2500AppStartup.cs\n| | \u2514HostingStartup.cs\n| \u251c\u2500Options\n| | \u2514AppSettingsOptions.cs\n| \u251c\u2500Filters\n| | \u2514StartupFilter.cs\n| \u251c\u2500Extensions\n| | \u251c\u2500AppApplicationBuilderExtensions.cs\n| | \u251c\u2500AppServiceCollectionExtensions.cs\n| | \u251c\u2500WebHostBuilderExtensions.cs\n| | \u251c\u2500Types\n| | | \u2514ObjectExtensions.cs\n| \u251c\u2500Attributes\n| | \u2514AppStartupAttribute.cs\n")),Object(s.b)("h2",{id:"125-furapplication-\u4e1a\u52a1\u5e94\u7528\u5c42"},"1.2.5 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Application")," \u4e1a\u52a1\u5e94\u7528\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Application")," \u4e1a\u52a1\u5e94\u7528\u5c42\u662f\u6700\u5e38\u7528\u7684\u5c42\uff0c\u51e0\u4e4e\u6240\u6709\u7684\u4e1a\u52a1\u4ee3\u7801\u90fd\u5728\u8fd9\u4e2a\u5c42\u4e2d\u7f16\u5199\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.Application\n\u251c\u2500Fur.Application.Core.csproj\n\u251c\u2500Fur.Application.Core.xml\n\u2514FurApplicationStartup.cs\n")),Object(s.b)("h2",{id:"126-furcore-\u4ed3\u50a8\u5b9e\u4f53\u5c42"},"1.2.6 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Core")," \u4ed3\u50a8\u5b9e\u4f53\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Core")," \u4e3b\u8981\u662f\u5b58\u50a8\u81ea\u5b9a\u4e49\u4ed3\u50a8\u548c\u5b9a\u4e49\u5b9e\u4f53\u7684\u5c42\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.Core\n\u251c\u2500Fur.Core.csproj\n\u2514FurCoreStartup.cs\n")),Object(s.b)("h2",{id:"127-furdatabasemigrations-\u6570\u636e\u5e93\u67b6\u6784\u7ef4\u62a4\u5c42"},"1.2.7 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Database.Migrations")," \u6570\u636e\u5e93\u67b6\u6784\u7ef4\u62a4\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Database.Migrations")," \u4e3b\u8981\u662f\u7528\u6765\u5b58\u653e ",Object(s.b)("inlineCode",{parentName:"p"},"Database First")," \u548c ",Object(s.b)("inlineCode",{parentName:"p"},"Code First")," \u751f\u6210\u7684\u7ef4\u62a4\u6587\u4ef6\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.Database.Migrations\n\u2514Fur.Database.Migrations.csproj\n")),Object(s.b)("h2",{id:"128-furentityframeworkcore-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u914d\u7f6e\u5c42"},"1.2.8 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.EntityFramework.Core")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u914d\u7f6e\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u4e3b\u8981\u662f\u7528\u6765\u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u548c\u5176\u4ed6\u6570\u636e\u5e93\u76f8\u5173\u914d\u7f6e\u4fe1\u606f\u7684\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.EntityFramework.Core\n\u2514Fur.EntityFramework.Core.csproj\n")),Object(s.b)("h2",{id:"129-furwebcore-\u5e94\u7528\u6838\u5fc3\u5c42"},"1.2.9 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Web.Core")," \u5e94\u7528\u6838\u5fc3\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Web.Core")," \u4e3b\u8981\u662f\u7528\u6765\u914d\u7f6e Web \u5165\u53e3\u4e00\u4e9b\u4ee3\u7801\uff0c\u5982 ",Object(s.b)("inlineCode",{parentName:"p"},"Filter"),"\uff0c",Object(s.b)("inlineCode",{parentName:"p"},"Middlewares")," \u7b49\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.Web.Core\n\u251c\u2500Fur.Web.Core.xml\n\u2514FurWebCoreStartup.cs\n")),Object(s.b)("h2",{id:"1210-furwebentry-\u5e94\u7528\u5165\u53e3\u5c42"},"1.2.10 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Web.Entry")," \u5e94\u7528\u5165\u53e3\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Web.Entry")," \u662f\u6211\u4eec\u7684\u5e94\u7528\u5c42\uff0c\u4e5f\u5c31\u662f\u6211\u4eec\u7684 ",Object(s.b)("inlineCode",{parentName:"p"},"Web")," \u9879\u76ee\u5c42\uff0c\u53d1\u5e03\u5c42\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.Web.Entry\n\u251c\u2500appsettings.Development.json\n\u251c\u2500appsettings.json\n\u251c\u2500Fur.Web.Entry.csproj\n\u251c\u2500Fur.Web.Entry.csproj.user\n\u251c\u2500Fur.Web.Entry.xml\n\u251c\u2500Program.cs\n\u251c\u2500Startup.cs\n\u251c\u2500wwwroot\n| \u2514README.md\n\u251c\u2500Properties\n| \u2514launchSettings.json\n\u251c\u2500Controllers\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[20],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return u})),t.d(n,"b",(function(){return m}));var r=t(0),i=t.n(r);function s(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var l=i.a.createContext({}),p=function(e){var n=i.a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},u=function(e){var n=p(e.components);return i.a.createElement(l.Provider,{value:n},e.children)},b={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},d=i.a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,s=e.originalType,o=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=p(t),d=r,m=u["".concat(o,".").concat(d)]||u[d]||b[d]||s;return t?i.a.createElement(m,a(a({ref:n},l),{},{components:t})):i.a.createElement(m,a({ref:n},l))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var s=t.length,o=new Array(s);o[0]=d;var a={};for(var c in n)hasOwnProperty.call(n,c)&&(a[c]=n[c]);a.originalType=e,a.mdxType="string"==typeof e?e:r,o[1]=a;for(var l=2;lFur.Tests \u6d4b\u8bd5\u5c42",id:"122-furtests-\u6d4b\u8bd5\u5c42",children:[]},{value:"1.2.3 Solution Items \u89e3\u51b3\u65b9\u6848\u914d\u7f6e\u5c42",id:"123-solution-items-\u89e3\u51b3\u65b9\u6848\u914d\u7f6e\u5c42",children:[]},{value:"1.2.4 Fur \u6838\u5fc3\u5c42",id:"124-fur-\u6838\u5fc3\u5c42",children:[]},{value:"1.2.5 Fur.Application \u4e1a\u52a1\u5e94\u7528\u5c42",id:"125-furapplication-\u4e1a\u52a1\u5e94\u7528\u5c42",children:[]},{value:"1.2.6 Fur.Core \u4ed3\u50a8\u5b9e\u4f53\u5c42",id:"126-furcore-\u4ed3\u50a8\u5b9e\u4f53\u5c42",children:[]},{value:"1.2.7 Fur.Database.Migrations \u6570\u636e\u5e93\u67b6\u6784\u7ef4\u62a4\u5c42",id:"127-furdatabasemigrations-\u6570\u636e\u5e93\u67b6\u6784\u7ef4\u62a4\u5c42",children:[]},{value:"1.2.8 Fur.EntityFramework.Core \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u914d\u7f6e\u5c42",id:"128-furentityframeworkcore-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u914d\u7f6e\u5c42",children:[]},{value:"1.2.9 Fur.Web.Core \u5e94\u7528\u6838\u5fc3\u5c42",id:"129-furwebcore-\u5e94\u7528\u6838\u5fc3\u5c42",children:[]},{value:"1.2.10 Fur.Web.Entry \u5e94\u7528\u5165\u53e3\u5c42",id:"1210-furwebentry-\u5e94\u7528\u5165\u53e3\u5c42",children:[]}],l={rightToc:c};function p(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(s.b)("wrapper",Object(r.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(s.b)("h2",{id:"121-\u6e90\u7801\u67b6\u6784"},"1.2.1 \u6e90\u7801\u67b6\u6784"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur")," \u521b\u5efa\u91c7\u7528\u591a\u5c42\u5206\u5c42\u8bbe\u8ba1\uff0c\u4e3b\u8981\u8bbe\u8ba1\u662f ",Object(s.b)("inlineCode",{parentName:"p"},"\u81ea\u52a8\u62bd\u8c61\u5de5\u5382")," \u548c ",Object(s.b)("inlineCode",{parentName:"p"},"DDD \u9886\u57df\u9a71\u52a8\u8bbe\u8ba1")," \u76f8\u7ed3\u5408\u3002"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u9879\u76ee\u7ed3\u6784\u5982\u4e0b\uff1a"),Object(s.b)("ul",null,Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Tests"),"\uff1a\u6d4b\u8bd5\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Solution Items"),"\uff1a\u89e3\u51b3\u65b9\u6848\u914d\u7f6e\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur"),"\uff1a\u6846\u67b6\u6838\u5fc3\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Application"),"\uff1a\u4e1a\u52a1\u5e94\u7528\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Core"),"\uff1a\u4ed3\u50a8\u5b9e\u4f53\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Database.Migrations"),"\uff1a\u67b6\u6784\u7ef4\u62a4\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.EntityFramework.Core"),"\uff1aEF Core \u914d\u7f6e\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Web.Core"),"\uff1aWeb \u6838\u5fc3\u5c42"),Object(s.b)("li",{parentName:"ul"},Object(s.b)("inlineCode",{parentName:"li"},"Fur.Web.Entry"),"\uff1aWeb \u5165\u53e3\u5c42/\u542f\u52a8\u5c42")),Object(s.b)("h2",{id:"122-furtests-\u6d4b\u8bd5\u5c42"},"1.2.2 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Tests")," \u6d4b\u8bd5\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Tests")," \u662f\u9879\u76ee\u7684\u6d4b\u8bd5\u5c42\uff0c\u76ee\u524d\u8fd8\u672a\u6574\u7406\u5b8c\u6210\u3002"),Object(s.b)("h2",{id:"123-solution-items-\u89e3\u51b3\u65b9\u6848\u914d\u7f6e\u5c42"},"1.2.3 ",Object(s.b)("inlineCode",{parentName:"h2"},"Solution Items")," \u89e3\u51b3\u65b9\u6848\u914d\u7f6e\u5c42"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{}),"Solution Items\n\u2514.editorconfig\n")),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Solution Items")," \u662f\u7528\u6765\u914d\u7f6e\u89e3\u51b3\u65b9\u6848\u4e2d\u4e00\u4e9b\u5168\u5c40\u914d\u7f6e\u7684\uff0c\u5982\u6bcf\u4e2a\u6587\u4ef6\u7684\u9876\u90e8\u7248\u6743\u4fe1\u606f\uff0c\u5982\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// -----------------------------------------------------------------------------\n// Fur \u662f .NET 5 \u5e73\u53f0\u4e0b\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u7684 Web \u5e94\u7528\u6846\u67b6\u3002\n// Copyright \xa9 2020 Fur, Baiqian Co.,Ltd.\n//\n// \u6846\u67b6\u540d\u79f0\uff1aFur\n// \u6846\u67b6\u4f5c\u8005\uff1a\u767e\u5c0f\u50e7\n// \u6846\u67b6\u7248\u672c\uff1a1.0.0\n// \u6e90\u7801\u5730\u5740\uff1aGitee\uff1ahttps://gitee.com/monksoul/Fur\n// Github\uff1ahttps://github.com/monksoul/Fur\n// \u5f00\u6e90\u534f\u8bae\uff1aApache-2.0\uff08http://www.apache.org/licenses/LICENSE-2.0\uff09\n// -----------------------------------------------------------------------------\n")),Object(s.b)("p",null,"\u76f8\u5173\u914d\u7f6e\u5728 ",Object(s.b)("inlineCode",{parentName:"p"},".editorconfig")," \u6700\u540e\u9762\u4e00\u884c\uff0c\u5982\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{127}","{127}":!0}),'# Rules in this file were initially inferred by Visual Studio IntelliCode from the D:\\MONK\\Fur\\framework codebase based on best match to current usage at 2020/9/2\n# You can modify the rules from these initially generated values to suit your own policies\n# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference\n[*.cs]\n\n\n#Core editorconfig formatting - indentation\n\n#use soft tabs (spaces) for indentation\nindent_style = space\n\n#Formatting - new line options\n\n#place else statements on a new line\ncsharp_new_line_before_else = true\n#require members of anonymous types to be on separate lines\ncsharp_new_line_before_members_in_anonymous_types = true\n#require members of object intializers to be on separate lines\ncsharp_new_line_before_members_in_object_initializers = true\n#require braces to be on a new line for accessors, methods, control_blocks, types, lambdas, object_collection_array_initializers, anonymous_types, and properties (also known as "Allman" style)\ncsharp_new_line_before_open_brace = accessors, methods, control_blocks, types, lambdas, object_collection_array_initializers, anonymous_types, properties\n\n#Formatting - organize using options\n\n#do not place System.* using directives before other using directives\ndotnet_sort_system_directives_first = false\n\n#Formatting - spacing options\n\n#require a space before the colon for bases or interfaces in a type declaration\ncsharp_space_after_colon_in_inheritance_clause = true\n#require a space after a keyword in a control flow statement such as a for loop\ncsharp_space_after_keywords_in_control_flow_statements = true\n#require a space before the colon for bases or interfaces in a type declaration\ncsharp_space_before_colon_in_inheritance_clause = true\n#remove space within empty argument list parentheses\ncsharp_space_between_method_call_empty_parameter_list_parentheses = false\n#remove space between method call name and opening parenthesis\ncsharp_space_between_method_call_name_and_opening_parenthesis = false\n#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call\ncsharp_space_between_method_call_parameter_list_parentheses = false\n#remove space within empty parameter list parentheses for a method declaration\ncsharp_space_between_method_declaration_empty_parameter_list_parentheses = false\n#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list.\ncsharp_space_between_method_declaration_parameter_list_parentheses = false\n\n#Formatting - wrapping options\n\n#leave code block on single line\ncsharp_preserve_single_line_blocks = true\n#leave statements and member declarations on the same line\ncsharp_preserve_single_line_statements = true\n\n#Style - Code block preferences\n\n#prefer no curly braces if allowed\ncsharp_prefer_braces = false:suggestion\n\n#Style - expression bodied member options\n\n#prefer expression-bodied members for accessors\ncsharp_style_expression_bodied_accessors = true:suggestion\n#prefer block bodies for constructors\ncsharp_style_expression_bodied_constructors = false:suggestion\n#prefer block bodies for methods\ncsharp_style_expression_bodied_methods = false:suggestion\n#prefer expression-bodied members for properties\ncsharp_style_expression_bodied_properties = true:suggestion\n\n#Style - expression level options\n\n#prefer out variables to be declared inline in the argument list of a method call when possible\ncsharp_style_inlined_variable_declaration = true:suggestion\n#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them\ndotnet_style_predefined_type_for_member_access = true:suggestion\n\n#Style - Expression-level preferences\n\n#prefer default over default(T)\ncsharp_prefer_simple_default_expression = true:suggestion\n#prefer objects to be initialized using object initializers when possible\ndotnet_style_object_initializer = true:suggestion\n#prefer inferred anonymous type member names\ndotnet_style_prefer_inferred_anonymous_type_member_names = false:suggestion\n#prefer inferred tuple element names\ndotnet_style_prefer_inferred_tuple_names = true:suggestion\n\n#Style - implicit and explicit types\n\n#prefer var over explicit type in all cases, unless overridden by another code style rule\ncsharp_style_var_elsewhere = true:suggestion\n#prefer var is used to declare variables with built-in system types such as int\ncsharp_style_var_for_built_in_types = true:suggestion\n#prefer var when the type is already mentioned on the right-hand side of a declaration expression\ncsharp_style_var_when_type_is_apparent = true:suggestion\n\n#Style - language keyword and framework type options\n\n#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them\ndotnet_style_predefined_type_for_locals_parameters_members = true:suggestion\n\n#Style - Miscellaneous preferences\n\n#prefer local functions over anonymous functions\ncsharp_style_pattern_local_over_anonymous_function = true:suggestion\n\n#Style - modifier options\n\n#prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods.\ndotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion\n\n#Style - Modifier preferences\n\n#when this rule is set to a list of modifiers, prefer the specified ordering.\ncsharp_preferred_modifier_order = public,private,internal,protected,virtual,static,async,abstract,readonly,sealed,override:suggestion\n\n#Style - qualification options\n\n#prefer fields not to be prefaced with this. or Me. in Visual Basic\ndotnet_style_qualification_for_field = false:suggestion\n#prefer methods not to be prefaced with this. or Me. in Visual Basic\ndotnet_style_qualification_for_method = false:suggestion\n#prefer properties not to be prefaced with this. or Me. in Visual Basic\ndotnet_style_qualification_for_property = false:suggestion\n\n# Add file header\nfile_header_template = -----------------------------------------------------------------------------\\nFur \u662f .NET 5 \u5e73\u53f0\u4e0b\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u7684 Web \u5e94\u7528\u6846\u67b6\u3002\\nCopyright \xa9 2020 Fur, Baiqian Co.,Ltd.\\n\\n\u6846\u67b6\u540d\u79f0\uff1aFur\\n\u6846\u67b6\u4f5c\u8005\uff1a\u767e\u5c0f\u50e7\\n\u6846\u67b6\u7248\u672c\uff1a1.0.0\\n\u6e90\u7801\u5730\u5740\uff1aGitee\uff1ahttps://gitee.com/monksoul/Fur \\n Github\uff1ahttps://github.com/monksoul/Fur \\n\u5f00\u6e90\u534f\u8bae\uff1aApache-2.0\uff08http://www.apache.org/licenses/LICENSE-2.0\uff09\\n-----------------------------------------------------------------------------\n')),Object(s.b)("h2",{id:"124-fur-\u6838\u5fc3\u5c42"},"1.2.4 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur")," \u6838\u5fc3\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur")," \u6838\u5fc3\u5c42\u662f ",Object(s.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u7684\u4e2d\u5fc3\uff0c\u4e5f\u662f ",Object(s.b)("inlineCode",{parentName:"p"},"Fur")," \u80fd\u591f\u652f\u6491\u8d77\u6765\u7684\u5fc5\u5907\u5c42\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{}),"Fur\n\u251c\u2500Fur.csproj\n\u251c\u2500Fur.csproj.user\n\u251c\u2500FurStartup.cs\n\u251c\u2500ViewEngine\n| \u251c\u2500IViewEngine.cs\n| \u251c\u2500ViewEngine.cs\n| \u251c\u2500Templates\n| | \u251c\u2500IViewEngineCompiledTemplate.cs\n| | \u251c\u2500IViewEngineTemplate.cs\n| | \u251c\u2500ViewEngineCompiledTemplate.cs\n| | \u2514ViewEngineTemplate.cs\n| \u251c\u2500Options\n| | \u2514ViewEngineCompilationOptions.cs\n| \u251c\u2500Models\n| | \u2514AnonymousTypeWrapper.cs\n| \u251c\u2500Exceptions\n| | \u251c\u2500ViewEngineCompilationException.cs\n| | \u2514ViewEngineException.cs\n| \u251c\u2500Compilations\n| | \u251c\u2500IViewEngineCompilationOptionsBuilder.cs\n| | \u2514ViewEngineCompilationOptionsBuilder.cs\n\u251c\u2500UnifyResult\n| \u251c\u2500Providers\n| | \u251c\u2500IUnifyResultProvider.cs\n| | \u2514RESTfulResultProvider.cs\n| \u251c\u2500Models\n| | \u2514RESTfulResult.cs\n| \u251c\u2500Filters\n| | \u2514SuccessUnifyResultFilter.cs\n| \u251c\u2500Extensions\n| | \u2514UnifyResultServiceCollectionExtensions.cs\n\u251c\u2500SpecificationDocument\n| \u251c\u2500Options\n| | \u2514SpecificationDocumentSettingsOptions.cs\n| \u251c\u2500Models\n| | \u251c\u2500GroupOrder.cs\n| | \u251c\u2500SpecificationOpenApiInfo.cs\n| | \u251c\u2500SpecificationOpenApiSecurityRequirementItem.cs\n| | \u2514SpecificationOpenApiSecurityScheme.cs\n| \u251c\u2500Extensions\n| | \u251c\u2500SpecificationDocumentApplicationBuilderExtensions.cs\n| | \u2514SpecificationDocumentServiceCollectionExtensions.cs\n| \u251c\u2500Builders\n| | \u2514SpecificationDocumentBuilder.cs\n| \u251c\u2500Assets\n| | \u2514index-mini-profiler.html\n\u251c\u2500ObjectMapper\n| \u251c\u2500Extensions\n| | \u2514ObjectMapperServiceCollectionExtensions.cs\n| \u251c\u2500Dependencies\n| | \u2514IObjectMapper.cs\n\u251c\u2500LinqBuilder\n| \u251c\u2500Visitors\n| | \u2514ParameterReplaceExpressionVisitor.cs\n| \u251c\u2500Extensions\n| | \u2514LinqExtensions.cs\n| \u251c\u2500Builders\n| | \u2514LinqExpression.cs\n\u251c\u2500FriendlyException\n| \u251c\u2500Oops.cs\n| \u251c\u2500Providers\n| | \u2514IErrorCodeTypeProvider.cs\n| \u251c\u2500Options\n| | \u2514ErrorCodeMessageSettingsOptions.cs\n| \u251c\u2500Models\n| | \u2514MethodIfException.cs\n| \u251c\u2500Filters\n| | \u2514FriendlyExceptionFilter.cs\n| \u251c\u2500Extensions\n| | \u2514FriendlyExceptionServiceCollectionExtensions.cs\n| \u251c\u2500Attributes\n| | \u251c\u2500ErrorCodeItemMetadataAttribute.cs\n| | \u251c\u2500ErrorCodeTypeAttribute.cs\n| | \u2514IfExceptionAttribute.cs\n\u251c\u2500DynamicApiController\n| \u251c\u2500Penetrates.cs\n| \u251c\u2500Providers\n| | \u2514DynamicApiControllerFeatureProvider.cs\n| \u251c\u2500Options\n| | \u2514DynamicApiControllerSettingsOptions.cs\n| \u251c\u2500Models\n| | \u2514ParameterRouteTemplate.cs\n| \u251c\u2500Extensions\n| | \u2514DynamicApiControllerServiceCollectionExtensions.cs\n| \u251c\u2500Enums\n| | \u2514ApiSeats.cs\n| \u251c\u2500Dependencies\n| | \u2514IDynamicApiController.cs\n| \u251c\u2500Conventions\n| | \u2514DynamicApiControllerApplicationModelConvention.cs\n| \u251c\u2500Attributes\n| | \u251c\u2500ApiDescriptionSettingsAttribute.cs\n| | \u251c\u2500ApiSeatAttribute.cs\n| | \u2514DynamicApiControllerAttribute.cs\n\u251c\u2500DependencyInjection\n| \u251c\u2500Options\n| | \u2514DependencyInjectionSettingsOptions.cs\n| \u251c\u2500Models\n| | \u2514ExternalService.cs\n| \u251c\u2500Extensions\n| | \u2514DependencyInjectionServiceCollectionExtensions.cs\n| \u251c\u2500Enums\n| | \u251c\u2500InjectionActions.cs\n| | \u251c\u2500InjectionPatterns.cs\n| | \u2514RegisterType.cs\n| \u251c\u2500Dependencies\n| | \u251c\u2500IPrivateDependency.cs\n| | \u251c\u2500IScoped.cs\n| | \u251c\u2500ISingleton.cs\n| | \u251c\u2500ITransient.cs\n| | \u251c\u2500Proxies\n| | | \u2514IDispatchProxy.cs\n| \u251c\u2500Attributes\n| | \u251c\u2500InjectionAttribute.cs\n| | \u2514SkipScanAttribute.cs\n\u251c\u2500DataValidation\n| \u251c\u2500Validators\n| | \u2514DataValidator.cs\n| \u251c\u2500Providers\n| | \u2514IValidationMessageTypeProvider.cs\n| \u251c\u2500Options\n| | \u2514ValidationTypeMessageSettingsOptions.cs\n| \u251c\u2500Models\n| | \u2514DataValidationResult.cs\n| \u251c\u2500Filters\n| | \u2514DataValidationFilter.cs\n| \u251c\u2500Extensions\n| | \u251c\u2500DataValidationExtensions.cs\n| | \u2514DataValidationServiceCollectionExtensions.cs\n| \u251c\u2500Enums\n| | \u251c\u2500ValidationPattern.cs\n| | \u2514ValidationTypes.cs\n| \u251c\u2500Attributes\n| | \u251c\u2500DataValidationAttribute.cs\n| | \u251c\u2500NonValidationAttribute.cs\n| | \u251c\u2500ValidationItemMetadataAttribute.cs\n| | \u251c\u2500ValidationMessageAttribute.cs\n| | \u251c\u2500ValidationMessageTypeAttribute.cs\n| | \u2514ValidationTypeAttribute.cs\n\u251c\u2500DataEncryption\n| \u251c\u2500AESEncryption.cs\n| \u251c\u2500DESCEncryption.cs\n| \u2514MD5Encryption.cs\n\u251c\u2500DatabaseAccessor\n| \u251c\u2500UnitOfWork\n| | \u251c\u2500Filters\n| | | \u2514UnitOfWorkFilter.cs\n| | \u251c\u2500Attributes\n| | | \u251c\u2500NonTransactAttribute.cs\n| | | \u2514UnitOfWorkAttribute.cs\n| \u251c\u2500Repositories\n| | \u251c\u2500EFCoreRepository.cs\n| | \u251c\u2500IMSRepository.cs\n| | \u251c\u2500IRepository.cs\n| | \u251c\u2500ISqlRepository.cs\n| | \u251c\u2500MSRepository.cs\n| | \u251c\u2500SqlRepository.cs\n| | \u251c\u2500Implantations\n| | | \u251c\u2500DeletableRepository.cs\n| | | \u251c\u2500InsertableRepository.cs\n| | | \u251c\u2500OperableRepository.cs\n| | | \u251c\u2500ReadableRepository.cs\n| | | \u251c\u2500SqlExecutableRepository.cs\n| | | \u251c\u2500SqlReaderRepository.cs\n| | | \u251c\u2500UpdateableRepository.cs\n| | | \u2514WritableRepository.cs\n| | \u251c\u2500Dependencies\n| | | \u251c\u2500IDeletableRepository.cs\n| | | \u251c\u2500IInsertableRepository.cs\n| | | \u251c\u2500IOperableRepository.cs\n| | | \u251c\u2500IReadableRepository.cs\n| | | \u251c\u2500IRepositoryDependency.cs\n| | | \u251c\u2500ISqlExecutableRepository.cs\n| | | \u251c\u2500ISqlReaderRepository.cs\n| | | \u251c\u2500IUpdateableRepository.cs\n| | | \u2514IWritableRepository.cs\n| \u251c\u2500Pools\n| | \u251c\u2500DbContextPool.cs\n| | \u2514IDbContextPool.cs\n| \u251c\u2500MultiTenants\n| | \u251c\u2500Locators\n| | | \u2514MultiTenantDbContextLocator.cs\n| | \u251c\u2500Enums\n| | | \u2514MultiTenantOptions.cs\n| | \u251c\u2500Entities\n| | | \u2514Tenant.cs\n| | \u251c\u2500Dependencies\n| | | \u251c\u2500IMultiTenantOnDatabase.cs\n| | | \u251c\u2500IMultiTenantOnSchema.cs\n| | | \u251c\u2500IMultiTenantOnTable.cs\n| | | \u2514IPrivateMultiTenant.cs\n| \u251c\u2500Models\n| | \u251c\u2500DbProvider.cs\n| | \u251c\u2500PagedList.cs\n| | \u251c\u2500ProcedureOutputResult.cs\n| | \u251c\u2500ProcedureOutputValue.cs\n| | \u251c\u2500SqlTemplate.cs\n| | \u2514SqlTemplateParameter.cs\n| \u251c\u2500Locators\n| | \u251c\u2500IDbContextLocator.cs\n| | \u2514MasterDbContextLocator.cs\n| \u251c\u2500Interceptors\n| | \u251c\u2500DbContextSaveChangesInterceptor.cs\n| | \u251c\u2500SqlCommandProfilerInterceptor.cs\n| | \u2514SqlConnectionProfilerInterceptor.cs\n| \u251c\u2500Helpers\n| | \u2514DbHelpers.cs\n| \u251c\u2500Extensions\n| | \u251c\u2500DatabaseAccessorServiceCollectionExtensions.cs\n| | \u251c\u2500PagedQueryableExtensions.cs\n| | \u251c\u2500Repositories\n| | | \u251c\u2500IEntityExtensions.cs\n| | | \u251c\u2500IEntityWithDbContextLocatorExtensions.cs\n| | | \u2514SqlExtensions.cs\n| | \u251c\u2500DatabaseProvider\n| | | \u251c\u2500DatabaseProviderServiceCollectionExtensions.cs\n| | | \u2514Penetrates.cs\n| | \u251c\u2500DatabaseFacade\n| | | \u251c\u2500DbDataConvertExtensions.cs\n| | | \u251c\u2500DbObjectExtensions.cs\n| | | \u2514SqlAdoNetExtensions.cs\n| \u251c\u2500Enums\n| | \u251c\u2500DbFunctionType.cs\n| | \u251c\u2500EFCoreErrorCodes.cs\n| | \u2514ManualOptions.cs\n| \u251c\u2500Entities\n| | \u251c\u2500Dependencies\n| | | \u251c\u2500Entity.cs\n| | | \u251c\u2500EntityBase.cs\n| | | \u251c\u2500EntityNotKey.cs\n| | | \u251c\u2500IEntity.cs\n| | | \u2514IEntityNotKey.cs\n| | \u251c\u2500Configures\n| | | \u251c\u2500IEntitySeedData.cs\n| | | \u251c\u2500IEntityTypeBuilder.cs\n| | | \u251c\u2500IModelBuilderFilter.cs\n| | | \u2514IPrivateModelBuilder.cs\n| | \u251c\u2500Attributes\n| | | \u251c\u2500FakeDeleteAttribute.cs\n| | | \u251c\u2500NonAutomaticAttribute.cs\n| | | \u2514QueryableFunctionAttribute.cs\n| \u251c\u2500DynamicModels\n| | \u251c\u2500DynamicModelCacheKeyFactory.cs\n| | \u2514IEntityMutableTable.cs\n| \u251c\u2500Contexts\n| | \u251c\u2500AppDbContext.cs\n| | \u251c\u2500Builders\n| | | \u251c\u2500AppDbContextBuilder.cs\n| | | \u251c\u2500Models\n| | | | \u2514DbContextCorrelationType.cs\n| | \u251c\u2500Attributes\n| | | \u2514AppDbContextAttribute.cs\n| \u251c\u2500Attributes\n| | \u2514DbParameterAttribute.cs\n| \u251c\u2500Advances\n| | \u251c\u2500Proxies\n| | | \u2514SqlDispatchProxy.cs\n| | \u251c\u2500Models\n| | | \u2514SqlProxyMethod.cs\n| | \u251c\u2500Dependencies\n| | | \u2514ISqlDispatchProxy.cs\n| | \u251c\u2500Attributes\n| | | \u251c\u2500SqlExecuteAttribute.cs\n| | | \u251c\u2500SqlFunctionAttribute.cs\n| | | \u251c\u2500SqlProcedureAttribute.cs\n| | | \u251c\u2500Basics\n| | | | \u251c\u2500SqlObjectProxyAttribute.cs\n| | | | \u251c\u2500SqlProxyAttribute.cs\n| | | | \u2514SqlSentenceProxyAttribute.cs\n\u251c\u2500CorsAccessor\n| \u251c\u2500Options\n| | \u2514CorsAccessorSettingsOptions.cs\n| \u251c\u2500Extensions\n| | \u251c\u2500CorsAccessorApplicationBuilderExtensions.cs\n| | \u2514CorsAccessorServiceCollectionExtensions.cs\n\u251c\u2500ConfigurableOptions\n| \u251c\u2500Options\n| | \u2514IConfigurableOptions.cs\n| \u251c\u2500Extensions\n| | \u2514ConfigurableOptionsServiceCollectionExtensions.cs\n| \u251c\u2500Attributes\n| | \u2514OptionsSettingsAttribute.cs\n\u251c\u2500Authorization\n| \u251c\u2500Penetrates.cs\n| \u251c\u2500Requirements\n| | \u2514AuthorizePolicyRequirement.cs\n| \u251c\u2500Providers\n| | \u2514AuthorizePolicyProvider.cs\n| \u251c\u2500Options\n| | \u2514JWTSettingsOptions.cs\n| \u251c\u2500Handlers\n| | \u2514AuthorizePolicyHandler.cs\n| \u251c\u2500Extensions\n| | \u2514PolicyAuthorizationServiceCollectionExtensions.cs\n| \u251c\u2500Attributes\n| | \u2514AuthorizePolicyAttribute.cs\n\u251c\u2500App\n| \u251c\u2500App.cs\n| \u251c\u2500Startups\n| | \u251c\u2500AppStartup.cs\n| | \u2514HostingStartup.cs\n| \u251c\u2500Options\n| | \u2514AppSettingsOptions.cs\n| \u251c\u2500Filters\n| | \u2514StartupFilter.cs\n| \u251c\u2500Extensions\n| | \u251c\u2500AppApplicationBuilderExtensions.cs\n| | \u251c\u2500AppServiceCollectionExtensions.cs\n| | \u251c\u2500WebHostBuilderExtensions.cs\n| | \u251c\u2500Types\n| | | \u2514ObjectExtensions.cs\n| \u251c\u2500Attributes\n| | \u2514AppStartupAttribute.cs\n")),Object(s.b)("h2",{id:"125-furapplication-\u4e1a\u52a1\u5e94\u7528\u5c42"},"1.2.5 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Application")," \u4e1a\u52a1\u5e94\u7528\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Application")," \u4e1a\u52a1\u5e94\u7528\u5c42\u662f\u6700\u5e38\u7528\u7684\u5c42\uff0c\u51e0\u4e4e\u6240\u6709\u7684\u4e1a\u52a1\u4ee3\u7801\u90fd\u5728\u8fd9\u4e2a\u5c42\u4e2d\u7f16\u5199\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.Application\n\u251c\u2500Fur.Application.Core.csproj\n\u251c\u2500Fur.Application.Core.xml\n\u2514FurApplicationStartup.cs\n")),Object(s.b)("h2",{id:"126-furcore-\u4ed3\u50a8\u5b9e\u4f53\u5c42"},"1.2.6 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Core")," \u4ed3\u50a8\u5b9e\u4f53\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Core")," \u4e3b\u8981\u662f\u5b58\u50a8\u81ea\u5b9a\u4e49\u4ed3\u50a8\u548c\u5b9a\u4e49\u5b9e\u4f53\u7684\u5c42\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.Core\n\u251c\u2500Fur.Core.csproj\n\u2514FurCoreStartup.cs\n")),Object(s.b)("h2",{id:"127-furdatabasemigrations-\u6570\u636e\u5e93\u67b6\u6784\u7ef4\u62a4\u5c42"},"1.2.7 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Database.Migrations")," \u6570\u636e\u5e93\u67b6\u6784\u7ef4\u62a4\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Database.Migrations")," \u4e3b\u8981\u662f\u7528\u6765\u5b58\u653e ",Object(s.b)("inlineCode",{parentName:"p"},"Database First")," \u548c ",Object(s.b)("inlineCode",{parentName:"p"},"Code First")," \u751f\u6210\u7684\u7ef4\u62a4\u6587\u4ef6\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.Database.Migrations\n\u2514Fur.Database.Migrations.csproj\n")),Object(s.b)("h2",{id:"128-furentityframeworkcore-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u914d\u7f6e\u5c42"},"1.2.8 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.EntityFramework.Core")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u914d\u7f6e\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u4e3b\u8981\u662f\u7528\u6765\u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u548c\u5176\u4ed6\u6570\u636e\u5e93\u76f8\u5173\u914d\u7f6e\u4fe1\u606f\u7684\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.EntityFramework.Core\n\u2514Fur.EntityFramework.Core.csproj\n")),Object(s.b)("h2",{id:"129-furwebcore-\u5e94\u7528\u6838\u5fc3\u5c42"},"1.2.9 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Web.Core")," \u5e94\u7528\u6838\u5fc3\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Web.Core")," \u4e3b\u8981\u662f\u7528\u6765\u914d\u7f6e Web \u5165\u53e3\u4e00\u4e9b\u4ee3\u7801\uff0c\u5982 ",Object(s.b)("inlineCode",{parentName:"p"},"Filter"),"\uff0c",Object(s.b)("inlineCode",{parentName:"p"},"Middlewares")," \u7b49\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.Web.Core\n\u251c\u2500Fur.Web.Core.xml\n\u2514FurWebCoreStartup.cs\n")),Object(s.b)("h2",{id:"1210-furwebentry-\u5e94\u7528\u5165\u53e3\u5c42"},"1.2.10 ",Object(s.b)("inlineCode",{parentName:"h2"},"Fur.Web.Entry")," \u5e94\u7528\u5165\u53e3\u5c42"),Object(s.b)("p",null,Object(s.b)("inlineCode",{parentName:"p"},"Fur.Web.Entry")," \u662f\u6211\u4eec\u7684\u5e94\u7528\u5c42\uff0c\u4e5f\u5c31\u662f\u6211\u4eec\u7684 ",Object(s.b)("inlineCode",{parentName:"p"},"Web")," \u9879\u76ee\u5c42\uff0c\u53d1\u5e03\u5c42\u3002"),Object(s.b)("p",null,"\u6e90\u7801\u7ed3\u6784\uff1a"),Object(s.b)("pre",null,Object(s.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"Fur.Web.Entry\n\u251c\u2500appsettings.Development.json\n\u251c\u2500appsettings.json\n\u251c\u2500Fur.Web.Entry.csproj\n\u251c\u2500Fur.Web.Entry.csproj.user\n\u251c\u2500Fur.Web.Entry.xml\n\u251c\u2500Program.cs\n\u251c\u2500Startup.cs\n\u251c\u2500wwwroot\n| \u2514README.md\n\u251c\u2500Properties\n| \u2514launchSettings.json\n\u251c\u2500Controllers\n")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/36793c62.d48973ba.js b/docs/36793c62.7d5d0b0d.js similarity index 98% rename from docs/36793c62.d48973ba.js rename to docs/36793c62.7d5d0b0d.js index 1702540d192..9f010efd7ed 100644 --- a/docs/36793c62.d48973ba.js +++ b/docs/36793c62.7d5d0b0d.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[21],{142:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return m}));var n=r(0),o=r.n(n);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var u=o.a.createContext({}),l=function(e){var t=o.a.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=l(e.components);return o.a.createElement(u.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},d=o.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,c=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),s=l(r),d=n,m=s["".concat(c,".").concat(d)]||s[d]||f[d]||a;return r?o.a.createElement(m,i(i({ref:t},u),{},{components:r})):o.a.createElement(m,i({ref:t},u))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,c=new Array(a);c[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:n,c[1]=i;for(var u=2;u=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var u=o.a.createContext({}),l=function(e){var t=o.a.useContext(u),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=l(e.components);return o.a.createElement(u.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},d=o.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,c=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),s=l(r),d=n,m=s["".concat(c,".").concat(d)]||s[d]||f[d]||a;return r?o.a.createElement(m,i(i({ref:t},u),{},{components:r})):o.a.createElement(m,i({ref:t},u))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,c=new Array(a);c[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:n,c[1]=i;for(var u=2;u=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=o.a.createContext({}),l=function(e){var t=o.a.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},s=function(e){var t=l(e.components);return o.a.createElement(p.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},d=o.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,i=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=l(r),d=n,m=s["".concat(i,".").concat(d)]||s[d]||f[d]||a;return r?o.a.createElement(m,c(c({ref:t},p),{},{components:r})):o.a.createElement(m,c({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,i=new Array(a);i[0]=d;var c={};for(var u in t)hasOwnProperty.call(t,u)&&(c[u]=t[u]);c.originalType=e,c.mdxType="string"==typeof e?e:n,i[1]=c;for(var p=2;p=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=o.a.createContext({}),l=function(e){var t=o.a.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},s=function(e){var t=l(e.components);return o.a.createElement(p.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},d=o.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,a=e.originalType,i=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),s=l(r),d=n,m=s["".concat(i,".").concat(d)]||s[d]||f[d]||a;return r?o.a.createElement(m,c(c({ref:t},p),{},{components:r})):o.a.createElement(m,c({ref:t},p))}));function m(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var a=r.length,i=new Array(a);i[0]=d;var c={};for(var u in t)hasOwnProperty.call(t,u)&&(c[u]=t[u]);c.originalType=e,c.mdxType="string"==typeof e?e:n,i[1]=c;for(var p=2;p=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},O={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},m=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=o(a),m=r,j=u["".concat(c,".").concat(m)]||u[m]||O[m]||b;return a?n.a.createElement(j,l(l({ref:t},p),{},{components:a})):n.a.createElement(j,l({ref:t},p))}));function j(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;pfunction(e,t,a,{forcePrependBaseUrl:r=!1,absolute:b=!1}={}){if(!a)return a;if(a.startsWith("#"))return a;if(Object(n.b)(a))return a;if(r)return t+a;const c=a.startsWith(t)?a:t+a.replace(/^\//,"");return b?e+c:c}(t,e,a,r)}}function c(e,t={}){const{withBaseUrl:a}=b();return a(e,t)}},145:function(e,t,a){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function n(e){return void 0!==e&&!r(e)}a.d(t,"b",(function(){return r})),a.d(t,"a",(function(){return n}))},78:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return l})),a.d(t,"metadata",(function(){return i})),a.d(t,"rightToc",(function(){return p})),a.d(t,"default",(function(){return u}));var r=a(2),n=a(6),b=(a(0),a(142)),c=a(144),l={slug:"welcome",title:"Fur \u4ecb\u7ecd",author:"dotnet\u4e2d\u56fd",author_title:"\u4e3a\u4e2d\u56fd .NET \u5f00\u53d1\u8005\u63d0\u4f9b\u4f18\u8d28\u7684\u8d44\u8baf\u548c\u6280\u672f\u5206\u4eab\u3002",author_url:"https://chinadot.net",author_image_url:"https://i.loli.net/2020/10/01/94AxjHp21aPKQWd.png",tags:["fur","furos",".net",".netcore",".net5"]},i={permalink:"/blog/welcome",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/blog/2020-08-19-welcome.mdx",source:"@site/blog\\2020-08-19-welcome.mdx",description:"=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},O={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},m=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=o(a),m=r,j=u["".concat(c,".").concat(m)]||u[m]||O[m]||b;return a?n.a.createElement(j,l(l({ref:t},p),{},{components:a})):n.a.createElement(j,l({ref:t},p))}));function j(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;p=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=i.a.createContext({}),l=function(e){var t=i.a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):b(b({},t),e)),n},s=function(e){var t=l(e.components);return i.a.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.a.createElement(i.a.Fragment,{},t)}},m=i.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,r=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),s=l(n),m=a,O=s["".concat(r,".").concat(m)]||s[m]||d[m]||o;return n?i.a.createElement(O,b(b({ref:t},p),{},{components:n})):i.a.createElement(O,b({ref:t},p))}));function O(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=m;var b={};for(var c in t)hasOwnProperty.call(t,c)&&(b[c]=t[c]);b.originalType=e,b.mdxType="string"==typeof e?e:a,r[1]=b;for(var p=2;pAppDbContext",id:"912-appdbcontext",children:[]},{value:"9.1.3 AppDbContext \u548c DbContext \u533a\u522b",id:"913-appdbcontext-\u548c-dbcontext-\u533a\u522b",children:[]},{value:"9.1.4 \u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"914-\u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[{value:"9.1.4.1 \u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"9141-\u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"9.1.4.2 \u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"9142-\u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]}]},{value:"9.1.5 \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32",id:"915-\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32",children:[{value:"9.1.5.1 \u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e",id:"9151-\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e",children:[]},{value:"9.1.5.2 [AppDbContext] \u65b9\u5f0f\u914d\u7f6e",id:"9152-appdbcontext-\u65b9\u5f0f\u914d\u7f6e",children:[]},{value:"9.1.5.3 OnConfiguring \u65b9\u5f0f\u914d\u7f6e",id:"9153-onconfiguring-\u65b9\u5f0f\u914d\u7f6e",children:[]}]},{value:"9.1.6 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e",id:"916-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e",children:[]},{value:"9.1.7 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c",id:"917-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c",children:[]},{value:"9.1.8 \u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61",id:"918-\u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61",children:[]},{value:"9.1.9 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"919-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],p={rightToc:c};function l(e){var t=e.components,n=Object(i.a)(e,["components"]);return Object(o.b)("wrapper",Object(a.a)({},p,n,{components:t,mdxType:"MDXLayout"}),Object(o.b)("h2",{id:"911-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.1.1 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(o.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u662f\u8d1f\u8d23\u548c\u6570\u636e\u5e93\u4ea4\u4e92\u7684\u5bf9\u8c61\uff0c\u63d0\u4f9b\u7a0b\u5e8f\u5bf9\u6570\u636e\u5e93\u5b58\u53d6\u63d0\u4f9b\u4e86\u5927\u91cf\u7684\u65b9\u6cd5\u3002"),Object(o.b)("p",null,"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u9ed8\u8ba4\u96c6\u6210\u4e86\u5fae\u8f6f\u4eb2\u513f\u5b50\uff1a",Object(o.b)("inlineCode",{parentName:"p"},"EntityFramework Core")," \uff0c\u4e5f\u5c31\u662f\u901a\u5e38\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6307\u7684\u662f ",Object(o.b)("inlineCode",{parentName:"p"},"DbContext")," \u7c7b\u6216\u5b83\u7684\u5b9e\u73b0\u7c7b\u3002"),Object(o.b)("h2",{id:"912-appdbcontext"},"9.1.2 ",Object(o.b)("inlineCode",{parentName:"h2"},"AppDbContext")),Object(o.b)("p",null,"\u5728\u6211\u4eec\u5b9e\u9645\u9879\u76ee\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"EFCore")," \u63d0\u4f9b\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"DbContext")," \u64cd\u4f5c\u5bf9\u8c61\u64cd\u4f5c\u6570\u636e\u5e93\u6709\u4e9b\u7e41\u7410\u548c\u590d\u6742\uff0c\u4e14\u9ed8\u8ba4\u4e0d\u5177\u5907\u8bfb\u5199\u5206\u79bb\u3001\u591a\u5e93\u7b49\u64cd\u4f5c\u529f\u80fd\u3002"),Object(o.b)("p",null,"\u6240\u4ee5\uff0c",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86 ",Object(o.b)("inlineCode",{parentName:"p"},"AppDbContext")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u8be5\u4e0a\u4e0b\u6587\u7ee7\u627f\u81ea ",Object(o.b)("inlineCode",{parentName:"p"},"DbContext"),"\u3002"),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u540e\u7eed\u7ae0\u8282\uff0c\u7686\u91c7\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"EFCore")," \u4ee3\u66ff ",Object(o.b)("inlineCode",{parentName:"p"},"EntityFramework Core"),"\u3002"))),Object(o.b)("h2",{id:"913-appdbcontext-\u548c-dbcontext-\u533a\u522b"},"9.1.3 ",Object(o.b)("inlineCode",{parentName:"h2"},"AppDbContext")," \u548c ",Object(o.b)("inlineCode",{parentName:"h2"},"DbContext")," \u533a\u522b"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u7ee7\u627f\u81ea ",Object(o.b)("inlineCode",{parentName:"li"},"DbContext"),"\uff0c\u5177\u5907 ",Object(o.b)("inlineCode",{parentName:"li"},"DbContext")," \u6240\u6709\u529f\u80fd\u3002"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u652f\u6301\u591a\u6570\u636e\u5e93\u64cd\u4f5c\u6cdb\u578b\u7248\u672c\uff0c\u5982\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u81ea\u52a8\u914d\u7f6e\u5b9e\u4f53\u4fe1\u606f\uff0c\u65e0\u9700\u5728 ",Object(o.b)("inlineCode",{parentName:"li"},"OnModelCreating")," \u4e2d\u914d\u7f6e"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u652f\u6301\u5185\u7f6e\u591a\u79df\u6237\u652f\u6301"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u652f\u6301\u5168\u5c40\u6a21\u578b\u914d\u7f6e\u62e6\u622a\u5668"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u652f\u6301\u6570\u636e\u63d0\u4ea4\u66f4\u6539\u591a\u4e2a\u4e8b\u4ef6"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u63d0\u4f9b\u66f4\u52a0\u5f3a\u5927\u7684\u6a21\u578b\u64cd\u4f5c\u80fd\u529b\uff0c\u5982\u679c ",Object(o.b)("inlineCode",{parentName:"li"},"Sql")," \u64cd\u4f5c\uff0c\u8bfb\u5199\u5206\u79bb\u7b49"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u80fd\u591f\u5f97\u5230 ",Object(o.b)("inlineCode",{parentName:"li"},"Fur")," \u6846\u67b6\u66f4\u591a\u7684\u529f\u80fd\u652f\u6301")),Object(o.b)("h2",{id:"914-\u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.1.4 \u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(o.b)("p",null,"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\u4e86\uff0c\u63d0\u4f9b\u4e86\u4e24\u79cd ",Object(o.b)("inlineCode",{parentName:"p"},"AppDbContext")," \u5b9a\u4e49\u65b9\u5f0f\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u64cd\u4f5c\u9ed8\u8ba4\u6570\u636e\u5e93"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u64cd\u4f5c N \u4e2a\u6570\u636e\u5e93")),Object(o.b)("p",null,"\u5176\u4e2d ",Object(o.b)("inlineCode",{parentName:"p"},"AppDbContext")," \u9ed8\u8ba4\u7ee7\u627f\u81ea ",Object(o.b)("inlineCode",{parentName:"p"},"AppDbContext"),"\u3002"),Object(o.b)("p",null,"\u4e0b\u9762\u662f\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u521b\u5efa\u7684\u591a\u4e2a\u4f8b\u5b50\uff1a"),Object(o.b)("h3",{id:"9141-\u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.1.4.1 \u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,12}","{1,6,12}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("\u8fde\u63a5\u5b57\u7b26\u4e32\u6216appsetting.json \u952e")]\n public class FurDbContext : AppDbContext // \u7ee7\u627f AppDbContext<> \u7c7b\n {\n /// \n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\n /// \n /// \n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(o.b)("h3",{id:"9142-\u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.1.4.2 \u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,12}","{1,6,12}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("\u8fde\u63a5\u5b57\u7b26\u4e32\u6216appsetting.json \u952e")]\n public class FurOtherDbContext : AppDbContext // \u7ee7\u627f AppDbContext<> \u7c7b\n {\n /// \n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\n /// \n /// \n public FurOtherDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(o.b)("div",{className:"admonition admonition-important alert alert--info"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u6240\u6709\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u90fd\u5e94\u8be5\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u9879\u76ee\u4e2d\u521b\u5efa\u3002\u5173\u4e8e ",Object(o.b)("inlineCode",{parentName:"p"},"TDbContextLocator")," \u5c06\u5728\u4e0b\u4e00\u7ae0\u8282 \u300a",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"dbcontext-locator"}),"9.2 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668"),"\u300b\u9610\u8ff0\u3002"))),Object(o.b)("h2",{id:"915-\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32"},"9.1.5 \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32"),Object(o.b)("p",null,Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u591a\u79cd\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u65b9\u5f0f\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e\uff1a",Object(o.b)("inlineCode",{parentName:"li"},'AddSqlServerPool("\u8fde\u63a5\u5b57\u7b26\u4e32")')," \u65b9\u5f0f"),Object(o.b)("li",{parentName:"ul"},"\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"li"},'[AppDbContext("\u8fde\u63a5\u5b57\u7b26\u4e32/Key")]')," \u7279\u6027\u65b9\u5f0f\uff08\u53ea\u5728 ",Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext \u5b9e\u73b0\u7c7b\u6709\u6548"),"\uff09",Object(o.b)("strong",{parentName:"li"},"\u63a8\u8350")),Object(o.b)("li",{parentName:"ul"},"\u901a\u8fc7\u91cd\u5199 ",Object(o.b)("inlineCode",{parentName:"li"},"OnConfiguring(DbContextOptionsBuilder optionsBuilder)")," \u914d\u7f6e")),Object(o.b)("h3",{id:"9151-\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e"},"9.1.5.1 \u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{12-19} title="Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"',"{12-19}":!0,title:'"Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"'}),'using Fur.DependencyInjection;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n // \u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u652f\u6301N\u4e2a\u6570\u636e\u5e93\n services.AddDatabaseAccessor(options =>\n {\n // \u914d\u7f6e\u9ed8\u8ba4\u6570\u636e\u5e93\n options.AddDbPool(DbProvider.SqlServer, "\u8fde\u63a5\u5b57\u7b26\u4e32");\n\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\n options.AddDbPool(DbProvider.Sqlite, "\u8fde\u63a5\u5b57\u7b26\u4e32");\n });\n }\n }\n}\n')),Object(o.b)("h3",{id:"9152-appdbcontext-\u65b9\u5f0f\u914d\u7f6e"},"9.1.5.2 ",Object(o.b)("inlineCode",{parentName:"h3"},"[AppDbContext]")," \u65b9\u5f0f\u914d\u7f6e"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6}","{1,6}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("DbConnectionString")] // \u652f\u6301 `appsetting.json` \u540d\u6216 \u8fde\u63a5\u5b57\u7b26\u4e32\n public class FurDbContext : AppDbContext\n {\n /// \n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\n /// \n /// \n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(o.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u63d0\u793a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u63a8\u8350\u4f7f\u7528\u6b64\u65b9\u5f0f\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u3002"))),Object(o.b)("p",null,Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"[AppDbContext]"))," \u5185\u7f6e\u5c5e\u6027\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"ConnectionString"),"\uff1a\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u6216\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u8def\u5f84\uff08\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e\u67e5\u627e\uff09\uff0c\u6216 ",Object(o.b)("inlineCode",{parentName:"li"},"appsetting.json")," \u7684 ",Object(o.b)("inlineCode",{parentName:"li"},"ConnectionStrings")," \u914d\u7f6e\u5b57\u7b26\u4e32"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"TablePrefix"),"\uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u8868\u7edf\u4e00\u524d\u7f00"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"TableSuffix"),"\uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u8868\u7edf\u4e00\u540e\u7f00")),Object(o.b)("h3",{id:"9153-onconfiguring-\u65b9\u5f0f\u914d\u7f6e"},"9.1.5.3 ",Object(o.b)("inlineCode",{parentName:"h3"},"OnConfiguring")," \u65b9\u5f0f\u914d\u7f6e"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{16-20}","{16-20}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n public class FurDbContext : AppDbContext\n {\n /// \n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\n /// \n /// \n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)\n {\n base.OnConfiguring(optionsBuilder);\n\n optionsBuilder.UseSqlServer("\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32");\n }\n }\n}\n')),Object(o.b)("div",{className:"admonition admonition-important alert alert--info"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u8fd9\u4e09\u79cd\u65b9\u5f0f\u53ef\u4ee5\u540c\u65f6\u4f7f\u7528\uff0c\u4f46\u662f\u6709\u4f18\u5148\u7ea7\uff1a",Object(o.b)("inlineCode",{parentName:"p"},"[AppDbContext]")," -> ",Object(o.b)("inlineCode",{parentName:"p"},"\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e")," -> ",Object(o.b)("inlineCode",{parentName:"p"},"OnConfiguring"),"\uff08\u4f4e\u5230\u9ad8\uff09"),Object(o.b)("p",{parentName:"div"},"\u4e5f\u5c31\u662f ",Object(o.b)("inlineCode",{parentName:"p"},"OnConfiguring")," \u914d\u7f6e\u4f1a\u8986\u76d6 ",Object(o.b)("inlineCode",{parentName:"p"},"\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e")," \u914d\u7f6e\uff0c",Object(o.b)("inlineCode",{parentName:"p"},"\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e")," \u914d\u7f6e\u4f1a\u8986\u76d6 ",Object(o.b)("inlineCode",{parentName:"p"},"[AppDbContext]")," \u914d\u7f6e\u6240\u914d\u7f6e\u7684\u8fde\u63a5\u5b57\u7b26\u4e32\u3002"))),Object(o.b)("h2",{id:"916-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e"},"9.1.6 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e"),Object(o.b)("div",{className:"admonition admonition-important alert alert--info"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u9700\u5b9a\u4e49\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u4e2d\uff0c\u4e14\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u90fd\u5fc5\u987b\u62e5\u6709\u552f\u4e00\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"DbContextLocator")," \u5b9a\u4f4d\u5668"))),Object(o.b)("h2",{id:"917-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c"},"9.1.7 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c"),Object(o.b)("p",null,"\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u914d\u7f6e\u597d\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u540e\uff0c\u9700\u8981\u6ce8\u518c\u8be5\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u5e76\u6307\u5b9a\u6570\u636e\u5e93\u7c7b\u578b\uff0c\u5982\uff1a"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11-13} title="Fur\\framework\\Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"',"{11-13}":!0,title:'"Fur\\framework\\Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"'}),"using Fur.DatabaseAccessor;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n options.AddDbPool(DbProvider.Sqlite);\n });\n }\n }\n}\n")),Object(o.b)("p",null,"\u5982\u679c\u6709\u591a\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\uff0c",Object(o.b)("strong",{parentName:"p"},"\u90a3\u4e48\u4ece\u7b2c\u4e8c\u4e2a\u8d77\uff0c\u5c31\u9700\u8981\u7ed1\u5b9a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668"),"\uff0c\u5982\uff1a"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"options.AddDbPool(DbProvider.Sqlite); // \u7b2c\u4e00\u4e2a\u6570\u636e\u5e93\n\noptions.AddDbPool(DbProvider.SqlServer); // \u7b2c\u4e8c\u4e2a\u6570\u636e\u5e93\n\noptions.AddDbPool(DbProvider.SqlServer); // \u7b2c\u4e09\u4e2a\u6570\u636e\u5e93\n")),Object(o.b)("h2",{id:"918-\u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61"},"9.1.8 \u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61"),Object(o.b)("p",null,"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u662f\u5b9a\u4e49\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u9879\u76ee\u5c42\uff0c\u5e76\u4e14\u8be5\u5c42\u4e0d\u88ab ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.Application")," \u548c ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.Core")," \u7b49\u5c42\u5f15\u7528\u3002"),Object(o.b)("p",null,"\u6240\u4ee5\u5c31\u4e0d\u80fd\u76f4\u63a5\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.Application")," \u9879\u76ee\u5c42\u76f4\u63a5\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u5b9a\u4e49\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u3002"),Object(o.b)("p",null,Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u63d0\u4f9b\u4e86\u4e24\u79cd\u65b9\u5f0f\u5904\u7406\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"respository.DbContext")," \uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61\uff0c\u8fd4\u56de\u662f ",Object(o.b)("inlineCode",{parentName:"li"},"DbContext")," \u62bd\u8c61\u7c7b\u578b"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"respository.DynamicDbContext"),"\uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61\uff0c\u8fd4\u56de\u7684\u662f ",Object(o.b)("inlineCode",{parentName:"li"},"dynamic")," \u7c7b\u578b")),Object(o.b)("p",null,"\u5982\u679c\u4f60\u53ea\u662f\u60f3\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"DbContext")," \u7684\u529f\u80fd\uff0c\u76f4\u63a5\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"respository.DbContext")," \u5373\u53ef\uff0c\u5982\uff1a"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"respository.DbContext.SaveChanges();\n")),Object(o.b)("p",null,"\u5982\u679c\u4f60\u60f3\u80fd\u591f\u83b7\u53d6\u5177\u4f53\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u7c7b\u578b\uff0c\u5982 ",Object(o.b)("inlineCode",{parentName:"p"},"MyDbContext"),"\uff0c\u90a3\u4e48\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"respository.DynamicDbContext")," \u5c31\u53ef\u4ee5\u83b7\u53d6\u5230\u5177\u4f53\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"MyDbContext")," \u7c7b\u578b\u3002\u5982\uff1a"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var persons = respository.DynamicDbContext.Persons.Find(1);\nvar users = respository.DynamicDbContext.Users;\n")),Object(o.b)("p",null,"\u8fd9\u6837\u5c31\u53ef\u4ee5\u76f4\u63a5\u64cd\u4f5c ",Object(o.b)("inlineCode",{parentName:"p"},"MyDbContext")," \u5b9a\u4e49\u7684\u5c5e\u6027\u548c\u65b9\u6cd5\u4e86\u3002"),Object(o.b)("h2",{id:"919-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.1.9 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(o.b)("hr",null),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(o.b)("inlineCode",{parentName:"p"},"\u6570\u636e\u5e93\u4e0a\u4e0b\u6587")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/ef/core/miscellaneous/configuring-dbcontext"}),"EF Core - \u914d\u7f6e DbContext")," \u7ae0\u8282\u3002"))))}l.isMDXComponent=!0}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[24],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return O}));var a=n(0),i=n.n(a);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function b(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=i.a.createContext({}),l=function(e){var t=i.a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):b(b({},t),e)),n},s=function(e){var t=l(e.components);return i.a.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.a.createElement(i.a.Fragment,{},t)}},m=i.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,r=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),s=l(n),m=a,O=s["".concat(r,".").concat(m)]||s[m]||d[m]||o;return n?i.a.createElement(O,b(b({ref:t},p),{},{components:n})):i.a.createElement(O,b({ref:t},p))}));function O(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=m;var b={};for(var c in t)hasOwnProperty.call(t,c)&&(b[c]=t[c]);b.originalType=e,b.mdxType="string"==typeof e?e:a,r[1]=b;for(var p=2;pAppDbContext",id:"912-appdbcontext",children:[]},{value:"9.1.3 AppDbContext \u548c DbContext \u533a\u522b",id:"913-appdbcontext-\u548c-dbcontext-\u533a\u522b",children:[]},{value:"9.1.4 \u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"914-\u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[{value:"9.1.4.1 \u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"9141-\u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"9.1.4.2 \u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"9142-\u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]}]},{value:"9.1.5 \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32",id:"915-\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32",children:[{value:"9.1.5.1 \u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e",id:"9151-\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e",children:[]},{value:"9.1.5.2 [AppDbContext] \u65b9\u5f0f\u914d\u7f6e",id:"9152-appdbcontext-\u65b9\u5f0f\u914d\u7f6e",children:[]},{value:"9.1.5.3 OnConfiguring \u65b9\u5f0f\u914d\u7f6e",id:"9153-onconfiguring-\u65b9\u5f0f\u914d\u7f6e",children:[]}]},{value:"9.1.6 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e",id:"916-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e",children:[]},{value:"9.1.7 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c",id:"917-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c",children:[]},{value:"9.1.8 \u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61",id:"918-\u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61",children:[]},{value:"9.1.9 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"919-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],p={rightToc:c};function l(e){var t=e.components,n=Object(i.a)(e,["components"]);return Object(o.b)("wrapper",Object(a.a)({},p,n,{components:t,mdxType:"MDXLayout"}),Object(o.b)("h2",{id:"911-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.1.1 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(o.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u662f\u8d1f\u8d23\u548c\u6570\u636e\u5e93\u4ea4\u4e92\u7684\u5bf9\u8c61\uff0c\u63d0\u4f9b\u7a0b\u5e8f\u5bf9\u6570\u636e\u5e93\u5b58\u53d6\u63d0\u4f9b\u4e86\u5927\u91cf\u7684\u65b9\u6cd5\u3002"),Object(o.b)("p",null,"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u9ed8\u8ba4\u96c6\u6210\u4e86\u5fae\u8f6f\u4eb2\u513f\u5b50\uff1a",Object(o.b)("inlineCode",{parentName:"p"},"EntityFramework Core")," \uff0c\u4e5f\u5c31\u662f\u901a\u5e38\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6307\u7684\u662f ",Object(o.b)("inlineCode",{parentName:"p"},"DbContext")," \u7c7b\u6216\u5b83\u7684\u5b9e\u73b0\u7c7b\u3002"),Object(o.b)("h2",{id:"912-appdbcontext"},"9.1.2 ",Object(o.b)("inlineCode",{parentName:"h2"},"AppDbContext")),Object(o.b)("p",null,"\u5728\u6211\u4eec\u5b9e\u9645\u9879\u76ee\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"EFCore")," \u63d0\u4f9b\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"DbContext")," \u64cd\u4f5c\u5bf9\u8c61\u64cd\u4f5c\u6570\u636e\u5e93\u6709\u4e9b\u7e41\u7410\u548c\u590d\u6742\uff0c\u4e14\u9ed8\u8ba4\u4e0d\u5177\u5907\u8bfb\u5199\u5206\u79bb\u3001\u591a\u5e93\u7b49\u64cd\u4f5c\u529f\u80fd\u3002"),Object(o.b)("p",null,"\u6240\u4ee5\uff0c",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86 ",Object(o.b)("inlineCode",{parentName:"p"},"AppDbContext")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u8be5\u4e0a\u4e0b\u6587\u7ee7\u627f\u81ea ",Object(o.b)("inlineCode",{parentName:"p"},"DbContext"),"\u3002"),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u540e\u7eed\u7ae0\u8282\uff0c\u7686\u91c7\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"EFCore")," \u4ee3\u66ff ",Object(o.b)("inlineCode",{parentName:"p"},"EntityFramework Core"),"\u3002"))),Object(o.b)("h2",{id:"913-appdbcontext-\u548c-dbcontext-\u533a\u522b"},"9.1.3 ",Object(o.b)("inlineCode",{parentName:"h2"},"AppDbContext")," \u548c ",Object(o.b)("inlineCode",{parentName:"h2"},"DbContext")," \u533a\u522b"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u7ee7\u627f\u81ea ",Object(o.b)("inlineCode",{parentName:"li"},"DbContext"),"\uff0c\u5177\u5907 ",Object(o.b)("inlineCode",{parentName:"li"},"DbContext")," \u6240\u6709\u529f\u80fd\u3002"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u652f\u6301\u591a\u6570\u636e\u5e93\u64cd\u4f5c\u6cdb\u578b\u7248\u672c\uff0c\u5982\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u81ea\u52a8\u914d\u7f6e\u5b9e\u4f53\u4fe1\u606f\uff0c\u65e0\u9700\u5728 ",Object(o.b)("inlineCode",{parentName:"li"},"OnModelCreating")," \u4e2d\u914d\u7f6e"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u652f\u6301\u5185\u7f6e\u591a\u79df\u6237\u652f\u6301"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u652f\u6301\u5168\u5c40\u6a21\u578b\u914d\u7f6e\u62e6\u622a\u5668"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u652f\u6301\u6570\u636e\u63d0\u4ea4\u66f4\u6539\u591a\u4e2a\u4e8b\u4ef6"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u63d0\u4f9b\u66f4\u52a0\u5f3a\u5927\u7684\u6a21\u578b\u64cd\u4f5c\u80fd\u529b\uff0c\u5982\u679c ",Object(o.b)("inlineCode",{parentName:"li"},"Sql")," \u64cd\u4f5c\uff0c\u8bfb\u5199\u5206\u79bb\u7b49"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u80fd\u591f\u5f97\u5230 ",Object(o.b)("inlineCode",{parentName:"li"},"Fur")," \u6846\u67b6\u66f4\u591a\u7684\u529f\u80fd\u652f\u6301")),Object(o.b)("h2",{id:"914-\u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.1.4 \u5982\u4f55\u5b9a\u4e49\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(o.b)("p",null,"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\u4e86\uff0c\u63d0\u4f9b\u4e86\u4e24\u79cd ",Object(o.b)("inlineCode",{parentName:"p"},"AppDbContext")," \u5b9a\u4e49\u65b9\u5f0f\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u64cd\u4f5c\u9ed8\u8ba4\u6570\u636e\u5e93"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext")," \u64cd\u4f5c N \u4e2a\u6570\u636e\u5e93")),Object(o.b)("p",null,"\u5176\u4e2d ",Object(o.b)("inlineCode",{parentName:"p"},"AppDbContext")," \u9ed8\u8ba4\u7ee7\u627f\u81ea ",Object(o.b)("inlineCode",{parentName:"p"},"AppDbContext"),"\u3002"),Object(o.b)("p",null,"\u4e0b\u9762\u662f\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u521b\u5efa\u7684\u591a\u4e2a\u4f8b\u5b50\uff1a"),Object(o.b)("h3",{id:"9141-\u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.1.4.1 \u521b\u5efa\u9ed8\u8ba4\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,12}","{1,6,12}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("\u8fde\u63a5\u5b57\u7b26\u4e32\u6216appsetting.json \u952e")]\n public class FurDbContext : AppDbContext // \u7ee7\u627f AppDbContext<> \u7c7b\n {\n /// \n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\n /// \n /// \n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(o.b)("h3",{id:"9142-\u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.1.4.2 \u521b\u5efa\u5176\u4ed6\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,12}","{1,6,12}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("\u8fde\u63a5\u5b57\u7b26\u4e32\u6216appsetting.json \u952e")]\n public class FurOtherDbContext : AppDbContext // \u7ee7\u627f AppDbContext<> \u7c7b\n {\n /// \n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\n /// \n /// \n public FurOtherDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(o.b)("div",{className:"admonition admonition-important alert alert--info"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u6240\u6709\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u90fd\u5e94\u8be5\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u9879\u76ee\u4e2d\u521b\u5efa\u3002\u5173\u4e8e ",Object(o.b)("inlineCode",{parentName:"p"},"TDbContextLocator")," \u5c06\u5728\u4e0b\u4e00\u7ae0\u8282 \u300a",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"dbcontext-locator"}),"9.2 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668"),"\u300b\u9610\u8ff0\u3002"))),Object(o.b)("h2",{id:"915-\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32"},"9.1.5 \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32"),Object(o.b)("p",null,Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u591a\u79cd\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u914d\u7f6e\u65b9\u5f0f\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e\uff1a",Object(o.b)("inlineCode",{parentName:"li"},'AddSqlServerPool("\u8fde\u63a5\u5b57\u7b26\u4e32")')," \u65b9\u5f0f"),Object(o.b)("li",{parentName:"ul"},"\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"li"},'[AppDbContext("\u8fde\u63a5\u5b57\u7b26\u4e32/Key")]')," \u7279\u6027\u65b9\u5f0f\uff08\u53ea\u5728 ",Object(o.b)("inlineCode",{parentName:"li"},"AppDbContext \u5b9e\u73b0\u7c7b\u6709\u6548"),"\uff09",Object(o.b)("strong",{parentName:"li"},"\u63a8\u8350")),Object(o.b)("li",{parentName:"ul"},"\u901a\u8fc7\u91cd\u5199 ",Object(o.b)("inlineCode",{parentName:"li"},"OnConfiguring(DbContextOptionsBuilder optionsBuilder)")," \u914d\u7f6e")),Object(o.b)("h3",{id:"9151-\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e"},"9.1.5.1 \u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{12-19} title="Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"',"{12-19}":!0,title:'"Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"'}),'using Fur.DependencyInjection;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n // \u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u652f\u6301N\u4e2a\u6570\u636e\u5e93\n services.AddDatabaseAccessor(options =>\n {\n // \u914d\u7f6e\u9ed8\u8ba4\u6570\u636e\u5e93\n options.AddDbPool(DbProvider.SqlServer, "\u8fde\u63a5\u5b57\u7b26\u4e32");\n\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\n options.AddDbPool(DbProvider.Sqlite, "\u8fde\u63a5\u5b57\u7b26\u4e32");\n });\n }\n }\n}\n')),Object(o.b)("h3",{id:"9152-appdbcontext-\u65b9\u5f0f\u914d\u7f6e"},"9.1.5.2 ",Object(o.b)("inlineCode",{parentName:"h3"},"[AppDbContext]")," \u65b9\u5f0f\u914d\u7f6e"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6}","{1,6}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("DbConnectionString")] // \u652f\u6301 `appsetting.json` \u540d\u6216 \u8fde\u63a5\u5b57\u7b26\u4e32\n public class FurDbContext : AppDbContext\n {\n /// \n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\n /// \n /// \n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(o.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u63d0\u793a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u63a8\u8350\u4f7f\u7528\u6b64\u65b9\u5f0f\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u3002"))),Object(o.b)("p",null,Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"[AppDbContext]"))," \u5185\u7f6e\u5c5e\u6027\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"ConnectionString"),"\uff1a\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u6216\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u8def\u5f84\uff08\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e\u67e5\u627e\uff09\uff0c\u6216 ",Object(o.b)("inlineCode",{parentName:"li"},"appsetting.json")," \u7684 ",Object(o.b)("inlineCode",{parentName:"li"},"ConnectionStrings")," \u914d\u7f6e\u5b57\u7b26\u4e32"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"TablePrefix"),"\uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u8868\u7edf\u4e00\u524d\u7f00"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"TableSuffix"),"\uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u8868\u7edf\u4e00\u540e\u7f00")),Object(o.b)("h3",{id:"9153-onconfiguring-\u65b9\u5f0f\u914d\u7f6e"},"9.1.5.3 ",Object(o.b)("inlineCode",{parentName:"h3"},"OnConfiguring")," \u65b9\u5f0f\u914d\u7f6e"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{16-20}","{16-20}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n public class FurDbContext : AppDbContext\n {\n /// \n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\n /// \n /// \n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)\n {\n base.OnConfiguring(optionsBuilder);\n\n optionsBuilder.UseSqlServer("\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32");\n }\n }\n}\n')),Object(o.b)("div",{className:"admonition admonition-important alert alert--info"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u8fd9\u4e09\u79cd\u65b9\u5f0f\u53ef\u4ee5\u540c\u65f6\u4f7f\u7528\uff0c\u4f46\u662f\u6709\u4f18\u5148\u7ea7\uff1a",Object(o.b)("inlineCode",{parentName:"p"},"[AppDbContext]")," -> ",Object(o.b)("inlineCode",{parentName:"p"},"\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e")," -> ",Object(o.b)("inlineCode",{parentName:"p"},"OnConfiguring"),"\uff08\u4f4e\u5230\u9ad8\uff09"),Object(o.b)("p",{parentName:"div"},"\u4e5f\u5c31\u662f ",Object(o.b)("inlineCode",{parentName:"p"},"OnConfiguring")," \u914d\u7f6e\u4f1a\u8986\u76d6 ",Object(o.b)("inlineCode",{parentName:"p"},"\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e")," \u914d\u7f6e\uff0c",Object(o.b)("inlineCode",{parentName:"p"},"\u5728\u6ce8\u518c\u6570\u636e\u5e93\u670d\u52a1\u65f6\u914d\u7f6e")," \u914d\u7f6e\u4f1a\u8986\u76d6 ",Object(o.b)("inlineCode",{parentName:"p"},"[AppDbContext]")," \u914d\u7f6e\u6240\u914d\u7f6e\u7684\u8fde\u63a5\u5b57\u7b26\u4e32\u3002"))),Object(o.b)("h2",{id:"916-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e"},"9.1.6 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4e49\u4f4d\u7f6e"),Object(o.b)("div",{className:"admonition admonition-important alert alert--info"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u9700\u5b9a\u4e49\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u4e2d\uff0c\u4e14\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u90fd\u5fc5\u987b\u62e5\u6709\u552f\u4e00\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"DbContextLocator")," \u5b9a\u4f4d\u5668"))),Object(o.b)("h2",{id:"917-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c"},"9.1.7 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u6ce8\u518c"),Object(o.b)("p",null,"\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u914d\u7f6e\u597d\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\u540e\uff0c\u9700\u8981\u6ce8\u518c\u8be5\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u5e76\u6307\u5b9a\u6570\u636e\u5e93\u7c7b\u578b\uff0c\u5982\uff1a"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11-13} title="Fur\\framework\\Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"',"{11-13}":!0,title:'"Fur\\framework\\Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"'}),"using Fur.DatabaseAccessor;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n options.AddDbPool(DbProvider.Sqlite);\n });\n }\n }\n}\n")),Object(o.b)("p",null,"\u5982\u679c\u6709\u591a\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\uff0c",Object(o.b)("strong",{parentName:"p"},"\u90a3\u4e48\u4ece\u7b2c\u4e8c\u4e2a\u8d77\uff0c\u5c31\u9700\u8981\u7ed1\u5b9a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668"),"\uff0c\u5982\uff1a"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"options.AddDbPool(DbProvider.Sqlite); // \u7b2c\u4e00\u4e2a\u6570\u636e\u5e93\n\noptions.AddDbPool(DbProvider.SqlServer); // \u7b2c\u4e8c\u4e2a\u6570\u636e\u5e93\n\noptions.AddDbPool(DbProvider.SqlServer); // \u7b2c\u4e09\u4e2a\u6570\u636e\u5e93\n")),Object(o.b)("h2",{id:"918-\u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61"},"9.1.8 \u52a8\u6001\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61"),Object(o.b)("p",null,"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u662f\u5b9a\u4e49\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u9879\u76ee\u5c42\uff0c\u5e76\u4e14\u8be5\u5c42\u4e0d\u88ab ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.Application")," \u548c ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.Core")," \u7b49\u5c42\u5f15\u7528\u3002"),Object(o.b)("p",null,"\u6240\u4ee5\u5c31\u4e0d\u80fd\u76f4\u63a5\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.Application")," \u9879\u76ee\u5c42\u76f4\u63a5\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u5b9a\u4e49\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u3002"),Object(o.b)("p",null,Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u63d0\u4f9b\u4e86\u4e24\u79cd\u65b9\u5f0f\u5904\u7406\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"respository.DbContext")," \uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61\uff0c\u8fd4\u56de\u662f ",Object(o.b)("inlineCode",{parentName:"li"},"DbContext")," \u62bd\u8c61\u7c7b\u578b"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"respository.DynamicDbContext"),"\uff1a\u5f53\u524d\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5bf9\u8c61\uff0c\u8fd4\u56de\u7684\u662f ",Object(o.b)("inlineCode",{parentName:"li"},"dynamic")," \u7c7b\u578b")),Object(o.b)("p",null,"\u5982\u679c\u4f60\u53ea\u662f\u60f3\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"DbContext")," \u7684\u529f\u80fd\uff0c\u76f4\u63a5\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"respository.DbContext")," \u5373\u53ef\uff0c\u5982\uff1a"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"respository.DbContext.SaveChanges();\n")),Object(o.b)("p",null,"\u5982\u679c\u4f60\u60f3\u80fd\u591f\u83b7\u53d6\u5177\u4f53\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u7c7b\u578b\uff0c\u5982 ",Object(o.b)("inlineCode",{parentName:"p"},"MyDbContext"),"\uff0c\u90a3\u4e48\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"respository.DynamicDbContext")," \u5c31\u53ef\u4ee5\u83b7\u53d6\u5230\u5177\u4f53\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"MyDbContext")," \u7c7b\u578b\u3002\u5982\uff1a"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var persons = respository.DynamicDbContext.Persons.Find(1);\nvar users = respository.DynamicDbContext.Users;\n")),Object(o.b)("p",null,"\u8fd9\u6837\u5c31\u53ef\u4ee5\u76f4\u63a5\u64cd\u4f5c ",Object(o.b)("inlineCode",{parentName:"p"},"MyDbContext")," \u5b9a\u4e49\u7684\u5c5e\u6027\u548c\u65b9\u6cd5\u4e86\u3002"),Object(o.b)("h2",{id:"919-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.1.9 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(o.b)("hr",null),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(o.b)("inlineCode",{parentName:"p"},"\u6570\u636e\u5e93\u4e0a\u4e0b\u6587")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/ef/core/miscellaneous/configuring-dbcontext"}),"EF Core - \u914d\u7f6e DbContext")," \u7ae0\u8282\u3002"))))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/404.html b/docs/404.html index 66fdaa17083..dd2a936bbc1 100644 --- a/docs/404.html +++ b/docs/404.html @@ -5,15 +5,15 @@ Page Not Found | Fur - - - + + +

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- - - + + + \ No newline at end of file diff --git a/docs/408ae89d.0e87c449.js b/docs/408ae89d.edc822b6.js similarity index 99% rename from docs/408ae89d.0e87c449.js rename to docs/408ae89d.edc822b6.js index 71eecbfb948..4ecc6a2c477 100644 --- a/docs/408ae89d.0e87c449.js +++ b/docs/408ae89d.edc822b6.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[25],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return p})),t.d(n,"b",(function(){return u}));var a=t(0),r=t.n(a);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var b=r.a.createContext({}),l=function(e){var n=r.a.useContext(b),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},p=function(e){var n=l(e.components);return r.a.createElement(b.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},m=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,b=s(e,["components","mdxType","originalType","parentName"]),p=l(t),m=a,u=p["".concat(c,".").concat(m)]||p[m]||d[m]||i;return t?r.a.createElement(u,o(o({ref:n},b),{},{components:t})):r.a.createElement(u,o({ref:n},b))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,c=new Array(i);c[0]=m;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o.mdxType="string"==typeof e?e:a,c[1]=o;for(var b=2;bSQL",id:"91221-\u521b\u5efa\u89c6\u56fe-sql",children:[]},{value:"9.12.2.2 \u89c6\u56fe\u6a21\u578b",id:"91222-\u89c6\u56fe\u6a21\u578b",children:[]}]},{value:"9.12.3 \u89c6\u56fe\u4f7f\u7528",id:"9123-\u89c6\u56fe\u4f7f\u7528",children:[]},{value:"9.12.4 \u89c6\u56fe\u6700\u4f73\u8bfb\u53d6\u65b9\u5f0f \u2714",id:"9124-\u89c6\u56fe\u6700\u4f73\u8bfb\u53d6\u65b9\u5f0f-",children:[]},{value:"9.12.5 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9125-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],b={rightToc:s};function l(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(a.a)({},b,t,{components:n,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"9121-\u5173\u4e8e\u89c6\u56fe"},"9.12.1 \u5173\u4e8e\u89c6\u56fe"),Object(i.b)("p",null,"\u89c6\u56fe\u662f\u6570\u636e\u5e93\u4e2d\u975e\u5e38\u91cd\u8981\u7684\u5bf9\u8c61\uff0c\u662f\u4e00\u5f20\u865a\u62df\u8868\uff0c\u901a\u8fc7\u89c6\u56fe\u6211\u4eec\u53ef\u4ee5\u5bf9\u7ed3\u679c\u8fdb\u884c\u7b5b\u9009\u7f13\u5b58\uff0c\u540c\u65f6\u8fd8\u80fd\u5b9e\u73b0\u9897\u7c92\u5316\u6743\u9650\u63a7\u5236\uff0c\u5982\u63a7\u5236\u6307\u5b9a\u884c\uff0c\u6307\u5b9a\u5217\u3002"),Object(i.b)("h2",{id:"9122-\u89c6\u56fe\u7684\u4f7f\u7528"},"9.12.2 \u89c6\u56fe\u7684\u4f7f\u7528"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u4e2d\u5b9e\u73b0\u89c6\u56fe\u7684\u64cd\u4f5c\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u521b\u5efa\u89c6\u56fe\u6a21\u578b\uff0c\u5e76\u7ee7\u627f ",Object(i.b)("inlineCode",{parentName:"p"},"EntityNotKey")," \u57fa\u7c7b\u5373\u53ef\u3002\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(i.b)("h3",{id:"91221-\u521b\u5efa\u89c6\u56fe-sql"},"9.12.2.1 \u521b\u5efa\u89c6\u56fe ",Object(i.b)("inlineCode",{parentName:"h3"},"SQL")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"CREATE VIEW V_Person AS\nSELECT Id,Name,Age,Address FROM person\n")),Object(i.b)("h3",{id:"91222-\u89c6\u56fe\u6a21\u578b"},"9.12.2.2 \u89c6\u56fe\u6a21\u578b"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,10}","{5,10}":!0}),'using Fur.DatabaseAccessor;\n\nnamespace Fur.Core\n{\n public class V_Person : EntityNotKey\n {\n /// \n /// \u914d\u7f6e\u89c6\u56fe\u540d\n /// \n public V_Person() : base("V_Person")\n {\n }\n\n /// \n /// \u4e3b\u952eId\n /// \n public int Id { get; set; }\n\n /// \n /// \u59d3\u540d\n /// \n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n\n /// \n /// \u4f4f\u5740\n /// \n public string Address { get; set; }\n }\n}\n')),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u89c6\u56fe\u540d\u79f0")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u89c6\u56fe\u5b9e\u4f53\u53ea\u9700\u8981\u7ee7\u627f ",Object(i.b)("inlineCode",{parentName:"p"},"EntityNotKey")," \u57fa\u7c7b\u5e76\u7f16\u5199\u65e0\u53c2\u6784\u9020\u51fd\u6570\u7ee7\u627f ",Object(i.b)("inlineCode",{parentName:"p"},'base("\u89c6\u56fe\u540d\u79f0")')," \u5373\u53ef\u3002"))),Object(i.b)("h2",{id:"9123-\u89c6\u56fe\u4f7f\u7528"},"9.12.3 \u89c6\u56fe\u4f7f\u7528"),Object(i.b)("p",null,"\u89c6\u56fe\u9664\u4e86\u4e0d\u80fd\u64cd\u4f5c\uff08\u5199\uff09\u4ee5\u5916\uff0c\u5176\u4ed6\u64cd\u4f5c\u548c\u8868\u64cd\u4f5c\u65e0\u5f02\u3002"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var vEntities = v_repository.Where(u => u.Id >10).ToList();\n")),Object(i.b)("h2",{id:"9124-\u89c6\u56fe\u6700\u4f73\u8bfb\u53d6\u65b9\u5f0f-"},"9.12.4 \u89c6\u56fe\u6700\u4f73\u8bfb\u53d6\u65b9\u5f0f \u2714"),Object(i.b)("p",null,"\u7531\u4e8e\u89c6\u56fe\u662f\u865a\u62df\u8868\uff0c\u4e0d\u5e94\u8be5\u5bf9\u5176\u8fdb\u884c\u5199\u64cd\u4f5c\uff0c\u6240\u4ee5\u5e94\u8be5\u91c7\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"\u53ea\u8bfb\u4ed3\u50a8\u521d\u59cb\u5316\u89c6\u56fe"),"\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{11,13,16}","{11,13,16}":!0}),"using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DynamicApiController;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nnamespace Fur.Application.Persons\n{\n public class FurService : IDynamicApiController\n {\n private readonly IReadableRepository _readableRepository;\n\n public FurService(IRepository repository)\n {\n // \u521d\u59cb\u5316\u53ea\u8bfb\u4ed3\u50a8\n _readableRepository = repository.Constraint>();\n }\n\n /// \n /// \u8bfb\u53d6\u89c6\u56fe\n /// \n /// \n public async Task> GetVPerson()\n {\n var list = await _readableRepository.AsAsyncEnumerable();\n return list;\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u901a\u8fc7 ",Object(i.b)("inlineCode",{parentName:"p"},".Constraint")," \u65b9\u6cd5\u53ef\u4ee5\u5c06\u4ed3\u50a8\u7ea6\u675f\u4e3a\u7279\u5b9a\u4ed3\u50a8\uff0c\u5982\u53ea\u8bfb\u4ed3\u50a8\uff0c\u53ef\u8bfb\u53ef\u5199\u4ed3\u50a8\uff0c\u53ea\u65b0\u589e\u4ed3\u50a8\u7b49\u3002"))),Object(i.b)("h2",{id:"9125-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.12.5 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}l.isMDXComponent=!0}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[25],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return p})),t.d(n,"b",(function(){return u}));var a=t(0),r=t.n(a);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var b=r.a.createContext({}),l=function(e){var n=r.a.useContext(b),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},p=function(e){var n=l(e.components);return r.a.createElement(b.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},m=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,b=s(e,["components","mdxType","originalType","parentName"]),p=l(t),m=a,u=p["".concat(c,".").concat(m)]||p[m]||d[m]||i;return t?r.a.createElement(u,o(o({ref:n},b),{},{components:t})):r.a.createElement(u,o({ref:n},b))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,c=new Array(i);c[0]=m;var o={};for(var s in n)hasOwnProperty.call(n,s)&&(o[s]=n[s]);o.originalType=e,o.mdxType="string"==typeof e?e:a,c[1]=o;for(var b=2;bSQL",id:"91221-\u521b\u5efa\u89c6\u56fe-sql",children:[]},{value:"9.12.2.2 \u89c6\u56fe\u6a21\u578b",id:"91222-\u89c6\u56fe\u6a21\u578b",children:[]}]},{value:"9.12.3 \u89c6\u56fe\u4f7f\u7528",id:"9123-\u89c6\u56fe\u4f7f\u7528",children:[]},{value:"9.12.4 \u89c6\u56fe\u6700\u4f73\u8bfb\u53d6\u65b9\u5f0f \u2714",id:"9124-\u89c6\u56fe\u6700\u4f73\u8bfb\u53d6\u65b9\u5f0f-",children:[]},{value:"9.12.5 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9125-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],b={rightToc:s};function l(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(a.a)({},b,t,{components:n,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"9121-\u5173\u4e8e\u89c6\u56fe"},"9.12.1 \u5173\u4e8e\u89c6\u56fe"),Object(i.b)("p",null,"\u89c6\u56fe\u662f\u6570\u636e\u5e93\u4e2d\u975e\u5e38\u91cd\u8981\u7684\u5bf9\u8c61\uff0c\u662f\u4e00\u5f20\u865a\u62df\u8868\uff0c\u901a\u8fc7\u89c6\u56fe\u6211\u4eec\u53ef\u4ee5\u5bf9\u7ed3\u679c\u8fdb\u884c\u7b5b\u9009\u7f13\u5b58\uff0c\u540c\u65f6\u8fd8\u80fd\u5b9e\u73b0\u9897\u7c92\u5316\u6743\u9650\u63a7\u5236\uff0c\u5982\u63a7\u5236\u6307\u5b9a\u884c\uff0c\u6307\u5b9a\u5217\u3002"),Object(i.b)("h2",{id:"9122-\u89c6\u56fe\u7684\u4f7f\u7528"},"9.12.2 \u89c6\u56fe\u7684\u4f7f\u7528"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u4e2d\u5b9e\u73b0\u89c6\u56fe\u7684\u64cd\u4f5c\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u521b\u5efa\u89c6\u56fe\u6a21\u578b\uff0c\u5e76\u7ee7\u627f ",Object(i.b)("inlineCode",{parentName:"p"},"EntityNotKey")," \u57fa\u7c7b\u5373\u53ef\u3002\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(i.b)("h3",{id:"91221-\u521b\u5efa\u89c6\u56fe-sql"},"9.12.2.1 \u521b\u5efa\u89c6\u56fe ",Object(i.b)("inlineCode",{parentName:"h3"},"SQL")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"CREATE VIEW V_Person AS\nSELECT Id,Name,Age,Address FROM person\n")),Object(i.b)("h3",{id:"91222-\u89c6\u56fe\u6a21\u578b"},"9.12.2.2 \u89c6\u56fe\u6a21\u578b"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,10}","{5,10}":!0}),'using Fur.DatabaseAccessor;\n\nnamespace Fur.Core\n{\n public class V_Person : EntityNotKey\n {\n /// \n /// \u914d\u7f6e\u89c6\u56fe\u540d\n /// \n public V_Person() : base("V_Person")\n {\n }\n\n /// \n /// \u4e3b\u952eId\n /// \n public int Id { get; set; }\n\n /// \n /// \u59d3\u540d\n /// \n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n\n /// \n /// \u4f4f\u5740\n /// \n public string Address { get; set; }\n }\n}\n')),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u89c6\u56fe\u540d\u79f0")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u89c6\u56fe\u5b9e\u4f53\u53ea\u9700\u8981\u7ee7\u627f ",Object(i.b)("inlineCode",{parentName:"p"},"EntityNotKey")," \u57fa\u7c7b\u5e76\u7f16\u5199\u65e0\u53c2\u6784\u9020\u51fd\u6570\u7ee7\u627f ",Object(i.b)("inlineCode",{parentName:"p"},'base("\u89c6\u56fe\u540d\u79f0")')," \u5373\u53ef\u3002"))),Object(i.b)("h2",{id:"9123-\u89c6\u56fe\u4f7f\u7528"},"9.12.3 \u89c6\u56fe\u4f7f\u7528"),Object(i.b)("p",null,"\u89c6\u56fe\u9664\u4e86\u4e0d\u80fd\u64cd\u4f5c\uff08\u5199\uff09\u4ee5\u5916\uff0c\u5176\u4ed6\u64cd\u4f5c\u548c\u8868\u64cd\u4f5c\u65e0\u5f02\u3002"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var vEntities = v_repository.Where(u => u.Id >10).ToList();\n")),Object(i.b)("h2",{id:"9124-\u89c6\u56fe\u6700\u4f73\u8bfb\u53d6\u65b9\u5f0f-"},"9.12.4 \u89c6\u56fe\u6700\u4f73\u8bfb\u53d6\u65b9\u5f0f \u2714"),Object(i.b)("p",null,"\u7531\u4e8e\u89c6\u56fe\u662f\u865a\u62df\u8868\uff0c\u4e0d\u5e94\u8be5\u5bf9\u5176\u8fdb\u884c\u5199\u64cd\u4f5c\uff0c\u6240\u4ee5\u5e94\u8be5\u91c7\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"\u53ea\u8bfb\u4ed3\u50a8\u521d\u59cb\u5316\u89c6\u56fe"),"\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{11,13,16}","{11,13,16}":!0}),"using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DynamicApiController;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nnamespace Fur.Application.Persons\n{\n public class FurService : IDynamicApiController\n {\n private readonly IReadableRepository _readableRepository;\n\n public FurService(IRepository repository)\n {\n // \u521d\u59cb\u5316\u53ea\u8bfb\u4ed3\u50a8\n _readableRepository = repository.Constraint>();\n }\n\n /// \n /// \u8bfb\u53d6\u89c6\u56fe\n /// \n /// \n public async Task> GetVPerson()\n {\n var list = await _readableRepository.AsAsyncEnumerable();\n return list;\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u901a\u8fc7 ",Object(i.b)("inlineCode",{parentName:"p"},".Constraint")," \u65b9\u6cd5\u53ef\u4ee5\u5c06\u4ed3\u50a8\u7ea6\u675f\u4e3a\u7279\u5b9a\u4ed3\u50a8\uff0c\u5982\u53ea\u8bfb\u4ed3\u50a8\uff0c\u53ef\u8bfb\u53ef\u5199\u4ed3\u50a8\uff0c\u53ea\u65b0\u589e\u4ed3\u50a8\u7b49\u3002"))),Object(i.b)("h2",{id:"9125-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.12.5 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/4930ce4d.e8539812.js b/docs/4930ce4d.c5b9be77.js similarity index 99% rename from docs/4930ce4d.e8539812.js rename to docs/4930ce4d.c5b9be77.js index 4404669f30c..24b57a24c8a 100644 --- a/docs/4930ce4d.e8539812.js +++ b/docs/4930ce4d.c5b9be77.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[26],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return m}));var r=n(0),a=n.n(r);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=a.a.createContext({}),p=function(e){var t=a.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},b=function(e){var t=p(e.components);return a.a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},u=a.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),b=p(n),u=r,m=b["".concat(o,".").concat(u)]||b[u]||d[u]||i;return n?a.a.createElement(m,c(c({ref:t},l),{},{components:n})):a.a.createElement(m,c({ref:t},l))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,o[1]=c;for(var l=2;l")," \u63a5\u53e3\u5e76\u5b9e\u73b0\u5373\u53ef\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{8,24}","{8,24}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\n\nnamespace Fur.Core\n{\n public class Person : Entity, IEntityTypeBuilder\n {\n public Person()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n public string Name { get; set; }\n\n public int Age { get; set; }\n\n public string Address { get; set; }\n\n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasQueryFilter(u => !u.IsDeleted);\n }\n }\n}\n")),Object(i.b)("h3",{id:"92322-\u5168\u5c40\u7b5b\u9009\u5668"},"9.23.2.2 \u5168\u5c40\u7b5b\u9009\u5668"),Object(i.b)("p",null,"\u5168\u5c40\u7b5b\u9009\u5668\u53ef\u4ee5\u914d\u7f6e\u6240\u6709\u5b9e\u4f53\u5e94\u7528\u7b5b\u9009\u5668\u4e2d\uff0c\u65e0\u9700\u4e00\u4e2a\u4e00\u4e2a\u53bb\u914d\u7f6e\u3002\u4f7f\u7528\u65b9\u6cd5\u7a0d\u5fae\u6709\u4e9b\u590d\u6742\uff0c\u9700\u8981\u52a8\u6001\u6784\u5efa ",Object(i.b)("inlineCode",{parentName:"p"},"Lambda")," \u8868\u8fbe\u5f0f\u3002"),Object(i.b)("p",null,"\u5b9e\u73b0\u5168\u5c40\u7b5b\u9009\u5668\u4f9d\u8d56\u4e8e ",Object(i.b)("inlineCode",{parentName:"p"},"IModelBuilderFilter")," \u63a5\u53e3\uff0c\u8be5\u63a5\u53e3\u63d0\u4f9b\u4e24\u4e2a\u65b9\u6cd5\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"OnCreating"),"\uff1a\u5b9e\u4f53\u6784\u5efa\u4e4b\u524d"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"OnCreated"),"\uff1a\u5b9e\u4f53\u6784\u5efa\u4e4b\u540e")),Object(i.b)("p",null,"\u901a\u8fc7\u5b9e\u73b0\u8fd9\u4e24\u4e2a\u65b9\u6cd5\u5373\u53ef\u914d\u7f6e\u5168\u5c40\u8fc7\u6ee4\u5668\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{10,18-19,21,24}","{10,18-19,21,24}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Linq.Expressions;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext, IModelBuilderFilter\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public void OnCreated(ModelBuilder modelBuilder, EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n var expression = BuilderIsDeleteLambdaExpression(entityBuilder);\n if (expression == null) return;\n\n entityBuilder.HasQueryFilter(expression);\n }\n\n public void OnCreating(ModelBuilder modelBuilder, EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n }\n\n /// \n /// \u6784\u5efa u => EF.Property(u, "IsDeleted") == false \u8868\u8fbe\u5f0f\n /// \n /// \n /// \n private LambdaExpression BuilderIsDeleteLambdaExpression(EntityTypeBuilder entityBuilder)\n {\n // \u83b7\u53d6\u5b9e\u4f53\u6784\u5efa\u5668\u5143\u6570\u636e\n var metadata = entityBuilder.Metadata;\n if (metadata.FindProperty(nameof(Entity.IsDeleted)) == null) return default;\n\n // \u521b\u5efa\u8868\u8fbe\u5f0f\u5143\u7d20\n var parameter = Expression.Parameter(metadata.ClrType, "u");\n var properyName = Expression.Constant(nameof(Entity.IsDeleted));\n var propertyValue = Expression.Constant(false);\n\n // \u6784\u5efa\u8868\u8fbe\u5f0f u => EF.Property(u, "IsDeleted") == false\n var expressionBody = Expression.Equal(Expression.Call(typeof(EF), nameof(EF.Property), new[] { typeof(bool) }, parameter, properyName), propertyValue);\n var expression = Expression.Lambda(expressionBody, parameter);\n return expression;\n }\n }\n}\n')),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5c0f\u5efa\u8bae")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u5982\u679c\u5bf9\u52a8\u6001\u6784\u5efa ",Object(i.b)("inlineCode",{parentName:"p"},"LambdaExpression")," \u4e0d\u719f\u6089\u7684\u670b\u53cb\uff0c\u53ef\u4ee5\u4f7f\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"System.Linq.Dynamic.Core")," \u5305 ",Object(i.b)("a",Object(r.a)({parentName:"p"},{href:"https://github.com/zzzprojects/System.Linq.Dynamic.Core"}),"https://github.com/zzzprojects/System.Linq.Dynamic.Core")))),Object(i.b)("h2",{id:"9233-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.23.3 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(r.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}p.isMDXComponent=!0}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[26],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return m}));var r=n(0),a=n.n(r);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=a.a.createContext({}),p=function(e){var t=a.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},b=function(e){var t=p(e.components);return a.a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},u=a.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),b=p(n),u=r,m=b["".concat(o,".").concat(u)]||b[u]||d[u]||i;return n?a.a.createElement(m,c(c({ref:t},l),{},{components:n})):a.a.createElement(m,c({ref:t},l))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:r,o[1]=c;for(var l=2;l")," \u63a5\u53e3\u5e76\u5b9e\u73b0\u5373\u53ef\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{8,24}","{8,24}":!0}),"using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\n\nnamespace Fur.Core\n{\n public class Person : Entity, IEntityTypeBuilder\n {\n public Person()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n public string Name { get; set; }\n\n public int Age { get; set; }\n\n public string Address { get; set; }\n\n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasQueryFilter(u => !u.IsDeleted);\n }\n }\n}\n")),Object(i.b)("h3",{id:"92322-\u5168\u5c40\u7b5b\u9009\u5668"},"9.23.2.2 \u5168\u5c40\u7b5b\u9009\u5668"),Object(i.b)("p",null,"\u5168\u5c40\u7b5b\u9009\u5668\u53ef\u4ee5\u914d\u7f6e\u6240\u6709\u5b9e\u4f53\u5e94\u7528\u7b5b\u9009\u5668\u4e2d\uff0c\u65e0\u9700\u4e00\u4e2a\u4e00\u4e2a\u53bb\u914d\u7f6e\u3002\u4f7f\u7528\u65b9\u6cd5\u7a0d\u5fae\u6709\u4e9b\u590d\u6742\uff0c\u9700\u8981\u52a8\u6001\u6784\u5efa ",Object(i.b)("inlineCode",{parentName:"p"},"Lambda")," \u8868\u8fbe\u5f0f\u3002"),Object(i.b)("p",null,"\u5b9e\u73b0\u5168\u5c40\u7b5b\u9009\u5668\u4f9d\u8d56\u4e8e ",Object(i.b)("inlineCode",{parentName:"p"},"IModelBuilderFilter")," \u63a5\u53e3\uff0c\u8be5\u63a5\u53e3\u63d0\u4f9b\u4e24\u4e2a\u65b9\u6cd5\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"OnCreating"),"\uff1a\u5b9e\u4f53\u6784\u5efa\u4e4b\u524d"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"OnCreated"),"\uff1a\u5b9e\u4f53\u6784\u5efa\u4e4b\u540e")),Object(i.b)("p",null,"\u901a\u8fc7\u5b9e\u73b0\u8fd9\u4e24\u4e2a\u65b9\u6cd5\u5373\u53ef\u914d\u7f6e\u5168\u5c40\u8fc7\u6ee4\u5668\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{10,18-19,21,24}","{10,18-19,21,24}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Linq.Expressions;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext, IModelBuilderFilter\n {\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n public void OnCreated(ModelBuilder modelBuilder, EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n var expression = BuilderIsDeleteLambdaExpression(entityBuilder);\n if (expression == null) return;\n\n entityBuilder.HasQueryFilter(expression);\n }\n\n public void OnCreating(ModelBuilder modelBuilder, EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n }\n\n /// \n /// \u6784\u5efa u => EF.Property(u, "IsDeleted") == false \u8868\u8fbe\u5f0f\n /// \n /// \n /// \n private LambdaExpression BuilderIsDeleteLambdaExpression(EntityTypeBuilder entityBuilder)\n {\n // \u83b7\u53d6\u5b9e\u4f53\u6784\u5efa\u5668\u5143\u6570\u636e\n var metadata = entityBuilder.Metadata;\n if (metadata.FindProperty(nameof(Entity.IsDeleted)) == null) return default;\n\n // \u521b\u5efa\u8868\u8fbe\u5f0f\u5143\u7d20\n var parameter = Expression.Parameter(metadata.ClrType, "u");\n var properyName = Expression.Constant(nameof(Entity.IsDeleted));\n var propertyValue = Expression.Constant(false);\n\n // \u6784\u5efa\u8868\u8fbe\u5f0f u => EF.Property(u, "IsDeleted") == false\n var expressionBody = Expression.Equal(Expression.Call(typeof(EF), nameof(EF.Property), new[] { typeof(bool) }, parameter, properyName), propertyValue);\n var expression = Expression.Lambda(expressionBody, parameter);\n return expression;\n }\n }\n}\n')),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5c0f\u5efa\u8bae")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u5982\u679c\u5bf9\u52a8\u6001\u6784\u5efa ",Object(i.b)("inlineCode",{parentName:"p"},"LambdaExpression")," \u4e0d\u719f\u6089\u7684\u670b\u53cb\uff0c\u53ef\u4ee5\u4f7f\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"System.Linq.Dynamic.Core")," \u5305 ",Object(i.b)("a",Object(r.a)({parentName:"p"},{href:"https://github.com/zzzprojects/System.Linq.Dynamic.Core"}),"https://github.com/zzzprojects/System.Linq.Dynamic.Core")))),Object(i.b)("h2",{id:"9233-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.23.3 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(r.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/4bfcf3ee.9fd3cf97.js b/docs/4bfcf3ee.9fd3cf97.js deleted file mode 100644 index e791104a68d..00000000000 --- a/docs/4bfcf3ee.9fd3cf97.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[27],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return b})),t.d(n,"b",(function(){return p}));var a=t(0),r=t.n(a);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function s(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=r.a.createContext({}),u=function(e){var n=r.a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},b=function(e){var n=u(e.components);return r.a.createElement(l.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},d=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,o=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),b=u(t),d=a,p=b["".concat(o,".").concat(d)]||b[d]||m[d]||i;return t?r.a.createElement(p,s(s({ref:n},l),{},{components:t})):r.a.createElement(p,s({ref:n},l))}));function p(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=d;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var l=2;lInner Join",id:"91151-\u5185\u8fde\u63a5-inner-join",children:[]},{value:"9.11.5.2 \u5de6\u8fde\u63a5 Left Join",id:"91152-\u5de6\u8fde\u63a5-left-join",children:[]},{value:"9.11.5.2 \u53f3\u8fde\u63a5 Right Join",id:"91152-\u53f3\u8fde\u63a5-right-join",children:[]}]},{value:"9.11.6 \u5206\u7ec4\u67e5\u8be2",id:"9116-\u5206\u7ec4\u67e5\u8be2",children:[]},{value:"9.11.7 \u5408\u5e76\u7ed3\u679c\u96c6",id:"9117-\u5408\u5e76\u7ed3\u679c\u96c6",children:[]},{value:"9.11.8 \u67e5\u8be2\u6392\u5e8f",id:"9118-\u67e5\u8be2\u6392\u5e8f",children:[{value:"9.11.8.1 \u6b63\u5e8f",id:"91181-\u6b63\u5e8f",children:[]},{value:"9.11.8.2 \u5012\u5e8f",id:"91182-\u5012\u5e8f",children:[]},{value:"9.11.8.3 \u6df7\u5408\u5012\u5e8f",id:"91183-\u6df7\u5408\u5012\u5e8f",children:[]}]},{value:"9.11.9 \u9012\u5f52\u67e5\u8be2",id:"9119-\u9012\u5f52\u67e5\u8be2",children:[]},{value:"9.11.10 \u52a8\u6001 Sql \u67e5\u8be2",id:"91110-\u52a8\u6001-sql-\u67e5\u8be2",children:[{value:"9.11.10.1 \u52a8\u6001 Sql",id:"911101-\u52a8\u6001-sql",children:[]},{value:"9.11.10.2 \u52a8\u6001 Lambda",id:"911102-\u52a8\u6001-lambda",children:[]}]},{value:"9.11.11 \u6027\u80fd\u4f18\u5316",id:"91111-\u6027\u80fd\u4f18\u5316",children:[]},{value:"9.11.12 \u5206\u8868\u67e5\u8be2\u5c0f\u4f8b\u5b50",id:"91112-\u5206\u8868\u67e5\u8be2\u5c0f\u4f8b\u5b50",children:[]},{value:"9.11.12 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"91112-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],b={rightToc:u};function m(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(a.a)({},b,t,{components:n,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"9111-\u5173\u8054\u6570\u636e\u6a21\u578b"},"9.11.1 \u5173\u8054\u6570\u636e\u6a21\u578b"),Object(i.b)(o.a,{defaultValue:"person",values:[{label:"Person",value:"person"},{label:"PersonDetail",value:"person-detail"},{label:"Children",value:"children"},{label:"Post",value:"post"}],mdxType:"Tabs"},Object(i.b)(s.a,{value:"person",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{38,43,48}","{38,43,48}":!0}),"using Fur.DatabaseAccessor;\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Core\n{\n public class Person : Entity\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public Person()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u59d3\u540d\n /// \n [MaxLength(32)]\n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n\n /// \n /// \u4f4f\u5740\n /// \n public string Address { get; set; }\n\n /// \n /// \u4ece\u8868\n /// \n public PersonDetail PersonDetail { get; set; }\n\n /// \n /// \u4e00\u5bf9\u591a\n /// \n public ICollection Childrens { get; set; }\n\n /// \n /// \u591a\u5bf9\u591a\n /// \n public ICollection Posts { get; set; }\n }\n}\n"))),Object(i.b)(s.a,{value:"person-detail",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{25}","{25}":!0}),"using Fur.DatabaseAccessor;\n\nnamespace Fur.Core\n{\n public class PersonDetail : EntityBase\n {\n /// \n /// \u7535\u8bdd\u53f7\u7801\n /// \n public string PhoneNumber { get; set; }\n\n /// \n /// QQ \u53f7\u7801\n /// \n public string QQ { get; set; }\n\n /// \n /// \u5916\u952e\n /// \n public int PersonId { get; set; }\n\n /// \n /// \u4e3b\u8868\n /// \n public Person Person { get; set; }\n }\n}\n"))),Object(i.b)(s.a,{value:"children",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{35}","{35}":!0}),"using Fur.DatabaseAccessor;\nusing System;\n\nnamespace Fur.Core\n{\n public class Children : Entity\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public Children()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u540d\u79f0\n /// \n public string Name { get; set; }\n\n /// \n /// \u6027\u522b\n /// \n public Gender Gender { get; set; }\n\n /// \n /// \u5916\u952e\n /// \n public int PersonId { get; set; }\n\n /// \n /// \u4e3b\u8868\n /// \n public Person Person { get; set; }\n }\n}\n"))),Object(i.b)(s.a,{value:"post",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{26}","{26}":!0}),"using Fur.DatabaseAccessor;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.Core\n{\n public class Post : Entity\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public Post()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u540d\u79f0\n /// \n public string Name { get; set; }\n\n /// \n /// Person \u96c6\u5408\n /// \n public ICollection Persons { get; set; }\n }\n}\n")))),Object(i.b)("h2",{id:"9112-\u4e00\u5bf9\u4e00\u67e5\u8be2"},"9.11.2 \u4e00\u5bf9\u4e00\u67e5\u8be2"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar person = repository.Include(u => u.Detail);\n\n// \u793a\u4f8b\u4e8c\nvar person = repository.Include(u => u.Detail)\n .Include(u => u.Post);\n\n// \u793a\u4f8b\u4e09\nvar person = repository.Include(u => u.Detail)\n .ThenInclude(d => d.Review)\n .Include(u => u.Post);\n\n// \u793a\u4f8b\u56db\nvar person = repository.Include(u => u.Detail.Where(d => d.Id > 10).OrderBy(d => d.Name))\n .ThenInclude(d => d.Review)\n .Include(u => u.Post);\n\n// \u793a\u4f8b\u4e94\nvar person = repository.IncludeIf(!string.IsNullOrEmpty(keyword), u => u.Detail);\n\n// \u793a\u4f8b\u516d\nvar person = repository.IncludeIf(!string.IsNullOrEmpty(keyword), u => u.Detail)\n .IncludeIf(age > 18), u => u.Detail.Where(d => d.Id > 10).OrderBy(d => d.Name))\n .ThenInclude(d => d.Review)\n .Include(u => u.Post);\n")),Object(i.b)("h2",{id:"9113-\u4e00\u5bf9\u591a\u67e5\u8be2"},"9.11.3 \u4e00\u5bf9\u591a\u67e5\u8be2"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar person = repository.Include(u => u.Childrens);\n\n// \u53c2\u8003 \u4e00\u5bf9\u4e00 \u4f8b\u5b50\n")),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u8bf4\u660e")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"\u4e00\u5bf9\u4e00")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"\u4e00\u5bf9\u591a")," \u67e5\u8be2\u65b9\u6cd5\u4e00\u6837\uff0c\u552f\u4e00\u7684\u533a\u522b\u662f\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"\u4e00\u5bf9\u591a")," \u91c7\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"ICollection")," \u5b9a\u4e49\u5c5e\u6027\u3002"))),Object(i.b)("h2",{id:"9114-\u591a\u5bf9\u591a\u67e5\u8be2"},"9.11.4 \u591a\u5bf9\u591a\u67e5\u8be2"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar person = repository.Include(u => u.Posts);\n\n// \u53c2\u8003 \u4e00\u5bf9\u4e00 \u4f8b\u5b50\n")),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u8bf4\u660e")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"\u4e00\u5bf9\u4e00")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"\u591a\u5bf9\u591a")," \u67e5\u8be2\u65b9\u6cd5\u4e00\u6837\uff0c\u552f\u4e00\u7684\u533a\u522b\u662f\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"\u591a\u5bf9\u591a")," \u91c7\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"ICollection")," \u5b9a\u4e49\u5c5e\u6027\u3002"))),Object(i.b)("h2",{id:"9115-\u8054\u8868\u67e5\u8be2"},"9.11.5 \u8054\u8868\u67e5\u8be2"),Object(i.b)("h3",{id:"91151-\u5185\u8fde\u63a5-inner-join"},"9.11.5.1 \u5185\u8fde\u63a5 ",Object(i.b)("inlineCode",{parentName:"h3"},"Inner Join")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var query = from p in _personRepository.AsQueryable()\n join d in _personDetailRepository.AsQueryable() on p.Id equals d.PersonId\n select new PersonDto\n {\n PhoneNumber = p.PersonDetail.PhoneNumber,\n Address = p.Address,\n Age = p.Age,\n Name = p.Name,\n Id = p.Id,\n QQ = p.PersonDetail.QQ\n };\n")),Object(i.b)("h3",{id:"91152-\u5de6\u8fde\u63a5-left-join"},"9.11.5.2 \u5de6\u8fde\u63a5 ",Object(i.b)("inlineCode",{parentName:"h3"},"Left Join")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,3}","{2,3}":!0}),"var query = from p in _personRepository.AsQueryable()\n join d in _personDetailRepository.AsQueryable() on p.Id equals d.PersonId into results\n from d in results.DefaultIfEmpty()\n select new PersonDto\n {\n PhoneNumber = p.PersonDetail.PhoneNumber,\n Address = p.Address,\n Age = p.Age,\n Name = p.Name,\n Id = p.Id,\n QQ = p.PersonDetail.QQ\n };\n")),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5c0f\u63d0\u793a")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"Left Join"))," \u548c ",Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"Inner Join"))," \u4e0d\u540c\u7684\u662f\uff0c",Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"Left Join"))," \u4f1a\u5148\u5c06\u7ed3\u679c ",Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"into"))," \u5230\u65b0\u7684\u7ed3\u679c\u96c6\u7136\u540e\u518d\u67e5\u8be2\uff0c\u5e76\u8c03\u7528 ",Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"DefaultIfEmpty()"))," \u65b9\u6cd5\u3002"))),Object(i.b)("h3",{id:"91152-\u53f3\u8fde\u63a5-right-join"},"9.11.5.2 \u53f3\u8fde\u63a5 ",Object(i.b)("inlineCode",{parentName:"h3"},"Right Join")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Right Join")," \u53ea\u9700\u8981\u5c06 ",Object(i.b)("inlineCode",{parentName:"p"},"Left Join")," \u4e3b\u4ece\u8868\u4f4d\u7f6e\u66f4\u6362\u5373\u53ef\u3002"),Object(i.b)("h2",{id:"9116-\u5206\u7ec4\u67e5\u8be2"},"9.11.6 \u5206\u7ec4\u67e5\u8be2"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar query = repository.AsQueryable().GroupBy(x => new { x.Column1, x.Column2 });\n\n// \u793a\u4f8b\u4e8c\nvar query = from student in repository.AsQueryable()\n group student by repository2.AsQueryable() into dateGroup\n select new ResultData()\n {\n Key = dateGroup.Key,\n Value = dateGroup.Count()\n };\n\n// \u793a\u4f8b\u4e09\nvar query = from a in repository.AsQueryable()\n join b in repository2.AsQueryable() on a.Id equals b.Aid\n join c in repository3.AsQueryable() on c.id equals b.Bid\n group emp by new { emp.Age, emp.Sex } into g\n select new {\n Peo = g.Key,\n Count = g.Count()\n };\n")),Object(i.b)("h2",{id:"9117-\u5408\u5e76\u7ed3\u679c\u96c6"},"9.11.7 \u5408\u5e76\u7ed3\u679c\u96c6"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var query = repository.AsQueryable(u => u.Id > 10)\n .Union(\n repository2.AsQueryable(u => u.Id <= 10)\n );\n")),Object(i.b)("h2",{id:"9118-\u67e5\u8be2\u6392\u5e8f"},"9.11.8 \u67e5\u8be2\u6392\u5e8f"),Object(i.b)("h3",{id:"91181-\u6b63\u5e8f"},"9.11.8.1 \u6b63\u5e8f"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar query = repository.AsQueryable()\n .OrderBy(u => u.Id);\n\n// \u793a\u4f8b\u4e8c\nvar query =repository.AsQueryable()\n .OrderBy(u => u.Id)\n .ThenBy(u => u.Name);\n")),Object(i.b)("h3",{id:"91182-\u5012\u5e8f"},"9.11.8.2 \u5012\u5e8f"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar query = repository.AsQueryable()\n .OrderByDescending(u => u.Id);\n\n// \u793a\u4f8b\u4e8c\nvar query =repository.AsQueryable()\n .OrderByDescending(u => u.Id)\n .ThenByDescending(u => u.Name);\n")),Object(i.b)("h3",{id:"91183-\u6df7\u5408\u5012\u5e8f"},"9.11.8.3 \u6df7\u5408\u5012\u5e8f"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar query = repository.AsQueryable()\n .OrderBy(u => u.Id)\n .OrderByDescending(u => u.Name)\n .ThenBy(u => u.Age);\n")),Object(i.b)("h2",{id:"9119-\u9012\u5f52\u67e5\u8be2"},"9.11.9 \u9012\u5f52\u67e5\u8be2"),Object(i.b)(o.a,{defaultValue:"city",values:[{label:"City",value:"city"},{label:"CityDto",value:"citydto"}],mdxType:"Tabs"},Object(i.b)(s.a,{value:"city",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{12,36,41,49-55}","{12,36,41,49-55}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.Core\n{\n /// \n /// \u57ce\u5e02\n /// \n public class City : Entity, IEntityTypeBuilder, IEntitySeedData\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public City()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u540d\u79f0\n /// \n public string Name { get; set; }\n\n /// \n /// \u4e0a\u7ea7Id\n /// \n public int? ParentId { get; set; }\n\n /// \n /// \u4e0a\u7ea7\n /// \n public virtual City Parent { get; set; }\n\n /// \n /// \u5b50\u96c6\n /// \n public virtual ICollection Childrens { get; set; }\n\n /// \n /// \u914d\u7f6e\u5b9e\u4f53\u5173\u7cfb\n /// \n /// \n /// \n /// \n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder\n .HasMany(x => x.Childrens)\n .WithOne(x => x.Parent)\n .HasForeignKey(x => x.ParentId)\n .OnDelete(DeleteBehavior.ClientSetNull); // \u5fc5\u987b\u8bbe\u7f6e\u8fd9\u4e00\u884c\n }\n\n /// \n /// \u79cd\u5b50\u6570\u636e\n /// \n /// \n /// \n /// \n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new City { Id=1,CreatedTime =DateTime.Parse("2020-08-20 15:30:20"),IsDeleted=false,Name="\u4e2d\u56fd" },\n new City { Id=2,CreatedTime =DateTime.Parse("2020-08-20 15:30:20"),IsDeleted=false,Name="\u5e7f\u4e1c\u7701",ParentId=1 },\n new City { Id=3,CreatedTime =DateTime.Parse("2020-08-20 15:30:20"),IsDeleted=false,Name="\u4e2d\u5c71\u5e02",ParentId=2 },\n new City { Id=4,CreatedTime =DateTime.Parse("2020-08-20 15:30:20"),IsDeleted=false,Name="\u73e0\u6d77\u5e02",ParentId=2 },\n new City { Id=5,CreatedTime =DateTime.Parse("2020-08-20 15:30:20"),IsDeleted=false,Name="\u6d59\u6c5f\u7701",ParentId=1 },\n };\n }\n }\n}\n'))),Object(i.b)(s.a,{value:"citydto",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"using System.Collections.Generic;\n\nnamespace Fur.Application.Persons\n{\n public class CityDto\n {\n /// \n /// \u9010\u6e10\n /// \n public int Id { get; set; }\n\n /// \n /// \u540d\u79f0\n /// \n public string Name { get; set; }\n\n /// \n /// \u5b50\u96c6\n /// \n public ICollection Childrens { get; set; }\n }\n}\n")))),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var cities = await repository.AsQueryable()\n .Include(u => u.Childrens)\n .Where(u => u.Id == 1)\n .ToListAsync();\n\nvar dtos = cities.Adapt>();\n")),Object(i.b)("h2",{id:"91110-\u52a8\u6001-sql-\u67e5\u8be2"},"9.11.10 \u52a8\u6001 ",Object(i.b)("inlineCode",{parentName:"h2"},"Sql")," \u67e5\u8be2"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u9ed8\u8ba4\u4e0d\u652f\u6301 \u52a8\u6001 ",Object(i.b)("inlineCode",{parentName:"p"},"Sql")," \u67e5\u8be2\u529f\u80fd\uff0c\u4e0d\u8fc7\u53ef\u4ee5\u901a\u8fc7\u7b2c\u4e09\u65b9\u5b9e\u73b0\uff1a"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u9879\u76ee\u5c42\u5b89\u88c5 ",Object(i.b)("inlineCode",{parentName:"p"},"System.Linq.Dynamic.Core")," \u5305 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/zzzprojects/System.Linq.Dynamic.Core"}),"https://github.com/zzzprojects/System.Linq.Dynamic.Core")),Object(i.b)("h3",{id:"911101-\u52a8\u6001-sql"},"9.11.10.1 \u52a8\u6001 ",Object(i.b)("inlineCode",{parentName:"h3"},"Sql")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u793a\u4f8b\u4e00\nvar query = repository.AsQueryable()\n .Where("City == @0 and Orders.Count >= @1", "China", 10)\n .OrderBy("CompanyName")\n .Select("new(CompanyName as Name, Phone)");\n\n// \u793a\u4f8b\u4e8c\nvar list = repository.AsQueryable()\n .Where("Name.Contains(@0)","Fur")\n .ToList();\n\n// \u793a\u4f8b\u4e09\uff0c\u652f\u6301 ? \u8bed\u6cd5\nvar customers = repository.AsQueryable()\n .Include(c => c.Location)\n .Where(c => c.Location?.Name == "test") // \u6ce8\u610f Location?.Name\n .ToList();\n')),Object(i.b)("h3",{id:"911102-\u52a8\u6001-lambda"},"9.11.10.2 \u52a8\u6001 ",Object(i.b)("inlineCode",{parentName:"h3"},"Lambda")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u793a\u4f8b\u4e00\nvar x = Expression.Parameter(typeof(int), "x");\nvar y = Expression.Parameter(typeof(int), "y");\nvar e = DynamicExpressionParser\n .ParseLambda(new ParameterExpression[] { x, y }, null, "(x + y) * 2");\n\n// \u793a\u4f8b\u4e8c\nvar e = DynamicExpressionParser.ParseLambda(\n typeof(Customer), typeof(bool),\n "City = @0 and Orders.Count >= @1",\n "London", 10);\n')),Object(i.b)("h2",{id:"91111-\u6027\u80fd\u4f18\u5316"},"9.11.11 \u6027\u80fd\u4f18\u5316"),Object(i.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"EF Core")," \u4f1a\u8ddf\u8e2a\u6240\u6709\u5b9e\u4f53\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u6570\u636e\u6539\u53d8\u90fd\u4f1a\u5f15\u8d77\u6570\u636e\u68c0\u67e5\uff0c\u6240\u4ee5\u5982\u679c\u53ea\u505a\u67e5\u8be2\u64cd\u4f5c\uff0c\u5efa\u8bae\u5173\u95ed\u5b9e\u4f53\u8ddf\u8e2a\u529f\u80fd\u3002"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u4ee5\u4e0b\u9ad8\u6027\u80fd\u5b9e\u4f53\u96c6\u5408\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"DetachedEntities"),"\uff1a\u8131\u8f68/\u4e0d\u8ffd\u8e2a\u5b9e\u4f53"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"AsQueryable()"),"\uff1a\u4e0d\u8ffd\u8e2a\u5b9e\u4f53"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Entities.AsNoTracking()"),"\uff1a\u624b\u52a8\u5173\u95ed\u5b9e\u4f53\u8ffd\u8e2a")),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"EF Core")," \u4e2d\uff0c\u590d\u6742\u67e5\u8be2\u603b\u662f\u4f1a\u751f\u6210\u4e00\u4e2a ",Object(i.b)("inlineCode",{parentName:"p"},"sql"),"\uff0c\u4e5f\u5c31\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"AsSingleQuery()"),"\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u8bbe\u7f6e\u4e3a ",Object(i.b)("inlineCode",{parentName:"p"},"AsSplitQuery()")," \u5207\u5272\u6210\u591a\u4e2a\u67e5\u8be2\u3002"),Object(i.b)("h2",{id:"91112-\u5206\u8868\u67e5\u8be2\u5c0f\u4f8b\u5b50"},"9.11.12 \u5206\u8868\u67e5\u8be2\u5c0f\u4f8b\u5b50"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.Core\n{\n public class Person : Entity, IEntityTypeBuilder\n {\n public string Name { get; set; }\n\n /// \n /// \u914d\u7f6e\u5b9e\u4f53\u5173\u7cfb\n /// \n /// \n /// \n /// \n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.ToSqlQuery(\n @"select * from dbo.person.2020-09-19\n union all\n select * from dbo.person.2020-09-20");\n }\n }\n}\n')),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var posts = repository.Where(u => u.Id > 10).ToList();\n")),Object(i.b)("h2",{id:"91112-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.11.12 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/4bfcf3ee.bb6afc05.js b/docs/4bfcf3ee.bb6afc05.js new file mode 100644 index 00000000000..c4d671e111b --- /dev/null +++ b/docs/4bfcf3ee.bb6afc05.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[27],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return b})),t.d(n,"b",(function(){return p}));var a=t(0),r=t.n(a);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=r.a.createContext({}),u=function(e){var n=r.a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},b=function(e){var n=u(e.components);return r.a.createElement(l.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},d=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),b=u(t),d=a,p=b["".concat(s,".").concat(d)]||b[d]||m[d]||i;return t?r.a.createElement(p,o(o({ref:n},l),{},{components:t})):r.a.createElement(p,o({ref:n},l))}));function p(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,s=new Array(i);s[0]=d;var o={};for(var c in n)hasOwnProperty.call(n,c)&&(o[c]=n[c]);o.originalType=e,o.mdxType="string"==typeof e?e:a,s[1]=o;for(var l=2;lfunction(e,n,t,{forcePrependBaseUrl:a=!1,absolute:i=!1}={}){if(!t)return t;if(t.startsWith("#"))return t;if(Object(r.b)(t))return t;if(a)return n+t;const s=t.startsWith(n)?t:n+t.replace(/^\//,"");return i?e+s:s}(n,e,t,a)}}function s(e,n={}){const{withBaseUrl:t}=i();return t(e,n)}},145:function(e,n,t){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function r(e){return void 0!==e&&!a(e)}t.d(n,"b",(function(){return a})),t.d(n,"a",(function(){return r}))},146:function(e,n,t){"use strict";function a(e){var n,t,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;nn.value===e)&&O(e)}const h=e=>{O(e),null!=m&&p(m,e)},v=[],N=e=>{e.metaKey||e.altKey||e.ctrlKey||g(!0)},f=()=>{g(!1)};return Object(a.useEffect)(()=>{window.addEventListener("keydown",N),window.addEventListener("mousedown",f)},[]),r.a.createElement("div",null,r.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(s.a)("tabs",{"tabs--block":n})},b.map(({value:e,label:n})=>r.a.createElement("li",{role:"tab",tabIndex:0,"aria-selected":y===e,className:Object(s.a)("tabs__item",c.a.tabItem,{"tabs__item--active":y===e}),style:j?{}:{outline:"none"},key:e,ref:e=>v.push(e),onKeyDown:e=>{((e,n,t)=>{switch(t.keyCode){case u:((e,n)=>{const t=e.indexOf(n)+1;e[t]?e[t].focus():e[0].focus()})(e,n);break;case l:((e,n)=>{const t=e.indexOf(n)-1;e[t]?e[t].focus():e[e.length-1].focus()})(e,n)}})(v,e.target,e),N(e)},onFocus:()=>h(e),onClick:()=>{h(e),g(!1)},onPointerDown:()=>g(!1)},n))),r.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(t).filter(e=>e.props.value===y)[0]))}},150:function(e,n,t){"use strict";var a=t(0),r=t.n(a);n.a=function(e){return r.a.createElement("div",null,e.children)}},82:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return c})),t.d(n,"metadata",(function(){return l})),t.d(n,"rightToc",(function(){return u})),t.d(n,"default",(function(){return m}));var a=t(2),r=t(6),i=(t(0),t(142)),s=(t(144),t(149)),o=t(150),c={id:"dbcontext-hight-query",title:"9.11 \u9ad8\u7ea7\u67e5\u8be2\u64cd\u4f5c",sidebar_label:"9.11 \u9ad8\u7ea7\u67e5\u8be2\u64cd\u4f5c"},l={unversionedId:"dbcontext-hight-query",id:"dbcontext-hight-query",isDocsHomePage:!1,title:"9.11 \u9ad8\u7ea7\u67e5\u8be2\u64cd\u4f5c",description:"9.11.1 \u5173\u8054\u6570\u636e\u6a21\u578b",source:"@site/docs\\dbcontext-high-query.mdx",slug:"/dbcontext-hight-query",permalink:"/docs/dbcontext-hight-query",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/dbcontext-high-query.mdx",version:"current",sidebar_label:"9.11 \u9ad8\u7ea7\u67e5\u8be2\u64cd\u4f5c",sidebar:"docs",previous:{title:"9.10 \u67e5\u8be2\u64cd\u4f5c",permalink:"/docs/dbcontext-query"},next:{title:"9.12 \u89c6\u56fe\u64cd\u4f5c",permalink:"/docs/dbcontext-view"}},u=[{value:"9.11.1 \u5173\u8054\u6570\u636e\u6a21\u578b",id:"9111-\u5173\u8054\u6570\u636e\u6a21\u578b",children:[]},{value:"9.11.2 \u4e00\u5bf9\u4e00\u67e5\u8be2",id:"9112-\u4e00\u5bf9\u4e00\u67e5\u8be2",children:[]},{value:"9.11.3 \u4e00\u5bf9\u591a\u67e5\u8be2",id:"9113-\u4e00\u5bf9\u591a\u67e5\u8be2",children:[]},{value:"9.11.4 \u591a\u5bf9\u591a\u67e5\u8be2",id:"9114-\u591a\u5bf9\u591a\u67e5\u8be2",children:[]},{value:"9.11.5 \u8054\u8868\u67e5\u8be2",id:"9115-\u8054\u8868\u67e5\u8be2",children:[{value:"9.11.5.1 \u5185\u8fde\u63a5 Inner Join",id:"91151-\u5185\u8fde\u63a5-inner-join",children:[]},{value:"9.11.5.2 \u5de6\u8fde\u63a5 Left Join",id:"91152-\u5de6\u8fde\u63a5-left-join",children:[]},{value:"9.11.5.2 \u53f3\u8fde\u63a5 Right Join",id:"91152-\u53f3\u8fde\u63a5-right-join",children:[]}]},{value:"9.11.6 \u5206\u7ec4\u67e5\u8be2",id:"9116-\u5206\u7ec4\u67e5\u8be2",children:[]},{value:"9.11.7 \u5408\u5e76\u7ed3\u679c\u96c6",id:"9117-\u5408\u5e76\u7ed3\u679c\u96c6",children:[]},{value:"9.11.8 \u67e5\u8be2\u6392\u5e8f",id:"9118-\u67e5\u8be2\u6392\u5e8f",children:[{value:"9.11.8.1 \u6b63\u5e8f",id:"91181-\u6b63\u5e8f",children:[]},{value:"9.11.8.2 \u5012\u5e8f",id:"91182-\u5012\u5e8f",children:[]},{value:"9.11.8.3 \u6df7\u5408\u5012\u5e8f",id:"91183-\u6df7\u5408\u5012\u5e8f",children:[]}]},{value:"9.11.9 \u9012\u5f52\u67e5\u8be2",id:"9119-\u9012\u5f52\u67e5\u8be2",children:[]},{value:"9.11.10 \u52a8\u6001 Sql \u67e5\u8be2",id:"91110-\u52a8\u6001-sql-\u67e5\u8be2",children:[{value:"9.11.10.1 \u52a8\u6001 Sql",id:"911101-\u52a8\u6001-sql",children:[]},{value:"9.11.10.2 \u52a8\u6001 Lambda",id:"911102-\u52a8\u6001-lambda",children:[]}]},{value:"9.11.11 \u6027\u80fd\u4f18\u5316",id:"91111-\u6027\u80fd\u4f18\u5316",children:[]},{value:"9.11.12 \u5206\u8868\u67e5\u8be2\u5c0f\u4f8b\u5b50",id:"91112-\u5206\u8868\u67e5\u8be2\u5c0f\u4f8b\u5b50",children:[]},{value:"9.11.12 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"91112-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],b={rightToc:u};function m(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(a.a)({},b,t,{components:n,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"9111-\u5173\u8054\u6570\u636e\u6a21\u578b"},"9.11.1 \u5173\u8054\u6570\u636e\u6a21\u578b"),Object(i.b)(s.a,{defaultValue:"person",values:[{label:"Person",value:"person"},{label:"PersonDetail",value:"person-detail"},{label:"Children",value:"children"},{label:"Post",value:"post"}],mdxType:"Tabs"},Object(i.b)(o.a,{value:"person",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{38,43,48}","{38,43,48}":!0}),"using Fur.DatabaseAccessor;\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Core\n{\n public class Person : Entity\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public Person()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u59d3\u540d\n /// \n [MaxLength(32)]\n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n\n /// \n /// \u4f4f\u5740\n /// \n public string Address { get; set; }\n\n /// \n /// \u4ece\u8868\n /// \n public PersonDetail PersonDetail { get; set; }\n\n /// \n /// \u4e00\u5bf9\u591a\n /// \n public ICollection Childrens { get; set; }\n\n /// \n /// \u591a\u5bf9\u591a\n /// \n public ICollection Posts { get; set; }\n }\n}\n"))),Object(i.b)(o.a,{value:"person-detail",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{25}","{25}":!0}),"using Fur.DatabaseAccessor;\n\nnamespace Fur.Core\n{\n public class PersonDetail : EntityBase\n {\n /// \n /// \u7535\u8bdd\u53f7\u7801\n /// \n public string PhoneNumber { get; set; }\n\n /// \n /// QQ \u53f7\u7801\n /// \n public string QQ { get; set; }\n\n /// \n /// \u5916\u952e\n /// \n public int PersonId { get; set; }\n\n /// \n /// \u4e3b\u8868\n /// \n public Person Person { get; set; }\n }\n}\n"))),Object(i.b)(o.a,{value:"children",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{35}","{35}":!0}),"using Fur.DatabaseAccessor;\nusing System;\n\nnamespace Fur.Core\n{\n public class Children : Entity\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public Children()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u540d\u79f0\n /// \n public string Name { get; set; }\n\n /// \n /// \u6027\u522b\n /// \n public Gender Gender { get; set; }\n\n /// \n /// \u5916\u952e\n /// \n public int PersonId { get; set; }\n\n /// \n /// \u4e3b\u8868\n /// \n public Person Person { get; set; }\n }\n}\n"))),Object(i.b)(o.a,{value:"post",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{26}","{26}":!0}),"using Fur.DatabaseAccessor;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.Core\n{\n public class Post : Entity\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public Post()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u540d\u79f0\n /// \n public string Name { get; set; }\n\n /// \n /// Person \u96c6\u5408\n /// \n public ICollection Persons { get; set; }\n }\n}\n")))),Object(i.b)("h2",{id:"9112-\u4e00\u5bf9\u4e00\u67e5\u8be2"},"9.11.2 \u4e00\u5bf9\u4e00\u67e5\u8be2"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar person = repository.Include(u => u.Detail);\n\n// \u793a\u4f8b\u4e8c\nvar person = repository.Include(u => u.Detail)\n .Include(u => u.Post);\n\n// \u793a\u4f8b\u4e09\nvar person = repository.Include(u => u.Detail)\n .ThenInclude(d => d.Review)\n .Include(u => u.Post);\n\n// \u793a\u4f8b\u56db\nvar person = repository.Include(u => u.Detail.Where(d => d.Id > 10).OrderBy(d => d.Name))\n .ThenInclude(d => d.Review)\n .Include(u => u.Post);\n\n// \u793a\u4f8b\u4e94\nvar person = repository.IncludeIf(!string.IsNullOrEmpty(keyword), u => u.Detail);\n\n// \u793a\u4f8b\u516d\nvar person = repository.IncludeIf(!string.IsNullOrEmpty(keyword), u => u.Detail)\n .IncludeIf(age > 18), u => u.Detail.Where(d => d.Id > 10).OrderBy(d => d.Name))\n .ThenInclude(d => d.Review)\n .Include(u => u.Post);\n")),Object(i.b)("h2",{id:"9113-\u4e00\u5bf9\u591a\u67e5\u8be2"},"9.11.3 \u4e00\u5bf9\u591a\u67e5\u8be2"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar person = repository.Include(u => u.Childrens);\n\n// \u53c2\u8003 \u4e00\u5bf9\u4e00 \u4f8b\u5b50\n")),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u8bf4\u660e")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"\u4e00\u5bf9\u4e00")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"\u4e00\u5bf9\u591a")," \u67e5\u8be2\u65b9\u6cd5\u4e00\u6837\uff0c\u552f\u4e00\u7684\u533a\u522b\u662f\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"\u4e00\u5bf9\u591a")," \u91c7\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"ICollection")," \u5b9a\u4e49\u5c5e\u6027\u3002"))),Object(i.b)("h2",{id:"9114-\u591a\u5bf9\u591a\u67e5\u8be2"},"9.11.4 \u591a\u5bf9\u591a\u67e5\u8be2"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar person = repository.Include(u => u.Posts);\n\n// \u53c2\u8003 \u4e00\u5bf9\u4e00 \u4f8b\u5b50\n")),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u8bf4\u660e")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"\u4e00\u5bf9\u4e00")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"\u591a\u5bf9\u591a")," \u67e5\u8be2\u65b9\u6cd5\u4e00\u6837\uff0c\u552f\u4e00\u7684\u533a\u522b\u662f\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"\u591a\u5bf9\u591a")," \u91c7\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"ICollection")," \u5b9a\u4e49\u5c5e\u6027\u3002"))),Object(i.b)("h2",{id:"9115-\u8054\u8868\u67e5\u8be2"},"9.11.5 \u8054\u8868\u67e5\u8be2"),Object(i.b)("h3",{id:"91151-\u5185\u8fde\u63a5-inner-join"},"9.11.5.1 \u5185\u8fde\u63a5 ",Object(i.b)("inlineCode",{parentName:"h3"},"Inner Join")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var query = from p in _personRepository.AsQueryable()\n join d in _personDetailRepository.AsQueryable() on p.Id equals d.PersonId\n select new PersonDto\n {\n PhoneNumber = p.PersonDetail.PhoneNumber,\n Address = p.Address,\n Age = p.Age,\n Name = p.Name,\n Id = p.Id,\n QQ = p.PersonDetail.QQ\n };\n")),Object(i.b)("h3",{id:"91152-\u5de6\u8fde\u63a5-left-join"},"9.11.5.2 \u5de6\u8fde\u63a5 ",Object(i.b)("inlineCode",{parentName:"h3"},"Left Join")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,3}","{2,3}":!0}),"var query = from p in _personRepository.AsQueryable()\n join d in _personDetailRepository.AsQueryable() on p.Id equals d.PersonId into results\n from d in results.DefaultIfEmpty()\n select new PersonDto\n {\n PhoneNumber = p.PersonDetail.PhoneNumber,\n Address = p.Address,\n Age = p.Age,\n Name = p.Name,\n Id = p.Id,\n QQ = p.PersonDetail.QQ\n };\n")),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5c0f\u63d0\u793a")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"Left Join"))," \u548c ",Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"Inner Join"))," \u4e0d\u540c\u7684\u662f\uff0c",Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"Left Join"))," \u4f1a\u5148\u5c06\u7ed3\u679c ",Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"into"))," \u5230\u65b0\u7684\u7ed3\u679c\u96c6\u7136\u540e\u518d\u67e5\u8be2\uff0c\u5e76\u8c03\u7528 ",Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"DefaultIfEmpty()"))," \u65b9\u6cd5\u3002"))),Object(i.b)("h3",{id:"91152-\u53f3\u8fde\u63a5-right-join"},"9.11.5.2 \u53f3\u8fde\u63a5 ",Object(i.b)("inlineCode",{parentName:"h3"},"Right Join")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Right Join")," \u53ea\u9700\u8981\u5c06 ",Object(i.b)("inlineCode",{parentName:"p"},"Left Join")," \u4e3b\u4ece\u8868\u4f4d\u7f6e\u66f4\u6362\u5373\u53ef\u3002"),Object(i.b)("h2",{id:"9116-\u5206\u7ec4\u67e5\u8be2"},"9.11.6 \u5206\u7ec4\u67e5\u8be2"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar query = repository.AsQueryable().GroupBy(x => new { x.Column1, x.Column2 });\n\n// \u793a\u4f8b\u4e8c\nvar query = from student in repository.AsQueryable()\n group student by repository2.AsQueryable() into dateGroup\n select new ResultData()\n {\n Key = dateGroup.Key,\n Value = dateGroup.Count()\n };\n\n// \u793a\u4f8b\u4e09\nvar query = from a in repository.AsQueryable()\n join b in repository2.AsQueryable() on a.Id equals b.Aid\n join c in repository3.AsQueryable() on c.id equals b.Bid\n group emp by new { emp.Age, emp.Sex } into g\n select new {\n Peo = g.Key,\n Count = g.Count()\n };\n")),Object(i.b)("h2",{id:"9117-\u5408\u5e76\u7ed3\u679c\u96c6"},"9.11.7 \u5408\u5e76\u7ed3\u679c\u96c6"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var query = repository.AsQueryable(u => u.Id > 10)\n .Union(\n repository2.AsQueryable(u => u.Id <= 10)\n );\n")),Object(i.b)("h2",{id:"9118-\u67e5\u8be2\u6392\u5e8f"},"9.11.8 \u67e5\u8be2\u6392\u5e8f"),Object(i.b)("h3",{id:"91181-\u6b63\u5e8f"},"9.11.8.1 \u6b63\u5e8f"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar query = repository.AsQueryable()\n .OrderBy(u => u.Id);\n\n// \u793a\u4f8b\u4e8c\nvar query =repository.AsQueryable()\n .OrderBy(u => u.Id)\n .ThenBy(u => u.Name);\n")),Object(i.b)("h3",{id:"91182-\u5012\u5e8f"},"9.11.8.2 \u5012\u5e8f"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar query = repository.AsQueryable()\n .OrderByDescending(u => u.Id);\n\n// \u793a\u4f8b\u4e8c\nvar query =repository.AsQueryable()\n .OrderByDescending(u => u.Id)\n .ThenByDescending(u => u.Name);\n")),Object(i.b)("h3",{id:"91183-\u6df7\u5408\u5012\u5e8f"},"9.11.8.3 \u6df7\u5408\u5012\u5e8f"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"// \u793a\u4f8b\u4e00\nvar query = repository.AsQueryable()\n .OrderBy(u => u.Id)\n .OrderByDescending(u => u.Name)\n .ThenBy(u => u.Age);\n")),Object(i.b)("h2",{id:"9119-\u9012\u5f52\u67e5\u8be2"},"9.11.9 \u9012\u5f52\u67e5\u8be2"),Object(i.b)(s.a,{defaultValue:"city",values:[{label:"City",value:"city"},{label:"CityDto",value:"citydto"}],mdxType:"Tabs"},Object(i.b)(o.a,{value:"city",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{12,36,41,49-55}","{12,36,41,49-55}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.Core\n{\n /// \n /// \u57ce\u5e02\n /// \n public class City : Entity, IEntityTypeBuilder, IEntitySeedData\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public City()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u540d\u79f0\n /// \n public string Name { get; set; }\n\n /// \n /// \u4e0a\u7ea7Id\n /// \n public int? ParentId { get; set; }\n\n /// \n /// \u4e0a\u7ea7\n /// \n public virtual City Parent { get; set; }\n\n /// \n /// \u5b50\u96c6\n /// \n public virtual ICollection Childrens { get; set; }\n\n /// \n /// \u914d\u7f6e\u5b9e\u4f53\u5173\u7cfb\n /// \n /// \n /// \n /// \n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder\n .HasMany(x => x.Childrens)\n .WithOne(x => x.Parent)\n .HasForeignKey(x => x.ParentId)\n .OnDelete(DeleteBehavior.ClientSetNull); // \u5fc5\u987b\u8bbe\u7f6e\u8fd9\u4e00\u884c\n }\n\n /// \n /// \u79cd\u5b50\u6570\u636e\n /// \n /// \n /// \n /// \n public IEnumerable HasData(DbContext dbContext, Type dbContextLocator)\n {\n return new List\n {\n new City { Id=1,CreatedTime =DateTime.Parse("2020-08-20 15:30:20"),IsDeleted=false,Name="\u4e2d\u56fd" },\n new City { Id=2,CreatedTime =DateTime.Parse("2020-08-20 15:30:20"),IsDeleted=false,Name="\u5e7f\u4e1c\u7701",ParentId=1 },\n new City { Id=3,CreatedTime =DateTime.Parse("2020-08-20 15:30:20"),IsDeleted=false,Name="\u4e2d\u5c71\u5e02",ParentId=2 },\n new City { Id=4,CreatedTime =DateTime.Parse("2020-08-20 15:30:20"),IsDeleted=false,Name="\u73e0\u6d77\u5e02",ParentId=2 },\n new City { Id=5,CreatedTime =DateTime.Parse("2020-08-20 15:30:20"),IsDeleted=false,Name="\u6d59\u6c5f\u7701",ParentId=1 },\n };\n }\n }\n}\n'))),Object(i.b)(o.a,{value:"citydto",mdxType:"TabItem"},Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"using System.Collections.Generic;\n\nnamespace Fur.Application.Persons\n{\n public class CityDto\n {\n /// \n /// \u9010\u6e10\n /// \n public int Id { get; set; }\n\n /// \n /// \u540d\u79f0\n /// \n public string Name { get; set; }\n\n /// \n /// \u5b50\u96c6\n /// \n public ICollection Childrens { get; set; }\n }\n}\n")))),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var cities = await repository.AsQueryable()\n .Include(u => u.Childrens)\n .Where(u => u.Id == 1)\n .ToListAsync();\n\nvar dtos = cities.Adapt>();\n")),Object(i.b)("h2",{id:"91110-\u52a8\u6001-sql-\u67e5\u8be2"},"9.11.10 \u52a8\u6001 ",Object(i.b)("inlineCode",{parentName:"h2"},"Sql")," \u67e5\u8be2"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u9ed8\u8ba4\u4e0d\u652f\u6301 \u52a8\u6001 ",Object(i.b)("inlineCode",{parentName:"p"},"Sql")," \u67e5\u8be2\u529f\u80fd\uff0c\u4e0d\u8fc7\u53ef\u4ee5\u901a\u8fc7\u7b2c\u4e09\u65b9\u5b9e\u73b0\uff1a"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u9879\u76ee\u5c42\u5b89\u88c5 ",Object(i.b)("inlineCode",{parentName:"p"},"System.Linq.Dynamic.Core")," \u5305 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://github.com/zzzprojects/System.Linq.Dynamic.Core"}),"https://github.com/zzzprojects/System.Linq.Dynamic.Core")),Object(i.b)("h3",{id:"911101-\u52a8\u6001-sql"},"9.11.10.1 \u52a8\u6001 ",Object(i.b)("inlineCode",{parentName:"h3"},"Sql")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u793a\u4f8b\u4e00\nvar query = repository.AsQueryable()\n .Where("City == @0 and Orders.Count >= @1", "China", 10)\n .OrderBy("CompanyName")\n .Select("new(CompanyName as Name, Phone)");\n\n// \u793a\u4f8b\u4e8c\nvar list = repository.AsQueryable()\n .Where("Name.Contains(@0)","Fur")\n .ToList();\n\n// \u793a\u4f8b\u4e09\uff0c\u652f\u6301 ? \u8bed\u6cd5\nvar customers = repository.AsQueryable()\n .Include(c => c.Location)\n .Where(c => c.Location?.Name == "test") // \u6ce8\u610f Location?.Name\n .ToList();\n')),Object(i.b)("h3",{id:"911102-\u52a8\u6001-lambda"},"9.11.10.2 \u52a8\u6001 ",Object(i.b)("inlineCode",{parentName:"h3"},"Lambda")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u793a\u4f8b\u4e00\nvar x = Expression.Parameter(typeof(int), "x");\nvar y = Expression.Parameter(typeof(int), "y");\nvar e = DynamicExpressionParser\n .ParseLambda(new ParameterExpression[] { x, y }, null, "(x + y) * 2");\n\n// \u793a\u4f8b\u4e8c\nvar e = DynamicExpressionParser.ParseLambda(\n typeof(Customer), typeof(bool),\n "City = @0 and Orders.Count >= @1",\n "London", 10);\n')),Object(i.b)("h2",{id:"91111-\u6027\u80fd\u4f18\u5316"},"9.11.11 \u6027\u80fd\u4f18\u5316"),Object(i.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"EF Core")," \u4f1a\u8ddf\u8e2a\u6240\u6709\u5b9e\u4f53\uff0c\u4e5f\u5c31\u662f\u4efb\u4f55\u6570\u636e\u6539\u53d8\u90fd\u4f1a\u5f15\u8d77\u6570\u636e\u68c0\u67e5\uff0c\u6240\u4ee5\u5982\u679c\u53ea\u505a\u67e5\u8be2\u64cd\u4f5c\uff0c\u5efa\u8bae\u5173\u95ed\u5b9e\u4f53\u8ddf\u8e2a\u529f\u80fd\u3002"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u4ee5\u4e0b\u9ad8\u6027\u80fd\u5b9e\u4f53\u96c6\u5408\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"DetachedEntities"),"\uff1a\u8131\u8f68/\u4e0d\u8ffd\u8e2a\u5b9e\u4f53"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"AsQueryable()"),"\uff1a\u4e0d\u8ffd\u8e2a\u5b9e\u4f53"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Entities.AsNoTracking()"),"\uff1a\u624b\u52a8\u5173\u95ed\u5b9e\u4f53\u8ffd\u8e2a")),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"EF Core")," \u4e2d\uff0c\u590d\u6742\u67e5\u8be2\u603b\u662f\u4f1a\u751f\u6210\u4e00\u4e2a ",Object(i.b)("inlineCode",{parentName:"p"},"sql"),"\uff0c\u4e5f\u5c31\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"AsSingleQuery()"),"\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u8bbe\u7f6e\u4e3a ",Object(i.b)("inlineCode",{parentName:"p"},"AsSplitQuery()")," \u5207\u5272\u6210\u591a\u4e2a\u67e5\u8be2\u3002"),Object(i.b)("h2",{id:"91112-\u5206\u8868\u67e5\u8be2\u5c0f\u4f8b\u5b50"},"9.11.12 \u5206\u8868\u67e5\u8be2\u5c0f\u4f8b\u5b50"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\nnamespace Fur.Core\n{\n public class Person : Entity, IEntityTypeBuilder\n {\n public string Name { get; set; }\n\n /// \n /// \u914d\u7f6e\u5b9e\u4f53\u5173\u7cfb\n /// \n /// \n /// \n /// \n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.ToSqlQuery(\n @"select * from dbo.person.2020-09-19\n union all\n select * from dbo.person.2020-09-20");\n }\n }\n}\n')),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"var posts = repository.Where(u => u.Id > 10).ToList();\n")),Object(i.b)("h2",{id:"91112-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.11.12 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/4c30b939.4343bb83.js b/docs/4c30b939.4343bb83.js new file mode 100644 index 00000000000..88209e27730 --- /dev/null +++ b/docs/4c30b939.4343bb83.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[28],{142:function(e,t,a){"use strict";a.d(t,"a",(function(){return u})),a.d(t,"b",(function(){return j}));var r=a(0),n=a.n(r);function b(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function c(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function l(e){for(var t=1;t=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},u=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},O={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},m=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=o(a),m=r,j=u["".concat(c,".").concat(m)]||u[m]||O[m]||b;return a?n.a.createElement(j,l(l({ref:t},p),{},{components:a})):n.a.createElement(j,l({ref:t},p))}));function j(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,c[1]=l;for(var p=2;pfunction(e,t,a,{forcePrependBaseUrl:r=!1,absolute:b=!1}={}){if(!a)return a;if(a.startsWith("#"))return a;if(Object(n.b)(a))return a;if(r)return t+a;const c=a.startsWith(t)?a:t+a.replace(/^\//,"");return b?e+c:c}(t,e,a,r)}}function c(e,t={}){const{withBaseUrl:a}=b();return a(e,t)}},145:function(e,t,a){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function n(e){return void 0!==e&&!r(e)}a.d(t,"b",(function(){return r})),a.d(t,"a",(function(){return n}))},83:function(e,t,a){"use strict";a.r(t),a.d(t,"frontMatter",(function(){return l})),a.d(t,"metadata",(function(){return i})),a.d(t,"rightToc",(function(){return p})),a.d(t,"default",(function(){return u}));var r=a(2),n=a(6),b=(a(0),a(142)),c=a(144),l={id:"introduce",title:"1.1 \u4ecb\u7ecd",sidebar_label:"1.1 \u4ecb\u7ecd",slug:"/"},i={unversionedId:"introduce",id:"introduce",isDocsHomePage:!1,title:"1.1 \u4ecb\u7ecd",description:"=0||(n[a]=e[a]);return n}(e,t);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(n[a]=e[a])}return n}var p=n.a.createContext({}),o=function(e){var t=n.a.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},u=function(e){var t=o(e.components);return n.a.createElement(p.Provider,{value:t},e.children)},O={inlineCode:"code",wrapper:function(e){var t=e.children;return n.a.createElement(n.a.Fragment,{},t)}},m=n.a.forwardRef((function(e,t){var a=e.components,r=e.mdxType,b=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=o(a),m=r,j=u["".concat(c,".").concat(m)]||u[m]||O[m]||b;return a?n.a.createElement(j,i(i({ref:t},p),{},{components:a})):n.a.createElement(j,i({ref:t},p))}));function j(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var b=a.length,c=new Array(b);c[0]=m;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,c[1]=i;for(var p=2;p=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=r.a.createContext({}),l=function(e){var n=r.a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):b(b({},n),e)),t},d=function(e){var n=l(e.components);return r.a.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},m=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=l(t),m=a,u=d["".concat(i,".").concat(m)]||d[m]||p[m]||c;return t?r.a.createElement(u,b(b({ref:n},s),{},{components:t})):r.a.createElement(u,b({ref:n},s))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var c=t.length,i=new Array(c);i[0]=m;var b={};for(var o in n)hasOwnProperty.call(n,o)&&(b[o]=n[o]);b.originalType=e,b.mdxType="string"==typeof e?e:a,i[1]=b;for(var s=2;s\u4e3b\u5e93 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"92621-\u521b\u5efa-\u4e3b\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"9.26.2.2 \u521b\u5efa \u4ece\u5e93 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"92622-\u521b\u5efa-\u4ece\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"9.26.2.3 \u6ce8\u518c \u4e3b\u4ece\u5e93 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"92623-\u6ce8\u518c-\u4e3b\u4ece\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"9.26.2.4 \u521b\u5efa Person \u5b9e\u4f53",id:"92624-\u521b\u5efa-person-\u5b9e\u4f53",children:[]},{value:"9.26.2.5 \u5c06 Person \u8f6c\u6362\u6210\u6570\u636e\u5e93\u8868",id:"92625-\u5c06-person-\u8f6c\u6362\u6210\u6570\u636e\u5e93\u8868",children:[]},{value:"9.26.2.6 \u4f7f\u7528\u4f8b\u5b50",id:"92626-\u4f7f\u7528\u4f8b\u5b50",children:[]}]},{value:"9.26.3 \u4e3b\u4ece\u590d\u5236",id:"9263-\u4e3b\u4ece\u590d\u5236",children:[]},{value:"9.26.4 \u4e3b\u4ece\u590d\u5236\u51e0\u79cd\u65b9\u5f0f",id:"9264-\u4e3b\u4ece\u590d\u5236\u51e0\u79cd\u65b9\u5f0f",children:[{value:"9.26.4.1 \u540c\u6b65\u590d\u5236",id:"92641-\u540c\u6b65\u590d\u5236",children:[]},{value:"9.26.4.2 \u5f02\u6b65\u590d\u5236",id:"92642-\u5f02\u6b65\u590d\u5236",children:[]},{value:"9.26.4.3 \u534a\u540c\u6b65\u590d\u5236",id:"92643-\u534a\u540c\u6b65\u590d\u5236",children:[]}]},{value:"9.26.5 SqlServer \u4e3b\u5e93\u914d\u7f6e",id:"9265-sqlserver-\u4e3b\u5e93\u914d\u7f6e",children:[{value:"9.26.5.1 \u6dfb\u52a0 \u672c\u5730\u53d1\u5e03",id:"92651-\u6dfb\u52a0-\u672c\u5730\u53d1\u5e03",children:[]},{value:"9.26.5.2 \u9009\u62e9 \u5206\u53d1\u670d\u52a1\u5668",id:"92652-\u9009\u62e9-\u5206\u53d1\u670d\u52a1\u5668",children:[]},{value:"9.26.5.3 \u542f\u7528 \u4ee3\u7406",id:"92653-\u542f\u7528-\u4ee3\u7406",children:[]},{value:"9.26.5.4 \u53d1\u5e03\u6570\u636e\u5e93",id:"92654-\u53d1\u5e03\u6570\u636e\u5e93",children:[]},{value:"9.26.5.5 \u5feb\u7167\u53d1\u5e03",id:"92655-\u5feb\u7167\u53d1\u5e03",children:[]},{value:"9.26.5.6 \u9009\u62e9\u53d1\u5e03\u9879\u76ee",id:"92656-\u9009\u62e9\u53d1\u5e03\u9879\u76ee",children:[]},{value:"9.26.5.7 \u914d\u7f6e\u5206\u53d1\u8ba1\u5212",id:"92657-\u914d\u7f6e\u5206\u53d1\u8ba1\u5212",children:[]},{value:"9.26.5.8 \u914d\u7f6e\u5b89\u5168\u8bbe\u7f6e",id:"92658-\u914d\u7f6e\u5b89\u5168\u8bbe\u7f6e",children:[]},{value:"9.26.5.9 \u5b8c\u6210\u914d\u7f6e",id:"92659-\u5b8c\u6210\u914d\u7f6e",children:[]}]},{value:"9.26.6 SqlServer \u4ece\u5e93\u914d\u7f6e",id:"9266-sqlserver-\u4ece\u5e93\u914d\u7f6e",children:[{value:"9.26.6.1 \u6dfb\u52a0 \u672c\u5730\u8ba2\u9605",id:"92661-\u6dfb\u52a0-\u672c\u5730\u8ba2\u9605",children:[]},{value:"9.26.6.2 \u9009\u62e9 \u5206\u53d1\u670d\u52a1\u5668",id:"92662-\u9009\u62e9-\u5206\u53d1\u670d\u52a1\u5668",children:[]},{value:"9.26.6.3 \u9009\u62e9 \u5206\u53d1\u4ee3\u7406\u4f4d\u7f6e",id:"92663-\u9009\u62e9-\u5206\u53d1\u4ee3\u7406\u4f4d\u7f6e",children:[]},{value:"9.26.6.4 \u9009\u62e9 \u8ba2\u9605\u6570\u636e\u5e93",id:"92664-\u9009\u62e9-\u8ba2\u9605\u6570\u636e\u5e93",children:[]},{value:"9.26.6.5 \u9009\u62e9 \u5206\u53d1\u5b89\u5168\u8bbe\u7f6e",id:"92665-\u9009\u62e9-\u5206\u53d1\u5b89\u5168\u8bbe\u7f6e",children:[]},{value:"9.26.6.6 \u9009\u62e9 \u540c\u6b65\u8ba1\u5212",id:"92666-\u9009\u62e9-\u540c\u6b65\u8ba1\u5212",children:[]},{value:"9.26.6.7 \u5b8c\u6210\u8ba2\u9605",id:"92667-\u5b8c\u6210\u8ba2\u9605",children:[]}]},{value:"9.26.7 \u5206\u53d1\u5b9a\u4e49\u76d1\u89c6",id:"9267-\u5206\u53d1\u5b9a\u4e49\u76d1\u89c6",children:[]},{value:"9.26.8 \u67e5\u770b\u4e3b\u4ece\u590d\u5236\u7ed3\u679c",id:"9268-\u67e5\u770b\u4e3b\u4ece\u590d\u5236\u7ed3\u679c",children:[]},{value:"9.26.9 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9269-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],l={rightToc:s};function d(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(c.b)("wrapper",Object(a.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(c.b)("h2",{id:"9261-\u8bfb\u5199\u5206\u79bb"},"9.26.1 \u8bfb\u5199\u5206\u79bb"),Object(c.b)("p",null,"\u5176\u5b9e\u5c31\u662f\u5c06\u6570\u636e\u5e93\u5206\u4e3a\u4e86\u4e3b\u4ece\u5e93\uff0c\u4e00\u4e2a\u4e3b\u5e93\u7528\u4e8e\u5199\u6570\u636e\uff0c\u591a\u4e2a\u4ece\u5e93\u5b8c\u6210\u8bfb\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u4e3b\u4ece\u5e93\u4e4b\u95f4\u901a\u8fc7\u67d0\u79cd\u673a\u5236\u8fdb\u884c\u6570\u636e\u7684\u540c\u6b65\uff0c\u662f\u4e00\u79cd\u5e38\u89c1\u7684\u6570\u636e\u5e93\u67b6\u6784\u3002"),Object(c.b)("img",{src:Object(i.a)("img/readwrite.png"),style:{height:300}}),Object(c.b)("h3",{id:"92611-\u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898"},"9.26.1.1 \u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898"),Object(c.b)("p",null,"\u5927\u591a\u6570\u4e92\u8054\u7f51\u4e1a\u52a1\uff0c\u5f80\u5f80\u8bfb\u591a\u5199\u5c11\uff0c\u8fd9\u65f6\u5019\uff0c\u6570\u636e\u5e93\u7684\u8bfb\u4f1a\u9996\u5148\u6210\u4e3a\u6570\u636e\u5e93\u7684\u74f6\u9888\uff0c\u8fd9\u65f6\uff0c\u5982\u679c\u6211\u4eec\u5e0c\u671b\u80fd\u591f\u7ebf\u6027\u7684\u63d0\u5347\u6570\u636e\u5e93\u7684\u8bfb\u6027\u80fd\uff0c\u6d88\u9664\u8bfb\u5199\u9501\u51b2\u7a81\u4ece\u800c\u63d0\u5347\u6570\u636e\u5e93\u7684\u5199\u6027\u80fd\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u4f7f\u7528\u201c\u5206\u7ec4\u67b6\u6784\u201d\uff08\u8bfb\u5199\u5206\u79bb\u67b6\u6784\uff09\u3002"),Object(c.b)("p",null,"\u7528\u4e00\u53e5\u8bdd\u6982\u62ec\uff0c\u8bfb\u5199\u5206\u79bb\u662f\u7528\u6765\u89e3\u51b3\u6570\u636e\u5e93\u7684\u8bfb\u6027\u80fd\u74f6\u9888\u7684\u3002"),Object(c.b)("h3",{id:"92612-\u6ce8\u610f\u4e8b\u9879"},"9.26.1.2 \u6ce8\u610f\u4e8b\u9879"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},"\u6570\u636e\u5e93\u8fde\u63a5\u6c60\u8981\u8fdb\u884c\u533a\u5206\uff0c\u54ea\u4e9b\u662f\u8bfb\u8fde\u63a5\u6c60\uff0c\u54ea\u4e2a\u662f\u5199\u8fde\u63a5\u6c60\uff0c\u7814\u53d1\u7684\u96be\u5ea6\u4f1a\u589e\u52a0\uff1b"),Object(c.b)("li",{parentName:"ul"},"\u4e3a\u4e86\u4fdd\u8bc1\u9ad8\u53ef\u7528\uff0c\u8bfb\u8fde\u63a5\u6c60\u8981\u80fd\u591f\u5b9e\u73b0\u6545\u969c\u81ea\u52a8\u8f6c\u79fb\uff1b"),Object(c.b)("li",{parentName:"ul"},"\u4e3b\u4ece\u7684\u4e00\u81f4\u6027\u95ee\u9898\u9700\u8981\u8003\u8651\u3002")),Object(c.b)("h2",{id:"9262-\u5982\u4f55\u5b9e\u73b0"},"9.26.2 \u5982\u4f55\u5b9e\u73b0"),Object(c.b)("p",null,Object(c.b)("inlineCode",{parentName:"p"},"Fur")," \u5728\u6570\u636e\u5e93\u6a21\u5757\u8bbe\u8ba1\u4e4b\u521d\uff0c\u5c31\u8003\u8651\u4e86\u8bfb\u5199\u5206\u79bb\u8fd9\u79cd\u60c5\u51b5\uff0c\u6240\u4ee5\u4ece\u5e95\u5c42\u5c31\u652f\u6301\u52a8\u6001\u5207\u6362\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u53ca\u8bfb\u5199\u64cd\u4f5c\u65b9\u6cd5\u7ea6\u675f\u3002"),Object(c.b)("p",null,"\u8bfb\u5199\u5206\u79bb\u64cd\u4f5c\u4e3b\u8981\u4f7f\u7528 ",Object(c.b)("inlineCode",{parentName:"p"},"IMSRepository")," \u4ed3\u50a8\uff0c\u8be5\u4ed3\u50a8\u5df2\u7ecf\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u65b9\u4fbf\u7684\u64cd\u4f5c\u8c03\u7528\u3002\u5f53\u7136\u4e5f\u53ef\u4ee5\u4e0d\u4f7f\u7528\u8be5\u4ed3\u50a8\u3002"),Object(c.b)("p",null,"\u4e0b\u9762\u5c31\u7ed9\u5927\u5bb6\u6f14\u793a\u5982\u4f55\u8bfb\u5199\u591a\u5e93\u8bfb\u5199\u64cd\u4f5c\u3002"),Object(c.b)("h3",{id:"92621-\u521b\u5efa-\u4e3b\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.26.2.1 \u521b\u5efa ",Object(c.b)("inlineCode",{parentName:"h3"},"\u4e3b\u5e93")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n /// \n /// \u4e3b\u5e93\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\n /// \n [AppDbContext("MasterConnectionString")]\n public class MasterDbContext : AppDbContext\n {\n public MasterDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff1a")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "ConnectionStrings": {\n "MasterConnectionString": "Server=localhost;Database=Fur;User=sa;Password=000000;MultipleActiveResultSets=True;"\n }\n}\n')),Object(c.b)("h3",{id:"92622-\u521b\u5efa-\u4ece\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.26.2.2 \u521b\u5efa ",Object(c.b)("inlineCode",{parentName:"h3"},"\u4ece\u5e93")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{11}","{11}":!0}),'using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n /// \n /// \u4ece\u5e93\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\n /// \n [AppDbContext("SlaveConnectionString")]\n public class SlaveDbContext : AppDbContext\n {\n public SlaveDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(c.b)("div",{className:"admonition admonition-important alert alert--info"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u591a\u6570\u636e\u5e93\u64cd\u4f5c\u9664\u4e86\u9ed8\u8ba4\u6570\u636e\u5e93\u65e0\u9700\u81ea\u5b9a\u4e49 ",Object(c.b)("strong",{parentName:"p"},"\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668"),"\uff0c\u5176\u4ed6\u6570\u636e\u5e93\u90fd\u9700\u8981\u6709\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u3002\u5982 ",Object(c.b)("inlineCode",{parentName:"p"},"SlaveDbContextLocator")))),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u4ece\u5e93\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\uff1a")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{8}","{8}":!0}),"using Fur.DatabaseAccessor;\n\nnamespace Fur.Core\n{\n /// \n /// \u4ece\u5e93\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\n /// \n public class SlaveDbContextLocator : IDbContextLocator\n {\n }\n}\n")),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff1a")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "ConnectionStrings": {\n "SlaveConnectionString": "Server=localhost;Database=FurSlave;User=sa;Password=000000;MultipleActiveResultSets=True;"\n }\n}\n')),Object(c.b)("h3",{id:"92623-\u6ce8\u518c-\u4e3b\u4ece\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.26.2.3 \u6ce8\u518c ",Object(c.b)("inlineCode",{parentName:"h3"},"\u4e3b\u4ece\u5e93")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{13-14}","{13-14}":!0}),"using Fur.Core;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n services.AddSqlServerPool();\n services.AddSqlServerPool();\n });\n }\n }\n}\n")),Object(c.b)("h3",{id:"92624-\u521b\u5efa-person-\u5b9e\u4f53"},"9.26.2.4 \u521b\u5efa ",Object(c.b)("inlineCode",{parentName:"h3"},"Person")," \u5b9e\u4f53"),Object(c.b)("p",null,"\u7531\u4e8e ",Object(c.b)("inlineCode",{parentName:"p"},"\u4e3b\u4ece\u5e93")," \u5177\u6709\u76f8\u540c\u7684\u6570\u636e\u5e93\u7ed3\u6784\uff0c\u6240\u4ee5\u5b9e\u4f53\u4e5f\u5fc5\u987b\u58f0\u660e ",Object(c.b)("inlineCode",{parentName:"p"},"\u4e3b\u4ece\u5e93"),"\uff1a"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7}","{7}":!0}),"using Fur.DatabaseAccessor;\nusing System.ComponentModel.DataAnnotations;\nusing System.ComponentModel.DataAnnotations.Schema;\n\nnamespace Fur.Core\n{\n public class Person : IEntity\n {\n /// \n /// \u4e3b\u952eId\n /// \n [Key]\n [DatabaseGenerated(DatabaseGeneratedOption.Identity)]\n public int Id { get; set; }\n\n /// \n /// \u540d\u79f0\n /// \n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n }\n}\n")),Object(c.b)("h3",{id:"92625-\u5c06-person-\u8f6c\u6362\u6210\u6570\u636e\u5e93\u8868"},"9.26.2.5 \u5c06 ",Object(c.b)("inlineCode",{parentName:"h3"},"Person")," \u8f6c\u6362\u6210\u6570\u636e\u5e93\u8868"),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u521b\u5efa\u4e3b\u5e93\u6570\u636e\u5e93\u8868\uff1a")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration v0.0.1 -Context MasterDbContext\n")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database -Context MasterDbContext\n")),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u521b\u5efa\u4ece\u5e93\u6570\u636e\u5e93\u8868\uff1a")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration v0.0.1 -Context SlaveDbContext\n")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database -Context SlaveDbContext\n")),Object(c.b)("img",{src:Object(i.a)("img/readwrite1.png")}),Object(c.b)("img",{src:Object(i.a)("img/readwrite2.png")}),Object(c.b)("h3",{id:"92626-\u4f7f\u7528\u4f8b\u5b50"},"9.26.2.6 \u4f7f\u7528\u4f8b\u5b50"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{13,19,31,40}","{13,19,31,40}":!0}),'using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DynamicApiController;\nusing System.Collections.Generic;\n\nnamespace Fur.Application\n{\n public class PersonService : IDynamicApiController\n {\n /// \n /// \u53ef\u8c03\u914d\u4ed3\u50a8\uff08\u8bfb\u5199\u5206\u79bb\uff09\n /// \n private readonly IMSRepository _msRepository;\n\n /// \n /// \u6784\u9020\u51fd\u6570\u521d\u59cb\u5316\n /// \n /// \n public PersonService(IMSRepository msRepository)\n {\n _msRepository = msRepository;\n }\n\n /// \n /// \u65b0\u589e\u8d70\u4e3b\u5e93\n /// \n /// \n /// \n public void Insert(Person person)\n {\n _msRepository.Master().Insert(person);\n }\n\n /// \n /// \u67e5\u8be2\u8d70\u4ece\u5e93\n /// \n /// \n public List Get()\n {\n return _msRepository.Slave1().AsEnumerable();\n }\n }\n}\n')),Object(c.b)("h2",{id:"9263-\u4e3b\u4ece\u590d\u5236"},"9.26.3 \u4e3b\u4ece\u590d\u5236"),Object(c.b)("p",null,"\u4e3b\u4ece\u590d\u5236\uff1a\u662f\u4e00\u79cd\u6570\u636e\u5907\u4efd\u7684\u65b9\u6848\u3002"),Object(c.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u662f\u4f7f\u7528\u4e24\u4e2a\u6216\u4e24\u4e2a\u4ee5\u4e0a\u76f8\u540c\u7684\u6570\u636e\u5e93\uff0c\u5c06\u4e00\u4e2a\u6570\u636e\u5e93\u5f53\u505a\u4e3b\u6570\u636e\u5e93\uff0c\u800c\u53e6\u4e00\u4e2a\u6570\u636e\u5e93\u5f53\u505a\u4ece\u6570\u636e\u5e93\u3002",Object(c.b)("strong",{parentName:"p"},"\u5728\u4e3b\u6570\u636e\u5e93\u4e2d\u8fdb\u884c\u76f8\u5e94\u64cd\u4f5c\u65f6\uff0c\u4ece\u6570\u636e\u5e93\u8bb0\u5f55\u4e0b\u6240\u6709\u4e3b\u6570\u636e\u5e93\u7684\u64cd\u4f5c\uff0c\u4f7f\u5176\u4e8c\u8005\u4e00\u6a21\u4e00\u6837\u3002")),Object(c.b)("h2",{id:"9264-\u4e3b\u4ece\u590d\u5236\u51e0\u79cd\u65b9\u5f0f"},"9.26.4 \u4e3b\u4ece\u590d\u5236\u51e0\u79cd\u65b9\u5f0f"),Object(c.b)("h3",{id:"92641-\u540c\u6b65\u590d\u5236"},"9.26.4.1 \u540c\u6b65\u590d\u5236"),Object(c.b)("p",null,"\u6240\u8c13\u7684\u540c\u6b65\u590d\u5236\uff0c\u610f\u601d\u662f ",Object(c.b)("inlineCode",{parentName:"p"},"Master")," \u7684\u53d8\u5316\uff0c\u5fc5\u987b\u7b49\u5f85 ",Object(c.b)("inlineCode",{parentName:"p"},"Slave-1\uff0cSlave-2\uff0c...\uff0cSlave-n")," \u5b8c\u6210\u540e\u624d\u80fd\u8fd4\u56de\u3002\n\u8fd9\u6837\uff0c\u663e\u7136\u4e0d\u53ef\u53d6\uff0c\u6bd4\u5982\uff0c\u5728 ",Object(c.b)("inlineCode",{parentName:"p"},"Web")," \u524d\u7aef\u9875\u9762\u4e0a\uff0c\u7528\u6237\u589e\u52a0\u4e86\u6761\u8bb0\u5f55\uff0c\u9700\u8981\u7b49\u5f85\u5f88\u957f\u65f6\u95f4\u3002"),Object(c.b)("h3",{id:"92642-\u5f02\u6b65\u590d\u5236"},"9.26.4.2 \u5f02\u6b65\u590d\u5236"),Object(c.b)("p",null,"\u5982\u540c AJAX \u8bf7\u6c42\u4e00\u6837\u3002",Object(c.b)("inlineCode",{parentName:"p"},"Master")," \u53ea\u9700\u8981\u5b8c\u6210\u81ea\u5df1\u7684\u6570\u636e\u5e93\u64cd\u4f5c\u5373\u53ef\u3002\u81f3\u4e8e ",Object(c.b)("inlineCode",{parentName:"p"},"Slaves")," \u662f\u5426\u6536\u5230\u4e8c\u8fdb\u5236\u65e5\u5fd7\uff0c\u662f\u5426\u5b8c\u6210\u64cd\u4f5c\uff0c\u4e0d\u7528\u5173\u5fc3\u3002",Object(c.b)("strong",{parentName:"p"},"\uff08\u63a8\u8350\u65b9\u5f0f\uff09")),Object(c.b)("h3",{id:"92643-\u534a\u540c\u6b65\u590d\u5236"},"9.26.4.3 \u534a\u540c\u6b65\u590d\u5236"),Object(c.b)("p",null,Object(c.b)("inlineCode",{parentName:"p"},"Master")," \u53ea\u4fdd\u8bc1 ",Object(c.b)("inlineCode",{parentName:"p"},"Slaves")," \u4e2d\u7684\u4e00\u4e2a\u64cd\u4f5c\u6210\u529f\uff0c\u5c31\u8fd4\u56de\uff0c\u5176\u4ed6 ",Object(c.b)("inlineCode",{parentName:"p"},"Slave")," \u4e0d\u7ba1\u3002"),Object(c.b)("p",null,"\u4e0b\u9762\u5c06\u4f7f\u7528 ",Object(c.b)("inlineCode",{parentName:"p"},"SqlServer")," \u7b80\u5355\u914d\u7f6e\u4e3b\u4ece\u590d\u5236\u529f\u80fd\u3002"),Object(c.b)("h2",{id:"9265-sqlserver-\u4e3b\u5e93\u914d\u7f6e"},"9.26.5 ",Object(c.b)("inlineCode",{parentName:"h2"},"SqlServer")," \u4e3b\u5e93\u914d\u7f6e"),Object(c.b)("h3",{id:"92651-\u6dfb\u52a0-\u672c\u5730\u53d1\u5e03"},"9.26.5.1 \u6dfb\u52a0 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u672c\u5730\u53d1\u5e03")),Object(c.b)("img",{src:Object(i.a)("img/dbcopy1.png")}),Object(c.b)("h3",{id:"92652-\u9009\u62e9-\u5206\u53d1\u670d\u52a1\u5668"},"9.26.5.2 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u5206\u53d1\u670d\u52a1\u5668")),Object(c.b)("img",{src:Object(i.a)("img/dbcopy2.png")}),Object(c.b)("h3",{id:"92653-\u542f\u7528-\u4ee3\u7406"},"9.26.5.3 \u542f\u7528 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u4ee3\u7406")),Object(c.b)("img",{src:Object(i.a)("img/dbcopy3.png")}),Object(c.b)("h3",{id:"92654-\u53d1\u5e03\u6570\u636e\u5e93"},"9.26.5.4 \u53d1\u5e03\u6570\u636e\u5e93"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy4.png")}),Object(c.b)("h3",{id:"92655-\u5feb\u7167\u53d1\u5e03"},"9.26.5.5 \u5feb\u7167\u53d1\u5e03"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy5.png")}),Object(c.b)("p",null,"\u5177\u4f53\u9009\u62e9\u4f55\u79cd\u53d1\u5e03\u7c7b\u578b\uff0c\u89c6\u5177\u4f53\u4e1a\u52a1\u573a\u666f\u800c\u5b9a\u3002"),Object(c.b)("h3",{id:"92656-\u9009\u62e9\u53d1\u5e03\u9879\u76ee"},"9.26.5.6 \u9009\u62e9\u53d1\u5e03\u9879\u76ee"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy6.png")}),Object(c.b)("h3",{id:"92657-\u914d\u7f6e\u5206\u53d1\u8ba1\u5212"},"9.26.5.7 \u914d\u7f6e\u5206\u53d1\u8ba1\u5212"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy7.png")}),Object(c.b)("img",{src:Object(i.a)("img/dbcopy8.png")}),Object(c.b)("h3",{id:"92658-\u914d\u7f6e\u5b89\u5168\u8bbe\u7f6e"},"9.26.5.8 \u914d\u7f6e\u5b89\u5168\u8bbe\u7f6e"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy9.png")}),Object(c.b)("img",{src:Object(i.a)("img/dbcopy10.png")}),Object(c.b)("h3",{id:"92659-\u5b8c\u6210\u914d\u7f6e"},"9.26.5.9 \u5b8c\u6210\u914d\u7f6e"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy11.png")}),Object(c.b)("img",{src:Object(i.a)("img/dbcopy12.png")}),Object(c.b)("h2",{id:"9266-sqlserver-\u4ece\u5e93\u914d\u7f6e"},"9.26.6 ",Object(c.b)("inlineCode",{parentName:"h2"},"SqlServer")," \u4ece\u5e93\u914d\u7f6e"),Object(c.b)("h3",{id:"92661-\u6dfb\u52a0-\u672c\u5730\u8ba2\u9605"},"9.26.6.1 \u6dfb\u52a0 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u672c\u5730\u8ba2\u9605")),Object(c.b)("img",{src:Object(i.a)("img/dbrece1.png")}),Object(c.b)("h3",{id:"92662-\u9009\u62e9-\u5206\u53d1\u670d\u52a1\u5668"},"9.26.6.2 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u5206\u53d1\u670d\u52a1\u5668")),Object(c.b)("img",{src:Object(i.a)("img/dbrece2.png")}),Object(c.b)("h3",{id:"92663-\u9009\u62e9-\u5206\u53d1\u4ee3\u7406\u4f4d\u7f6e"},"9.26.6.3 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u5206\u53d1\u4ee3\u7406\u4f4d\u7f6e")),Object(c.b)("img",{src:Object(i.a)("img/dbrece3.png")}),Object(c.b)("h3",{id:"92664-\u9009\u62e9-\u8ba2\u9605\u6570\u636e\u5e93"},"9.26.6.4 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u8ba2\u9605\u6570\u636e\u5e93")),Object(c.b)("img",{src:Object(i.a)("img/dbrece4.png")}),Object(c.b)("h3",{id:"92665-\u9009\u62e9-\u5206\u53d1\u5b89\u5168\u8bbe\u7f6e"},"9.26.6.5 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u5206\u53d1\u5b89\u5168\u8bbe\u7f6e")),Object(c.b)("img",{src:Object(i.a)("img/dbrece5.png")}),Object(c.b)("img",{src:Object(i.a)("img/dbrece6.png")}),Object(c.b)("h3",{id:"92666-\u9009\u62e9-\u540c\u6b65\u8ba1\u5212"},"9.26.6.6 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u540c\u6b65\u8ba1\u5212")),Object(c.b)("img",{src:Object(i.a)("img/dbrece7.png")}),Object(c.b)("h3",{id:"92667-\u5b8c\u6210\u8ba2\u9605"},"9.26.6.7 \u5b8c\u6210\u8ba2\u9605"),Object(c.b)("img",{src:Object(i.a)("img/dbrece8.png")}),Object(c.b)("h2",{id:"9267-\u5206\u53d1\u5b9a\u4e49\u76d1\u89c6"},"9.26.7 \u5206\u53d1\u5b9a\u4e49\u76d1\u89c6"),Object(c.b)("img",{src:Object(i.a)("img/dbrece9.png")}),Object(c.b)("h2",{id:"9268-\u67e5\u770b\u4e3b\u4ece\u590d\u5236\u7ed3\u679c"},"9.26.8 \u67e5\u770b\u4e3b\u4ece\u590d\u5236\u7ed3\u679c"),Object(c.b)("img",{src:Object(i.a)("img/dbrece10.png")}),Object(c.b)("img",{src:Object(i.a)("img/dbrece11.png")}),Object(c.b)("div",{className:"admonition admonition-important alert alert--info"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u7279\u6027")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},'\u4e3b\u4ece\u590d\u5236\u6709\u4e00\u5b9a\u8fdf\u5ef6\u6027\uff0c\u6240\u4ee5\u7cfb\u7edf\u8bbe\u8ba1\u8981\u6709\u4e00\u5b9a\u201c\u5bb9\u5fcd\u6027"\u3002'))),Object(c.b)("h2",{id:"9269-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.26.9 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/4dbcf072.ceefa0fc.js b/docs/4dbcf072.ceefa0fc.js new file mode 100644 index 00000000000..065182ed58d --- /dev/null +++ b/docs/4dbcf072.ceefa0fc.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[29],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return d})),t.d(n,"b",(function(){return u}));var a=t(0),r=t.n(a);function c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function b(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=r.a.createContext({}),l=function(e){var n=r.a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):b(b({},n),e)),t},d=function(e){var n=l(e.components);return r.a.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},m=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=l(t),m=a,u=d["".concat(i,".").concat(m)]||d[m]||p[m]||c;return t?r.a.createElement(u,b(b({ref:n},s),{},{components:t})):r.a.createElement(u,b({ref:n},s))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var c=t.length,i=new Array(c);i[0]=m;var b={};for(var o in n)hasOwnProperty.call(n,o)&&(b[o]=n[o]);b.originalType=e,b.mdxType="string"==typeof e?e:a,i[1]=b;for(var s=2;sfunction(e,n,t,{forcePrependBaseUrl:a=!1,absolute:c=!1}={}){if(!t)return t;if(t.startsWith("#"))return t;if(Object(r.b)(t))return t;if(a)return n+t;const i=t.startsWith(n)?t:n+t.replace(/^\//,"");return c?e+i:i}(n,e,t,a)}}function i(e,n={}){const{withBaseUrl:t}=c();return t(e,n)}},145:function(e,n,t){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function r(e){return void 0!==e&&!a(e)}t.d(n,"b",(function(){return a})),t.d(n,"a",(function(){return r}))},84:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return b})),t.d(n,"metadata",(function(){return o})),t.d(n,"rightToc",(function(){return s})),t.d(n,"default",(function(){return d}));var a=t(2),r=t(6),c=(t(0),t(142)),i=t(144),b={id:"dbcontext-read-write",title:"9.26 \u8bfb\u5199\u5206\u79bb/\u4e3b\u4ece\u590d\u5236",sidebar_label:"9.26 \u8bfb\u5199\u5206\u79bb/\u4e3b\u4ece\u590d\u5236"},o={unversionedId:"dbcontext-read-write",id:"dbcontext-read-write",isDocsHomePage:!1,title:"9.26 \u8bfb\u5199\u5206\u79bb/\u4e3b\u4ece\u590d\u5236",description:"9.26.1 \u8bfb\u5199\u5206\u79bb",source:"@site/docs\\dbcontext-read-write.mdx",slug:"/dbcontext-read-write",permalink:"/docs/dbcontext-read-write",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/dbcontext-read-write.mdx",version:"current",sidebar_label:"9.26 \u8bfb\u5199\u5206\u79bb/\u4e3b\u4ece\u590d\u5236",sidebar:"docs",previous:{title:"9.25 \u4e8b\u52a1\u548c\u5de5\u4f5c\u5355\u5143",permalink:"/docs/tran"},next:{title:"9.27 \u5206\u8868\u5206\u5e93",permalink:"/docs/split-db"}},s=[{value:"9.26.1 \u8bfb\u5199\u5206\u79bb",id:"9261-\u8bfb\u5199\u5206\u79bb",children:[{value:"9.26.1.1 \u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898",id:"92611-\u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898",children:[]},{value:"9.26.1.2 \u6ce8\u610f\u4e8b\u9879",id:"92612-\u6ce8\u610f\u4e8b\u9879",children:[]}]},{value:"9.26.2 \u5982\u4f55\u5b9e\u73b0",id:"9262-\u5982\u4f55\u5b9e\u73b0",children:[{value:"9.26.2.1 \u521b\u5efa \u4e3b\u5e93 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"92621-\u521b\u5efa-\u4e3b\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"9.26.2.2 \u521b\u5efa \u4ece\u5e93 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"92622-\u521b\u5efa-\u4ece\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"9.26.2.3 \u6ce8\u518c \u4e3b\u4ece\u5e93 \u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"92623-\u6ce8\u518c-\u4e3b\u4ece\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"9.26.2.4 \u521b\u5efa Person \u5b9e\u4f53",id:"92624-\u521b\u5efa-person-\u5b9e\u4f53",children:[]},{value:"9.26.2.5 \u5c06 Person \u8f6c\u6362\u6210\u6570\u636e\u5e93\u8868",id:"92625-\u5c06-person-\u8f6c\u6362\u6210\u6570\u636e\u5e93\u8868",children:[]},{value:"9.26.2.6 \u4f7f\u7528\u4f8b\u5b50",id:"92626-\u4f7f\u7528\u4f8b\u5b50",children:[]}]},{value:"9.26.3 \u4e3b\u4ece\u590d\u5236",id:"9263-\u4e3b\u4ece\u590d\u5236",children:[]},{value:"9.26.4 \u4e3b\u4ece\u590d\u5236\u51e0\u79cd\u65b9\u5f0f",id:"9264-\u4e3b\u4ece\u590d\u5236\u51e0\u79cd\u65b9\u5f0f",children:[{value:"9.26.4.1 \u540c\u6b65\u590d\u5236",id:"92641-\u540c\u6b65\u590d\u5236",children:[]},{value:"9.26.4.2 \u5f02\u6b65\u590d\u5236",id:"92642-\u5f02\u6b65\u590d\u5236",children:[]},{value:"9.26.4.3 \u534a\u540c\u6b65\u590d\u5236",id:"92643-\u534a\u540c\u6b65\u590d\u5236",children:[]}]},{value:"9.26.5 SqlServer \u4e3b\u5e93\u914d\u7f6e",id:"9265-sqlserver-\u4e3b\u5e93\u914d\u7f6e",children:[{value:"9.26.5.1 \u6dfb\u52a0 \u672c\u5730\u53d1\u5e03",id:"92651-\u6dfb\u52a0-\u672c\u5730\u53d1\u5e03",children:[]},{value:"9.26.5.2 \u9009\u62e9 \u5206\u53d1\u670d\u52a1\u5668",id:"92652-\u9009\u62e9-\u5206\u53d1\u670d\u52a1\u5668",children:[]},{value:"9.26.5.3 \u542f\u7528 \u4ee3\u7406",id:"92653-\u542f\u7528-\u4ee3\u7406",children:[]},{value:"9.26.5.4 \u53d1\u5e03\u6570\u636e\u5e93",id:"92654-\u53d1\u5e03\u6570\u636e\u5e93",children:[]},{value:"9.26.5.5 \u5feb\u7167\u53d1\u5e03",id:"92655-\u5feb\u7167\u53d1\u5e03",children:[]},{value:"9.26.5.6 \u9009\u62e9\u53d1\u5e03\u9879\u76ee",id:"92656-\u9009\u62e9\u53d1\u5e03\u9879\u76ee",children:[]},{value:"9.26.5.7 \u914d\u7f6e\u5206\u53d1\u8ba1\u5212",id:"92657-\u914d\u7f6e\u5206\u53d1\u8ba1\u5212",children:[]},{value:"9.26.5.8 \u914d\u7f6e\u5b89\u5168\u8bbe\u7f6e",id:"92658-\u914d\u7f6e\u5b89\u5168\u8bbe\u7f6e",children:[]},{value:"9.26.5.9 \u5b8c\u6210\u914d\u7f6e",id:"92659-\u5b8c\u6210\u914d\u7f6e",children:[]}]},{value:"9.26.6 SqlServer \u4ece\u5e93\u914d\u7f6e",id:"9266-sqlserver-\u4ece\u5e93\u914d\u7f6e",children:[{value:"9.26.6.1 \u6dfb\u52a0 \u672c\u5730\u8ba2\u9605",id:"92661-\u6dfb\u52a0-\u672c\u5730\u8ba2\u9605",children:[]},{value:"9.26.6.2 \u9009\u62e9 \u5206\u53d1\u670d\u52a1\u5668",id:"92662-\u9009\u62e9-\u5206\u53d1\u670d\u52a1\u5668",children:[]},{value:"9.26.6.3 \u9009\u62e9 \u5206\u53d1\u4ee3\u7406\u4f4d\u7f6e",id:"92663-\u9009\u62e9-\u5206\u53d1\u4ee3\u7406\u4f4d\u7f6e",children:[]},{value:"9.26.6.4 \u9009\u62e9 \u8ba2\u9605\u6570\u636e\u5e93",id:"92664-\u9009\u62e9-\u8ba2\u9605\u6570\u636e\u5e93",children:[]},{value:"9.26.6.5 \u9009\u62e9 \u5206\u53d1\u5b89\u5168\u8bbe\u7f6e",id:"92665-\u9009\u62e9-\u5206\u53d1\u5b89\u5168\u8bbe\u7f6e",children:[]},{value:"9.26.6.6 \u9009\u62e9 \u540c\u6b65\u8ba1\u5212",id:"92666-\u9009\u62e9-\u540c\u6b65\u8ba1\u5212",children:[]},{value:"9.26.6.7 \u5b8c\u6210\u8ba2\u9605",id:"92667-\u5b8c\u6210\u8ba2\u9605",children:[]}]},{value:"9.26.7 \u5206\u53d1\u5b9a\u4e49\u76d1\u89c6",id:"9267-\u5206\u53d1\u5b9a\u4e49\u76d1\u89c6",children:[]},{value:"9.26.8 \u67e5\u770b\u4e3b\u4ece\u590d\u5236\u7ed3\u679c",id:"9268-\u67e5\u770b\u4e3b\u4ece\u590d\u5236\u7ed3\u679c",children:[]},{value:"9.26.9 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9269-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],l={rightToc:s};function d(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(c.b)("wrapper",Object(a.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(c.b)("h2",{id:"9261-\u8bfb\u5199\u5206\u79bb"},"9.26.1 \u8bfb\u5199\u5206\u79bb"),Object(c.b)("p",null,"\u5176\u5b9e\u5c31\u662f\u5c06\u6570\u636e\u5e93\u5206\u4e3a\u4e86\u4e3b\u4ece\u5e93\uff0c\u4e00\u4e2a\u4e3b\u5e93\u7528\u4e8e\u5199\u6570\u636e\uff0c\u591a\u4e2a\u4ece\u5e93\u5b8c\u6210\u8bfb\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u4e3b\u4ece\u5e93\u4e4b\u95f4\u901a\u8fc7\u67d0\u79cd\u673a\u5236\u8fdb\u884c\u6570\u636e\u7684\u540c\u6b65\uff0c\u662f\u4e00\u79cd\u5e38\u89c1\u7684\u6570\u636e\u5e93\u67b6\u6784\u3002"),Object(c.b)("img",{src:Object(i.a)("img/readwrite.png"),style:{height:300}}),Object(c.b)("h3",{id:"92611-\u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898"},"9.26.1.1 \u89e3\u51b3\u4e86\u4ec0\u4e48\u95ee\u9898"),Object(c.b)("p",null,"\u5927\u591a\u6570\u4e92\u8054\u7f51\u4e1a\u52a1\uff0c\u5f80\u5f80\u8bfb\u591a\u5199\u5c11\uff0c\u8fd9\u65f6\u5019\uff0c\u6570\u636e\u5e93\u7684\u8bfb\u4f1a\u9996\u5148\u6210\u4e3a\u6570\u636e\u5e93\u7684\u74f6\u9888\uff0c\u8fd9\u65f6\uff0c\u5982\u679c\u6211\u4eec\u5e0c\u671b\u80fd\u591f\u7ebf\u6027\u7684\u63d0\u5347\u6570\u636e\u5e93\u7684\u8bfb\u6027\u80fd\uff0c\u6d88\u9664\u8bfb\u5199\u9501\u51b2\u7a81\u4ece\u800c\u63d0\u5347\u6570\u636e\u5e93\u7684\u5199\u6027\u80fd\uff0c\u90a3\u4e48\u5c31\u53ef\u4ee5\u4f7f\u7528\u201c\u5206\u7ec4\u67b6\u6784\u201d\uff08\u8bfb\u5199\u5206\u79bb\u67b6\u6784\uff09\u3002"),Object(c.b)("p",null,"\u7528\u4e00\u53e5\u8bdd\u6982\u62ec\uff0c\u8bfb\u5199\u5206\u79bb\u662f\u7528\u6765\u89e3\u51b3\u6570\u636e\u5e93\u7684\u8bfb\u6027\u80fd\u74f6\u9888\u7684\u3002"),Object(c.b)("h3",{id:"92612-\u6ce8\u610f\u4e8b\u9879"},"9.26.1.2 \u6ce8\u610f\u4e8b\u9879"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},"\u6570\u636e\u5e93\u8fde\u63a5\u6c60\u8981\u8fdb\u884c\u533a\u5206\uff0c\u54ea\u4e9b\u662f\u8bfb\u8fde\u63a5\u6c60\uff0c\u54ea\u4e2a\u662f\u5199\u8fde\u63a5\u6c60\uff0c\u7814\u53d1\u7684\u96be\u5ea6\u4f1a\u589e\u52a0\uff1b"),Object(c.b)("li",{parentName:"ul"},"\u4e3a\u4e86\u4fdd\u8bc1\u9ad8\u53ef\u7528\uff0c\u8bfb\u8fde\u63a5\u6c60\u8981\u80fd\u591f\u5b9e\u73b0\u6545\u969c\u81ea\u52a8\u8f6c\u79fb\uff1b"),Object(c.b)("li",{parentName:"ul"},"\u4e3b\u4ece\u7684\u4e00\u81f4\u6027\u95ee\u9898\u9700\u8981\u8003\u8651\u3002")),Object(c.b)("h2",{id:"9262-\u5982\u4f55\u5b9e\u73b0"},"9.26.2 \u5982\u4f55\u5b9e\u73b0"),Object(c.b)("p",null,Object(c.b)("inlineCode",{parentName:"p"},"Fur")," \u5728\u6570\u636e\u5e93\u6a21\u5757\u8bbe\u8ba1\u4e4b\u521d\uff0c\u5c31\u8003\u8651\u4e86\u8bfb\u5199\u5206\u79bb\u8fd9\u79cd\u60c5\u51b5\uff0c\u6240\u4ee5\u4ece\u5e95\u5c42\u5c31\u652f\u6301\u52a8\u6001\u5207\u6362\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u53ca\u8bfb\u5199\u64cd\u4f5c\u65b9\u6cd5\u7ea6\u675f\u3002"),Object(c.b)("p",null,"\u8bfb\u5199\u5206\u79bb\u64cd\u4f5c\u4e3b\u8981\u4f7f\u7528 ",Object(c.b)("inlineCode",{parentName:"p"},"IMSRepository")," \u4ed3\u50a8\uff0c\u8be5\u4ed3\u50a8\u5df2\u7ecf\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u65b9\u4fbf\u7684\u64cd\u4f5c\u8c03\u7528\u3002\u5f53\u7136\u4e5f\u53ef\u4ee5\u4e0d\u4f7f\u7528\u8be5\u4ed3\u50a8\u3002"),Object(c.b)("p",null,"\u4e0b\u9762\u5c31\u7ed9\u5927\u5bb6\u6f14\u793a\u5982\u4f55\u8bfb\u5199\u591a\u5e93\u8bfb\u5199\u64cd\u4f5c\u3002"),Object(c.b)("h3",{id:"92621-\u521b\u5efa-\u4e3b\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.26.2.1 \u521b\u5efa ",Object(c.b)("inlineCode",{parentName:"h3"},"\u4e3b\u5e93")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n /// \n /// \u4e3b\u5e93\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\n /// \n [AppDbContext("MasterConnectionString")]\n public class MasterDbContext : AppDbContext\n {\n public MasterDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff1a")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "ConnectionStrings": {\n "MasterConnectionString": "Server=localhost;Database=Fur;User=sa;Password=000000;MultipleActiveResultSets=True;"\n }\n}\n')),Object(c.b)("h3",{id:"92622-\u521b\u5efa-\u4ece\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.26.2.2 \u521b\u5efa ",Object(c.b)("inlineCode",{parentName:"h3"},"\u4ece\u5e93")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{11}","{11}":!0}),'using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n /// \n /// \u4ece\u5e93\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\n /// \n [AppDbContext("SlaveConnectionString")]\n public class SlaveDbContext : AppDbContext\n {\n public SlaveDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(c.b)("div",{className:"admonition admonition-important alert alert--info"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u591a\u6570\u636e\u5e93\u64cd\u4f5c\u9664\u4e86\u9ed8\u8ba4\u6570\u636e\u5e93\u65e0\u9700\u81ea\u5b9a\u4e49 ",Object(c.b)("strong",{parentName:"p"},"\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668"),"\uff0c\u5176\u4ed6\u6570\u636e\u5e93\u90fd\u9700\u8981\u6709\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u3002\u5982 ",Object(c.b)("inlineCode",{parentName:"p"},"SlaveDbContextLocator")))),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u4ece\u5e93\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\uff1a")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{8}","{8}":!0}),"using Fur.DatabaseAccessor;\n\nnamespace Fur.Core\n{\n /// \n /// \u4ece\u5e93\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\n /// \n public class SlaveDbContextLocator : IDbContextLocator\n {\n }\n}\n")),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff1a")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "ConnectionStrings": {\n "SlaveConnectionString": "Server=localhost;Database=FurSlave;User=sa;Password=000000;MultipleActiveResultSets=True;"\n }\n}\n')),Object(c.b)("h3",{id:"92623-\u6ce8\u518c-\u4e3b\u4ece\u5e93-\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"9.26.2.3 \u6ce8\u518c ",Object(c.b)("inlineCode",{parentName:"h3"},"\u4e3b\u4ece\u5e93")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{13-14}","{13-14}":!0}),"using Fur.Core;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n services.AddSqlServerPool();\n services.AddSqlServerPool();\n });\n }\n }\n}\n")),Object(c.b)("h3",{id:"92624-\u521b\u5efa-person-\u5b9e\u4f53"},"9.26.2.4 \u521b\u5efa ",Object(c.b)("inlineCode",{parentName:"h3"},"Person")," \u5b9e\u4f53"),Object(c.b)("p",null,"\u7531\u4e8e ",Object(c.b)("inlineCode",{parentName:"p"},"\u4e3b\u4ece\u5e93")," \u5177\u6709\u76f8\u540c\u7684\u6570\u636e\u5e93\u7ed3\u6784\uff0c\u6240\u4ee5\u5b9e\u4f53\u4e5f\u5fc5\u987b\u58f0\u660e ",Object(c.b)("inlineCode",{parentName:"p"},"\u4e3b\u4ece\u5e93"),"\uff1a"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{7}","{7}":!0}),"using Fur.DatabaseAccessor;\nusing System.ComponentModel.DataAnnotations;\nusing System.ComponentModel.DataAnnotations.Schema;\n\nnamespace Fur.Core\n{\n public class Person : IEntity\n {\n /// \n /// \u4e3b\u952eId\n /// \n [Key]\n [DatabaseGenerated(DatabaseGeneratedOption.Identity)]\n public int Id { get; set; }\n\n /// \n /// \u540d\u79f0\n /// \n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n }\n}\n")),Object(c.b)("h3",{id:"92625-\u5c06-person-\u8f6c\u6362\u6210\u6570\u636e\u5e93\u8868"},"9.26.2.5 \u5c06 ",Object(c.b)("inlineCode",{parentName:"h3"},"Person")," \u8f6c\u6362\u6210\u6570\u636e\u5e93\u8868"),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u521b\u5efa\u4e3b\u5e93\u6570\u636e\u5e93\u8868\uff1a")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration v0.0.1 -Context MasterDbContext\n")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database -Context MasterDbContext\n")),Object(c.b)("p",null,Object(c.b)("strong",{parentName:"p"},"\u521b\u5efa\u4ece\u5e93\u6570\u636e\u5e93\u8868\uff1a")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration v0.0.1 -Context SlaveDbContext\n")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database -Context SlaveDbContext\n")),Object(c.b)("img",{src:Object(i.a)("img/readwrite1.png")}),Object(c.b)("img",{src:Object(i.a)("img/readwrite2.png")}),Object(c.b)("h3",{id:"92626-\u4f7f\u7528\u4f8b\u5b50"},"9.26.2.6 \u4f7f\u7528\u4f8b\u5b50"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{13,19,31,40}","{13,19,31,40}":!0}),'using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DynamicApiController;\nusing System.Collections.Generic;\n\nnamespace Fur.Application\n{\n public class PersonService : IDynamicApiController\n {\n /// \n /// \u53ef\u8c03\u914d\u4ed3\u50a8\uff08\u8bfb\u5199\u5206\u79bb\uff09\n /// \n private readonly IMSRepository _msRepository;\n\n /// \n /// \u6784\u9020\u51fd\u6570\u521d\u59cb\u5316\n /// \n /// \n public PersonService(IMSRepository msRepository)\n {\n _msRepository = msRepository;\n }\n\n /// \n /// \u65b0\u589e\u8d70\u4e3b\u5e93\n /// \n /// \n /// \n public void Insert(Person person)\n {\n _msRepository.Master().Insert(person);\n }\n\n /// \n /// \u67e5\u8be2\u8d70\u4ece\u5e93\n /// \n /// \n public List Get()\n {\n return _msRepository.Slave1().AsEnumerable();\n }\n }\n}\n')),Object(c.b)("h2",{id:"9263-\u4e3b\u4ece\u590d\u5236"},"9.26.3 \u4e3b\u4ece\u590d\u5236"),Object(c.b)("p",null,"\u4e3b\u4ece\u590d\u5236\uff1a\u662f\u4e00\u79cd\u6570\u636e\u5907\u4efd\u7684\u65b9\u6848\u3002"),Object(c.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u662f\u4f7f\u7528\u4e24\u4e2a\u6216\u4e24\u4e2a\u4ee5\u4e0a\u76f8\u540c\u7684\u6570\u636e\u5e93\uff0c\u5c06\u4e00\u4e2a\u6570\u636e\u5e93\u5f53\u505a\u4e3b\u6570\u636e\u5e93\uff0c\u800c\u53e6\u4e00\u4e2a\u6570\u636e\u5e93\u5f53\u505a\u4ece\u6570\u636e\u5e93\u3002",Object(c.b)("strong",{parentName:"p"},"\u5728\u4e3b\u6570\u636e\u5e93\u4e2d\u8fdb\u884c\u76f8\u5e94\u64cd\u4f5c\u65f6\uff0c\u4ece\u6570\u636e\u5e93\u8bb0\u5f55\u4e0b\u6240\u6709\u4e3b\u6570\u636e\u5e93\u7684\u64cd\u4f5c\uff0c\u4f7f\u5176\u4e8c\u8005\u4e00\u6a21\u4e00\u6837\u3002")),Object(c.b)("h2",{id:"9264-\u4e3b\u4ece\u590d\u5236\u51e0\u79cd\u65b9\u5f0f"},"9.26.4 \u4e3b\u4ece\u590d\u5236\u51e0\u79cd\u65b9\u5f0f"),Object(c.b)("h3",{id:"92641-\u540c\u6b65\u590d\u5236"},"9.26.4.1 \u540c\u6b65\u590d\u5236"),Object(c.b)("p",null,"\u6240\u8c13\u7684\u540c\u6b65\u590d\u5236\uff0c\u610f\u601d\u662f ",Object(c.b)("inlineCode",{parentName:"p"},"Master")," \u7684\u53d8\u5316\uff0c\u5fc5\u987b\u7b49\u5f85 ",Object(c.b)("inlineCode",{parentName:"p"},"Slave-1\uff0cSlave-2\uff0c...\uff0cSlave-n")," \u5b8c\u6210\u540e\u624d\u80fd\u8fd4\u56de\u3002\n\u8fd9\u6837\uff0c\u663e\u7136\u4e0d\u53ef\u53d6\uff0c\u6bd4\u5982\uff0c\u5728 ",Object(c.b)("inlineCode",{parentName:"p"},"Web")," \u524d\u7aef\u9875\u9762\u4e0a\uff0c\u7528\u6237\u589e\u52a0\u4e86\u6761\u8bb0\u5f55\uff0c\u9700\u8981\u7b49\u5f85\u5f88\u957f\u65f6\u95f4\u3002"),Object(c.b)("h3",{id:"92642-\u5f02\u6b65\u590d\u5236"},"9.26.4.2 \u5f02\u6b65\u590d\u5236"),Object(c.b)("p",null,"\u5982\u540c AJAX \u8bf7\u6c42\u4e00\u6837\u3002",Object(c.b)("inlineCode",{parentName:"p"},"Master")," \u53ea\u9700\u8981\u5b8c\u6210\u81ea\u5df1\u7684\u6570\u636e\u5e93\u64cd\u4f5c\u5373\u53ef\u3002\u81f3\u4e8e ",Object(c.b)("inlineCode",{parentName:"p"},"Slaves")," \u662f\u5426\u6536\u5230\u4e8c\u8fdb\u5236\u65e5\u5fd7\uff0c\u662f\u5426\u5b8c\u6210\u64cd\u4f5c\uff0c\u4e0d\u7528\u5173\u5fc3\u3002",Object(c.b)("strong",{parentName:"p"},"\uff08\u63a8\u8350\u65b9\u5f0f\uff09")),Object(c.b)("h3",{id:"92643-\u534a\u540c\u6b65\u590d\u5236"},"9.26.4.3 \u534a\u540c\u6b65\u590d\u5236"),Object(c.b)("p",null,Object(c.b)("inlineCode",{parentName:"p"},"Master")," \u53ea\u4fdd\u8bc1 ",Object(c.b)("inlineCode",{parentName:"p"},"Slaves")," \u4e2d\u7684\u4e00\u4e2a\u64cd\u4f5c\u6210\u529f\uff0c\u5c31\u8fd4\u56de\uff0c\u5176\u4ed6 ",Object(c.b)("inlineCode",{parentName:"p"},"Slave")," \u4e0d\u7ba1\u3002"),Object(c.b)("p",null,"\u4e0b\u9762\u5c06\u4f7f\u7528 ",Object(c.b)("inlineCode",{parentName:"p"},"SqlServer")," \u7b80\u5355\u914d\u7f6e\u4e3b\u4ece\u590d\u5236\u529f\u80fd\u3002"),Object(c.b)("h2",{id:"9265-sqlserver-\u4e3b\u5e93\u914d\u7f6e"},"9.26.5 ",Object(c.b)("inlineCode",{parentName:"h2"},"SqlServer")," \u4e3b\u5e93\u914d\u7f6e"),Object(c.b)("h3",{id:"92651-\u6dfb\u52a0-\u672c\u5730\u53d1\u5e03"},"9.26.5.1 \u6dfb\u52a0 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u672c\u5730\u53d1\u5e03")),Object(c.b)("img",{src:Object(i.a)("img/dbcopy1.png")}),Object(c.b)("h3",{id:"92652-\u9009\u62e9-\u5206\u53d1\u670d\u52a1\u5668"},"9.26.5.2 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u5206\u53d1\u670d\u52a1\u5668")),Object(c.b)("img",{src:Object(i.a)("img/dbcopy2.png")}),Object(c.b)("h3",{id:"92653-\u542f\u7528-\u4ee3\u7406"},"9.26.5.3 \u542f\u7528 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u4ee3\u7406")),Object(c.b)("img",{src:Object(i.a)("img/dbcopy3.png")}),Object(c.b)("h3",{id:"92654-\u53d1\u5e03\u6570\u636e\u5e93"},"9.26.5.4 \u53d1\u5e03\u6570\u636e\u5e93"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy4.png")}),Object(c.b)("h3",{id:"92655-\u5feb\u7167\u53d1\u5e03"},"9.26.5.5 \u5feb\u7167\u53d1\u5e03"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy5.png")}),Object(c.b)("p",null,"\u5177\u4f53\u9009\u62e9\u4f55\u79cd\u53d1\u5e03\u7c7b\u578b\uff0c\u89c6\u5177\u4f53\u4e1a\u52a1\u573a\u666f\u800c\u5b9a\u3002"),Object(c.b)("h3",{id:"92656-\u9009\u62e9\u53d1\u5e03\u9879\u76ee"},"9.26.5.6 \u9009\u62e9\u53d1\u5e03\u9879\u76ee"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy6.png")}),Object(c.b)("h3",{id:"92657-\u914d\u7f6e\u5206\u53d1\u8ba1\u5212"},"9.26.5.7 \u914d\u7f6e\u5206\u53d1\u8ba1\u5212"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy7.png")}),Object(c.b)("img",{src:Object(i.a)("img/dbcopy8.png")}),Object(c.b)("h3",{id:"92658-\u914d\u7f6e\u5b89\u5168\u8bbe\u7f6e"},"9.26.5.8 \u914d\u7f6e\u5b89\u5168\u8bbe\u7f6e"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy9.png")}),Object(c.b)("img",{src:Object(i.a)("img/dbcopy10.png")}),Object(c.b)("h3",{id:"92659-\u5b8c\u6210\u914d\u7f6e"},"9.26.5.9 \u5b8c\u6210\u914d\u7f6e"),Object(c.b)("img",{src:Object(i.a)("img/dbcopy11.png")}),Object(c.b)("img",{src:Object(i.a)("img/dbcopy12.png")}),Object(c.b)("h2",{id:"9266-sqlserver-\u4ece\u5e93\u914d\u7f6e"},"9.26.6 ",Object(c.b)("inlineCode",{parentName:"h2"},"SqlServer")," \u4ece\u5e93\u914d\u7f6e"),Object(c.b)("h3",{id:"92661-\u6dfb\u52a0-\u672c\u5730\u8ba2\u9605"},"9.26.6.1 \u6dfb\u52a0 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u672c\u5730\u8ba2\u9605")),Object(c.b)("img",{src:Object(i.a)("img/dbrece1.png")}),Object(c.b)("h3",{id:"92662-\u9009\u62e9-\u5206\u53d1\u670d\u52a1\u5668"},"9.26.6.2 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u5206\u53d1\u670d\u52a1\u5668")),Object(c.b)("img",{src:Object(i.a)("img/dbrece2.png")}),Object(c.b)("h3",{id:"92663-\u9009\u62e9-\u5206\u53d1\u4ee3\u7406\u4f4d\u7f6e"},"9.26.6.3 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u5206\u53d1\u4ee3\u7406\u4f4d\u7f6e")),Object(c.b)("img",{src:Object(i.a)("img/dbrece3.png")}),Object(c.b)("h3",{id:"92664-\u9009\u62e9-\u8ba2\u9605\u6570\u636e\u5e93"},"9.26.6.4 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u8ba2\u9605\u6570\u636e\u5e93")),Object(c.b)("img",{src:Object(i.a)("img/dbrece4.png")}),Object(c.b)("h3",{id:"92665-\u9009\u62e9-\u5206\u53d1\u5b89\u5168\u8bbe\u7f6e"},"9.26.6.5 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u5206\u53d1\u5b89\u5168\u8bbe\u7f6e")),Object(c.b)("img",{src:Object(i.a)("img/dbrece5.png")}),Object(c.b)("img",{src:Object(i.a)("img/dbrece6.png")}),Object(c.b)("h3",{id:"92666-\u9009\u62e9-\u540c\u6b65\u8ba1\u5212"},"9.26.6.6 \u9009\u62e9 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u540c\u6b65\u8ba1\u5212")),Object(c.b)("img",{src:Object(i.a)("img/dbrece7.png")}),Object(c.b)("h3",{id:"92667-\u5b8c\u6210\u8ba2\u9605"},"9.26.6.7 \u5b8c\u6210\u8ba2\u9605"),Object(c.b)("img",{src:Object(i.a)("img/dbrece8.png")}),Object(c.b)("h2",{id:"9267-\u5206\u53d1\u5b9a\u4e49\u76d1\u89c6"},"9.26.7 \u5206\u53d1\u5b9a\u4e49\u76d1\u89c6"),Object(c.b)("img",{src:Object(i.a)("img/dbrece9.png")}),Object(c.b)("h2",{id:"9268-\u67e5\u770b\u4e3b\u4ece\u590d\u5236\u7ed3\u679c"},"9.26.8 \u67e5\u770b\u4e3b\u4ece\u590d\u5236\u7ed3\u679c"),Object(c.b)("img",{src:Object(i.a)("img/dbrece10.png")}),Object(c.b)("img",{src:Object(i.a)("img/dbrece11.png")}),Object(c.b)("div",{className:"admonition admonition-important alert alert--info"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u7279\u6027")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},'\u4e3b\u4ece\u590d\u5236\u6709\u4e00\u5b9a\u8fdf\u5ef6\u6027\uff0c\u6240\u4ee5\u7cfb\u7edf\u8bbe\u8ba1\u8981\u6709\u4e00\u5b9a\u201c\u5bb9\u5fcd\u6027"\u3002'))),Object(c.b)("h2",{id:"9269-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.26.9 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/4e3694ae.befe978c.js b/docs/4e3694ae.8a08238f.js similarity index 68% rename from docs/4e3694ae.befe978c.js rename to docs/4e3694ae.8a08238f.js index ff9403b7ce2..f53f1b4d83b 100644 --- a/docs/4e3694ae.befe978c.js +++ b/docs/4e3694ae.8a08238f.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[30],{86:function(o){o.exports=JSON.parse('{"allTagsPath":"/blog/tags","slug":"furos","name":"furos","count":1,"permalink":"/blog/tags/furos"}')}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[30],{85:function(o){o.exports=JSON.parse('{"allTagsPath":"/blog/tags","slug":"furos","name":"furos","count":1,"permalink":"/blog/tags/furos"}')}}]); \ No newline at end of file diff --git a/docs/59d16f51.17fe308b.js b/docs/59d16f51.17fe308b.js deleted file mode 100644 index bcd40f97134..00000000000 --- a/docs/59d16f51.17fe308b.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[31],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"b",(function(){return m}));var r=n(0),a=n.n(r);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var b=a.a.createContext({}),s=function(e){var t=a.a.useContext(b),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},u=function(e){var t=s(e.components);return a.a.createElement(b.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},p=a.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,b=l(e,["components","mdxType","originalType","parentName"]),u=s(n),p=r,m=u["".concat(i,".").concat(p)]||u[p]||d[p]||o;return n?a.a.createElement(m,c(c({ref:t},b),{},{components:n})):a.a.createElement(m,c({ref:t},b))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=p;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var b=2;bFur \u652f\u6301\u6570\u636e\u5e93\u63d0\u4f9b\u5668",id:"9181-fur-\u652f\u6301\u6570\u636e\u5e93\u63d0\u4f9b\u5668",children:[{value:"9.18.1.1 \u6570\u636e\u5e93\u63d0\u4f9b\u5668\u5bf9\u5e94\u5305",id:"91811-\u6570\u636e\u5e93\u63d0\u4f9b\u5668\u5bf9\u5e94\u5305",children:[]}]},{value:"9.18.2 \u591a\u6570\u636e\u5e93\u670d\u52a1\u6ce8\u518c",id:"9182-\u591a\u6570\u636e\u5e93\u670d\u52a1\u6ce8\u518c",children:[]},{value:"9.18.3 \u591a\u6570\u636e\u5e93\u4f7f\u7528\u65b9\u5f0f",id:"9183-\u591a\u6570\u636e\u5e93\u4f7f\u7528\u65b9\u5f0f",children:[{value:"9.18.3.1 \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f",id:"91831-\u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f",children:[]},{value:"9.18.3.2 \u975e\u6cdb\u578b\u4ed3\u50a8\u65b9\u5f0f",id:"91832-\u975e\u6cdb\u578b\u4ed3\u50a8\u65b9\u5f0f",children:[]},{value:"9.18.3.3 Sql \u4ed3\u50a8\u65b9\u5f0f",id:"91833-sql-\u4ed3\u50a8\u65b9\u5f0f",children:[]},{value:"9.18.3.4 \u5b9e\u4f53\u5b9a\u4e49\u65b9\u5f0f",id:"91834-\u5b9e\u4f53\u5b9a\u4e49\u65b9\u5f0f",children:[]},{value:"9.18.3.5 Linq \u51fd\u6570\u65b9\u5f0f",id:"91835-linq-\u51fd\u6570\u65b9\u5f0f",children:[]}]},{value:"9.18.4 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9184-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],b={rightToc:l};function s(e){var t=e.components,n=Object(a.a)(e,["components"]);return Object(o.b)("wrapper",Object(r.a)({},b,n,{components:t,mdxType:"MDXLayout"}),Object(o.b)("h2",{id:"9181-fur-\u652f\u6301\u6570\u636e\u5e93\u63d0\u4f9b\u5668"},"9.18.1 ",Object(o.b)("inlineCode",{parentName:"h2"},"Fur")," \u652f\u6301\u6570\u636e\u5e93\u63d0\u4f9b\u5668"),Object(o.b)("table",null,Object(o.b)("thead",{parentName:"table"},Object(o.b)("tr",{parentName:"thead"},Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"SqlServer"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Sqlite"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Cosmos"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"InMemoryDatabase"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"MySql"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"PostgreSQL"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Oracle"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Firebird"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Dm"))),Object(o.b)("tbody",{parentName:"table"},Object(o.b)("tr",{parentName:"tbody"},Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714")))),Object(o.b)("h3",{id:"91811-\u6570\u636e\u5e93\u63d0\u4f9b\u5668\u5bf9\u5e94\u5305"},"9.18.1.1 \u6570\u636e\u5e93\u63d0\u4f9b\u5668\u5bf9\u5e94\u5305"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"SqlServer"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.SqlServer")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"Sqlite"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Sqlite")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"Cosmos"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Cosmos")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"InMemoryDatabase"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.InMemory")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"MySql"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Pomelo.EntityFrameworkCore.MySql")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"PostgreSQL"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Npgsql.EntityFrameworkCore.PostgreSQL")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"Oracle"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Citms.EntityFrameworkCore.Oracle")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"Firebird"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"FirebirdSql.EntityFrameworkCore.Firebird")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"Dm"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Dm"))),Object(o.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(o.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u8fd9\u4e9b\u6570\u636e\u5e93\u5305\u5e94\u8be5\u5b89\u88c5\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u5c42\u3002"))),Object(o.b)("h2",{id:"9182-\u591a\u6570\u636e\u5e93\u670d\u52a1\u6ce8\u518c"},"9.18.2 \u591a\u6570\u636e\u5e93\u670d\u52a1\u6ce8\u518c"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u6ce8\u518c SqlServer\noptions.AddDbPool(DbProvider.SqlServer);\n\n// \u6ce8\u518c Sqlite\noptions.AddDbPool(DbProvider.Sqlite);\n\n// \u6ce8\u518c Cosmos\noptions.AddDbPool(DbProvider.Cosmos);\n\n// \u6ce8\u518c InMemoryDatabase\noptions.AddDbPool(DbProvider.InMemoryDatabase);\n\n// \u6ce8\u518c MySql\noptions.AddDbPool(DbProvider.MySql);\n\n// \u6ce8\u518c PostgreSQL\noptions.AddDb(DbProvider.Npgsql);\n\n// \u6ce8\u518c Oracle\noptions.AddDbPool(DbProvider.Oracle);\n\n// \u6ce8\u518c Firebird\noptions.AddDbPool(DbProvider.Firebird);\n\n// \u6ce8\u518c Dm\noptions.AddDbPool(DbProvider.Dm);\n")),Object(o.b)("h2",{id:"9183-\u591a\u6570\u636e\u5e93\u4f7f\u7528\u65b9\u5f0f"},"9.18.3 \u591a\u6570\u636e\u5e93\u4f7f\u7528\u65b9\u5f0f"),Object(o.b)("p",null,Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u901a\u8fc7\u72ec\u521b\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668")," \u5b9e\u73b0\u591a\u6570\u636e\u5e93\u7075\u6d3b\u64cd\u4f5c\u5207\u6362\u3002\u53ea\u9700\u8981\u4e3a\u6bcf\u4e00\u79cd\u6570\u636e\u5e93\u7ed1\u5b9a\u552f\u4e00\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u5373\u53ef\u3002"),Object(o.b)("p",null,"\u4ee5\u4e0b\u662f ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u652f\u6301\u591a\u6570\u636e\u5e93\u64cd\u4f5c\u7684\u5b9e\u4f8b\uff1a"),Object(o.b)("h3",{id:"91831-\u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f"},"9.18.3.1 \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u5207\u6362\u5230 MSSQL \u64cd\u4f5c Person\u8868\nvar mssqlRepository = personRepository.Change();\n\n// \u5207\u6362\u5230 MySql \u64cd\u4f5c Person\u8868\nvar mysqlRepository = personRepository.Change();\n\n// \u5207\u6362\u5230 Sqlite \u64cd\u4f5c Person\u8868\nvar sqliteRepository = personRepository.Change();\n\n")),Object(o.b)("h3",{id:"91832-\u975e\u6cdb\u578b\u4ed3\u50a8\u65b9\u5f0f"},"9.18.3.2 \u975e\u6cdb\u578b\u4ed3\u50a8\u65b9\u5f0f"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u5207\u6362\u5230 MSSQL \u64cd\u4f5c Person\u8868\nvar mssqlRepository = repository.Change();\n\n// \u5207\u6362\u5230 MySql \u64cd\u4f5c Person\u8868\nvar mysqlRepository = repository.Change();\n\n// \u5207\u6362\u5230 Sqlite \u64cd\u4f5c Person\u8868\nvar sqliteRepository = repository.Change();\n")),Object(o.b)("h3",{id:"91833-sql-\u4ed3\u50a8\u65b9\u5f0f"},"9.18.3.3 ",Object(o.b)("inlineCode",{parentName:"h3"},"Sql")," \u4ed3\u50a8\u65b9\u5f0f"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u5207\u6362\u5230 MSSQL \u64cd\u4f5c Person\u8868\nvar mssqlRepository = sqlRepository.Change();\n\n// \u5207\u6362\u5230 MySql \u64cd\u4f5c Person\u8868\nvar mysqlRepository = sqlRepository.Change();\n\n// \u5207\u6362\u5230 Sqlite \u64cd\u4f5c Person\u8868\nvar sqliteRepository = sqlRepository.Change();\n")),Object(o.b)("h3",{id:"91834-\u5b9e\u4f53\u5b9a\u4e49\u65b9\u5f0f"},"9.18.3.4 \u5b9e\u4f53\u5b9a\u4e49\u65b9\u5f0f"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"\n// \u652f\u6301\u4e00\u4e2a\u6570\u636e\u5e93\npublic class Person: IEntity\n{\n // ....\n}\n\n// \u652f\u6301\u591a\u4e2a\u6570\u636e\u5e93\npublic class Person: IEntity\n{\n // ....\n}\n")),Object(o.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(o.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u6240\u6709\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"\u5b9e\u4f53\u4f9d\u8d56\u63a5\u53e3\u6216\u62bd\u8c61\u7c7b")," \u90fd\u652f\u6301\u6cdb\u578b\u65b9\u5f0f \u6307\u5b9a \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\uff0c\u6700\u591a\u652f\u6301 ",Object(o.b)("inlineCode",{parentName:"p"},"8")," \u4e2a\u3002"))),Object(o.b)("h3",{id:"91835-linq-\u51fd\u6570\u65b9\u5f0f"},"9.18.3.5 Linq \u51fd\u6570\u65b9\u5f0f"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'public static class QueryFunctions\n{\n [QueryableFunction("FN_GetId", "dbo", typeof(MySqlDbContextLocator), typeof(SqliteDbContextLocator))]\n public static int GetId(int id) => throw new NotSupportedException();\n}\n')),Object(o.b)("h2",{id:"9184-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.18.4 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(o.b)("a",Object(r.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/59d16f51.db2a93e5.js b/docs/59d16f51.db2a93e5.js new file mode 100644 index 00000000000..4ba39c2ec69 --- /dev/null +++ b/docs/59d16f51.db2a93e5.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[31],{142:function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return m}));var r=n(0),a=n.n(r);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var b=a.a.createContext({}),s=function(e){var t=a.a.useContext(b),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},d=function(e){var t=s(e.components);return a.a.createElement(b.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},p=a.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,b=l(e,["components","mdxType","originalType","parentName"]),d=s(n),p=r,m=d["".concat(i,".").concat(p)]||d[p]||u[p]||o;return n?a.a.createElement(m,c(c({ref:t},b),{},{components:n})):a.a.createElement(m,c({ref:t},b))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=p;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var b=2;bfunction(e,t,n,{forcePrependBaseUrl:r=!1,absolute:o=!1}={}){if(!n)return n;if(n.startsWith("#"))return n;if(Object(a.b)(n))return n;if(r)return t+n;const i=n.startsWith(t)?n:t+n.replace(/^\//,"");return o?e+i:i}(t,e,n,r)}}function i(e,t={}){const{withBaseUrl:n}=o();return n(e,t)}},145:function(e,t,n){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return a}))},146:function(e,t,n){"use strict";function r(e){var t,n,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;tt.value===e)&&j(e)}const N=e=>{j(e),null!=u&&m(u,e)},y=[],h=e=>{e.metaKey||e.altKey||e.ctrlKey||f(!0)},g=()=>{f(!1)};return Object(r.useEffect)(()=>{window.addEventListener("keydown",h),window.addEventListener("mousedown",g)},[]),a.a.createElement("div",null,a.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(i.a)("tabs",{"tabs--block":t})},d.map(({value:e,label:t})=>a.a.createElement("li",{role:"tab",tabIndex:0,"aria-selected":O===e,className:Object(i.a)("tabs__item",l.a.tabItem,{"tabs__item--active":O===e}),style:v?{}:{outline:"none"},key:e,ref:e=>y.push(e),onKeyDown:e=>{((e,t,n)=>{switch(n.keyCode){case s:((e,t)=>{const n=e.indexOf(t)+1;e[n]?e[n].focus():e[0].focus()})(e,t);break;case b:((e,t)=>{const n=e.indexOf(t)-1;e[n]?e[n].focus():e[e.length-1].focus()})(e,t)}})(y,e.target,e),h(e)},onFocus:()=>N(e),onClick:()=>{N(e),f(!1)},onPointerDown:()=>f(!1)},t))),a.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},r.Children.toArray(n).filter(e=>e.props.value===O)[0]))}},150:function(e,t,n){"use strict";var r=n(0),a=n.n(r);t.a=function(e){return a.a.createElement("div",null,e.children)}},86:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return i})),n.d(t,"metadata",(function(){return c})),n.d(t,"rightToc",(function(){return l})),n.d(t,"default",(function(){return s}));var r=n(2),a=n(6),o=(n(0),n(142)),i=(n(144),n(149),n(150),{id:"dbcontext-multi-database",title:"9.18 \u591a\u6570\u636e\u5e93\u64cd\u4f5c",sidebar_label:"9.18 \u591a\u6570\u636e\u5e93\u64cd\u4f5c"}),c={unversionedId:"dbcontext-multi-database",id:"dbcontext-multi-database",isDocsHomePage:!1,title:"9.18 \u591a\u6570\u636e\u5e93\u64cd\u4f5c",description:"9.18.1 Fur \u652f\u6301\u6570\u636e\u5e93\u63d0\u4f9b\u5668",source:"@site/docs\\dbcontext-multi-database.mdx",slug:"/dbcontext-multi-database",permalink:"/docs/dbcontext-multi-database",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/dbcontext-multi-database.mdx",version:"current",sidebar_label:"9.18 \u591a\u6570\u636e\u5e93\u64cd\u4f5c",sidebar:"docs",previous:{title:"9.17 Sql \u9ad8\u7ea7\u4ee3\u7406",permalink:"/docs/dbcontext-sql-proxy"},next:{title:"9.19 \u6570\u636e\u5e93\u751f\u6210\u6a21\u578b",permalink:"/docs/dbcontext-db-first"}},l=[{value:"9.18.1 Fur \u652f\u6301\u6570\u636e\u5e93\u63d0\u4f9b\u5668",id:"9181-fur-\u652f\u6301\u6570\u636e\u5e93\u63d0\u4f9b\u5668",children:[{value:"9.18.1.1 \u6570\u636e\u5e93\u63d0\u4f9b\u5668\u5bf9\u5e94\u5305",id:"91811-\u6570\u636e\u5e93\u63d0\u4f9b\u5668\u5bf9\u5e94\u5305",children:[]}]},{value:"9.18.2 \u591a\u6570\u636e\u5e93\u670d\u52a1\u6ce8\u518c",id:"9182-\u591a\u6570\u636e\u5e93\u670d\u52a1\u6ce8\u518c",children:[]},{value:"9.18.3 \u591a\u6570\u636e\u5e93\u4f7f\u7528\u65b9\u5f0f",id:"9183-\u591a\u6570\u636e\u5e93\u4f7f\u7528\u65b9\u5f0f",children:[{value:"9.18.3.1 \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f",id:"91831-\u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f",children:[]},{value:"9.18.3.2 \u975e\u6cdb\u578b\u4ed3\u50a8\u65b9\u5f0f",id:"91832-\u975e\u6cdb\u578b\u4ed3\u50a8\u65b9\u5f0f",children:[]},{value:"9.18.3.3 Sql \u4ed3\u50a8\u65b9\u5f0f",id:"91833-sql-\u4ed3\u50a8\u65b9\u5f0f",children:[]},{value:"9.18.3.4 \u5b9e\u4f53\u5b9a\u4e49\u65b9\u5f0f",id:"91834-\u5b9e\u4f53\u5b9a\u4e49\u65b9\u5f0f",children:[]},{value:"9.18.3.5 Linq \u51fd\u6570\u65b9\u5f0f",id:"91835-linq-\u51fd\u6570\u65b9\u5f0f",children:[]}]},{value:"9.18.4 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9184-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],b={rightToc:l};function s(e){var t=e.components,n=Object(a.a)(e,["components"]);return Object(o.b)("wrapper",Object(r.a)({},b,n,{components:t,mdxType:"MDXLayout"}),Object(o.b)("h2",{id:"9181-fur-\u652f\u6301\u6570\u636e\u5e93\u63d0\u4f9b\u5668"},"9.18.1 ",Object(o.b)("inlineCode",{parentName:"h2"},"Fur")," \u652f\u6301\u6570\u636e\u5e93\u63d0\u4f9b\u5668"),Object(o.b)("table",null,Object(o.b)("thead",{parentName:"table"},Object(o.b)("tr",{parentName:"thead"},Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"SqlServer"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Sqlite"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Cosmos"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"InMemoryDatabase"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"MySql"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"PostgreSQL"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Oracle"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Firebird"),Object(o.b)("th",Object(r.a)({parentName:"tr"},{align:null}),"Dm"))),Object(o.b)("tbody",{parentName:"table"},Object(o.b)("tr",{parentName:"tbody"},Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714"),Object(o.b)("td",Object(r.a)({parentName:"tr"},{align:null}),"\u2714")))),Object(o.b)("h3",{id:"91811-\u6570\u636e\u5e93\u63d0\u4f9b\u5668\u5bf9\u5e94\u5305"},"9.18.1.1 \u6570\u636e\u5e93\u63d0\u4f9b\u5668\u5bf9\u5e94\u5305"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"SqlServer"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.SqlServer")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"Sqlite"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Sqlite")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"Cosmos"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Cosmos")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"InMemoryDatabase"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.InMemory")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"MySql"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Pomelo.EntityFrameworkCore.MySql")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"PostgreSQL"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Npgsql.EntityFrameworkCore.PostgreSQL")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"Oracle"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Citms.EntityFrameworkCore.Oracle")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"Firebird"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"FirebirdSql.EntityFrameworkCore.Firebird")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"Dm"),"\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Dm"))),Object(o.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(o.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u8fd9\u4e9b\u6570\u636e\u5e93\u5305\u5e94\u8be5\u5b89\u88c5\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u5c42\u3002"))),Object(o.b)("h2",{id:"9182-\u591a\u6570\u636e\u5e93\u670d\u52a1\u6ce8\u518c"},"9.18.2 \u591a\u6570\u636e\u5e93\u670d\u52a1\u6ce8\u518c"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u6ce8\u518c SqlServer\noptions.AddDbPool(DbProvider.SqlServer);\n\n// \u6ce8\u518c Sqlite\noptions.AddDbPool(DbProvider.Sqlite);\n\n// \u6ce8\u518c Cosmos\noptions.AddDbPool(DbProvider.Cosmos);\n\n// \u6ce8\u518c InMemoryDatabase\noptions.AddDbPool(DbProvider.InMemoryDatabase);\n\n// \u6ce8\u518c MySql\noptions.AddDbPool(DbProvider.MySql);\n\n// \u6ce8\u518c PostgreSQL\noptions.AddDb(DbProvider.Npgsql);\n\n// \u6ce8\u518c Oracle\noptions.AddDbPool(DbProvider.Oracle);\n\n// \u6ce8\u518c Firebird\noptions.AddDbPool(DbProvider.Firebird);\n\n// \u6ce8\u518c Dm\noptions.AddDbPool(DbProvider.Dm);\n")),Object(o.b)("h2",{id:"9183-\u591a\u6570\u636e\u5e93\u4f7f\u7528\u65b9\u5f0f"},"9.18.3 \u591a\u6570\u636e\u5e93\u4f7f\u7528\u65b9\u5f0f"),Object(o.b)("p",null,Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u901a\u8fc7\u72ec\u521b\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668")," \u5b9e\u73b0\u591a\u6570\u636e\u5e93\u7075\u6d3b\u64cd\u4f5c\u5207\u6362\u3002\u53ea\u9700\u8981\u4e3a\u6bcf\u4e00\u79cd\u6570\u636e\u5e93\u7ed1\u5b9a\u552f\u4e00\u7684\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\u5373\u53ef\u3002"),Object(o.b)("p",null,"\u4ee5\u4e0b\u662f ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u652f\u6301\u591a\u6570\u636e\u5e93\u64cd\u4f5c\u7684\u5b9e\u4f8b\uff1a"),Object(o.b)("h3",{id:"91831-\u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f"},"9.18.3.1 \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u5207\u6362\u5230 MSSQL \u64cd\u4f5c Person\u8868\nvar mssqlRepository = personRepository.Change();\n\n// \u5207\u6362\u5230 MySql \u64cd\u4f5c Person\u8868\nvar mysqlRepository = personRepository.Change();\n\n// \u5207\u6362\u5230 Sqlite \u64cd\u4f5c Person\u8868\nvar sqliteRepository = personRepository.Change();\n\n")),Object(o.b)("h3",{id:"91832-\u975e\u6cdb\u578b\u4ed3\u50a8\u65b9\u5f0f"},"9.18.3.2 \u975e\u6cdb\u578b\u4ed3\u50a8\u65b9\u5f0f"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u5207\u6362\u5230 MSSQL \u64cd\u4f5c Person\u8868\nvar mssqlRepository = repository.Change();\n\n// \u5207\u6362\u5230 MySql \u64cd\u4f5c Person\u8868\nvar mysqlRepository = repository.Change();\n\n// \u5207\u6362\u5230 Sqlite \u64cd\u4f5c Person\u8868\nvar sqliteRepository = repository.Change();\n")),Object(o.b)("h3",{id:"91833-sql-\u4ed3\u50a8\u65b9\u5f0f"},"9.18.3.3 ",Object(o.b)("inlineCode",{parentName:"h3"},"Sql")," \u4ed3\u50a8\u65b9\u5f0f"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"// \u5207\u6362\u5230 MSSQL \u64cd\u4f5c Person\u8868\nvar mssqlRepository = sqlRepository.Change();\n\n// \u5207\u6362\u5230 MySql \u64cd\u4f5c Person\u8868\nvar mysqlRepository = sqlRepository.Change();\n\n// \u5207\u6362\u5230 Sqlite \u64cd\u4f5c Person\u8868\nvar sqliteRepository = sqlRepository.Change();\n")),Object(o.b)("h3",{id:"91834-\u5b9e\u4f53\u5b9a\u4e49\u65b9\u5f0f"},"9.18.3.4 \u5b9e\u4f53\u5b9a\u4e49\u65b9\u5f0f"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"\n// \u652f\u6301\u4e00\u4e2a\u6570\u636e\u5e93\npublic class Person: IEntity\n{\n // ....\n}\n\n// \u652f\u6301\u591a\u4e2a\u6570\u636e\u5e93\npublic class Person: IEntity\n{\n // ....\n}\n")),Object(o.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(o.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u6240\u6709\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"\u5b9e\u4f53\u4f9d\u8d56\u63a5\u53e3\u6216\u62bd\u8c61\u7c7b")," \u90fd\u652f\u6301\u6cdb\u578b\u65b9\u5f0f \u6307\u5b9a \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\uff0c\u6700\u591a\u652f\u6301 ",Object(o.b)("inlineCode",{parentName:"p"},"8")," \u4e2a\u3002"))),Object(o.b)("h3",{id:"91835-linq-\u51fd\u6570\u65b9\u5f0f"},"9.18.3.5 Linq \u51fd\u6570\u65b9\u5f0f"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),'public static class QueryFunctions\n{\n [QueryableFunction("FN_GetId", "dbo", typeof(MySqlDbContextLocator), typeof(SqliteDbContextLocator))]\n public static int GetId(int id) => throw new NotSupportedException();\n}\n')),Object(o.b)("h2",{id:"9184-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.18.4 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(o.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(o.b)("a",Object(r.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/5c4ee1d6.84f4a477.js b/docs/5c4ee1d6.203043c2.js similarity index 73% rename from docs/5c4ee1d6.84f4a477.js rename to docs/5c4ee1d6.203043c2.js index d8bb237668e..6d297ea9e1f 100644 --- a/docs/5c4ee1d6.84f4a477.js +++ b/docs/5c4ee1d6.203043c2.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[32],{88:function(o){o.exports=JSON.parse('{"permalink":"/blog","page":1,"postsPerPage":10,"totalPages":1,"totalCount":1,"previousPage":null,"nextPage":null,"blogDescription":"Blog"}')}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[32],{87:function(o){o.exports=JSON.parse('{"permalink":"/blog","page":1,"postsPerPage":10,"totalPages":1,"totalCount":1,"previousPage":null,"nextPage":null,"blogDescription":"Blog"}')}}]); \ No newline at end of file diff --git a/docs/5ce0ebbd.4ab6a852.js b/docs/5ce0ebbd.ef7d4828.js similarity index 99% rename from docs/5ce0ebbd.4ab6a852.js rename to docs/5ce0ebbd.ef7d4828.js index 97437fef3e5..371e49b3a5b 100644 --- a/docs/5ce0ebbd.4ab6a852.js +++ b/docs/5ce0ebbd.ef7d4828.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[33],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return s})),t.d(n,"b",(function(){return m}));var a=t(0),r=t.n(a);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function p(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function c(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var b=r.a.createContext({}),l=function(e){var n=r.a.useContext(b),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},s=function(e){var n=l(e.components);return r.a.createElement(b.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},d=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,b=o(e,["components","mdxType","originalType","parentName"]),s=l(t),d=a,m=s["".concat(p,".").concat(d)]||s[d]||u[d]||i;return t?r.a.createElement(m,c(c({ref:n},b),{},{components:t})):r.a.createElement(m,c({ref:n},b))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,p=new Array(i);p[0]=d;var c={};for(var o in n)hasOwnProperty.call(n,o)&&(c[o]=n[o]);c.originalType=e,c.mdxType="string"==typeof e?e:a,p[1]=c;for(var b=2;bStartup \u7c7b",id:"31-startup-\u7c7b",children:[{value:"3.1.1 Startup \u4e24\u4e2a\u91cd\u8981\u65b9\u6cd5",id:"311-startup-\u4e24\u4e2a\u91cd\u8981\u65b9\u6cd5",children:[]}]},{value:"3.2 AppStartup",id:"32-appstartup",children:[{value:"3.2.1 \u5982\u4f55\u914d\u7f6e AppStartup",id:"321-\u5982\u4f55\u914d\u7f6e-appstartup",children:[]},{value:"3.2.2 AppStartup \u7ea6\u5b9a",id:"322-appstartup-\u7ea6\u5b9a",children:[]},{value:"3.2.3 AppStartup \u914d\u7f6e\u987a\u5e8f",id:"323-appstartup-\u914d\u7f6e\u987a\u5e8f",children:[]},{value:"3.2.4 AppStartup \u65b9\u6cd5\u8c03\u7528\u987a\u5e8f",id:"324-appstartup-\u65b9\u6cd5\u8c03\u7528\u987a\u5e8f",children:[]}]},{value:"3.3 \u6846\u67b6\u9ed8\u8ba4 AppStartup \u5b9e\u73b0",id:"33-\u6846\u67b6\u9ed8\u8ba4-appstartup-\u5b9e\u73b0",children:[]},{value:"3.4 Startup \u914d\u7f6e\u6700\u4f73\u5b9e\u8df5",id:"34-startup-\u914d\u7f6e\u6700\u4f73\u5b9e\u8df5",children:[]},{value:"3.5 \u5173\u4e8e appsettings.json",id:"35-\u5173\u4e8e-appsettingsjson",children:[]},{value:"3.6 \u795e\u5947\u7684 Inject()",id:"36-\u795e\u5947\u7684-inject",children:[]},{value:"3.7 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"37-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],b={rightToc:o};function l(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(a.a)({},b,t,{components:n,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"31-startup-\u7c7b"},"3.1 ",Object(i.b)("inlineCode",{parentName:"h2"},"Startup")," \u7c7b"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Startup")," \u7c7b\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u9ed8\u8ba4\u8c03\u7528\u7684\u7c7b\uff0c\u8be5\u7c7b\u662f\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Program.cs")," \u4e2d\u914d\u7f6e\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{19} title="Fur.Web.Entry\\Program.cs"',"{19}":!0,title:'"Fur.Web.Entry\\Program.cs"'}),"using Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Hosting;\n\nnamespace Fur.Web.Entry\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n CreateHostBuilder(args).Build().Run();\n }\n\n public static IHostBuilder CreateHostBuilder(string[] args)\n {\n return Host.CreateDefaultBuilder(args)\n .ConfigureWebHostDefaults(webBuilder =>\n {\n webBuilder.Inject()\n .UseStartup();\n });\n }\n }\n}\n")),Object(i.b)("h3",{id:"311-startup-\u4e24\u4e2a\u91cd\u8981\u65b9\u6cd5"},"3.1.1 ",Object(i.b)("inlineCode",{parentName:"h3"},"Startup")," \u4e24\u4e2a\u91cd\u8981\u65b9\u6cd5"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Startup")," \u9ed8\u8ba4\u6709\u4e24\u4e2a\u91cd\u8981\u7684\u65b9\u6cd5:"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"ConfigureServices"),"\uff1a\u914d\u7f6e\u5e94\u7528\u6240\u9700\u670d\u52a1\uff0c\u5728\u8be5\u65b9\u6cd5\u4e2d\u53ef\u4ee5\u6dfb\u52a0\u5e94\u7528\u6240\u9700\u8981\u7684\u529f\u80fd\u6216\u670d\u52a1"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Configure"),"\uff1a\u914d\u7f6e\u5e94\u7528\u8bf7\u6c42\u5904\u7406\u7ba1\u9053")),Object(i.b)("p",null,"\u9ed8\u8ba4\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{9,13} title="Fur.Web.Entry\\Startup.cs"',"{9,13}":!0,title:'"Fur.Web.Entry\\Startup.cs"'}),"using Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Entry\n{\n public class Startup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("p",null,"\u5728\u8fd9\u91cc\uff0c\u4e0d\u6253\u7b97\u8be6\u7ec6\u8bb2 ",Object(i.b)("inlineCode",{parentName:"p"},"Startup")," \u7c7b\u7684\u5177\u4f53\u529f\u80fd\u548c\u4f5c\u7528\u3002"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(i.b)("inlineCode",{parentName:"p"},"Startup")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/startup?view=aspnetcore-3.1"}),"ASP.NET Core - Startup \u7c7b")," \u7ae0\u8282\u3002"))),Object(i.b)("h2",{id:"32-appstartup"},"3.2 ",Object(i.b)("inlineCode",{parentName:"h2"},"AppStartup")),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u63d0\u4f9b\u4e86\u66f4\u4e3a\u7075\u6d3b\u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"Startup")," \u7c7b\u914d\u7f6e\u65b9\u5f0f\uff0c\u65e0\u9700\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Web \u542f\u7528\u5c42")," \u4e2d\u914d\u7f6e\uff0c\u53ef\u5c06\u914d\u7f6e\u653e\u5230\u4efb\u4f55\u9879\u76ee\u5c42\u3002"),Object(i.b)("p",null,"\u53ef\u80fd\u4f1a\u6709\u8bfb\u8005\u6709\u7591\u95ee\uff0c\u4e3a\u4ec0\u4e48\u8981\u591a\u6b64\u4e00\u4e3e\u5462\uff1f\u539f\u56e0\u6709\u51e0\u70b9\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Startup")," \u7c7b\u9ed8\u8ba4\u548c ",Object(i.b)("inlineCode",{parentName:"li"},"Web \u5e94\u7528\u5c42")," \u7ed1\u5b9a\u5728\u4e00\u8d77\uff0c\u8fd9\u6837\u5c31\u4f1a\u5bfc\u81f4\u5982\u679c\u6211\u521b\u5efa\u4e86\u65b0\u7684 ",Object(i.b)("inlineCode",{parentName:"li"},"Web \u5e94\u7528\u5c42"),"\uff0c",Object(i.b)("inlineCode",{parentName:"li"},"Startup")," \u53c8\u8981\u91cd\u65b0\u914d\u7f6e"),Object(i.b)("li",{parentName:"ul"},"\u968f\u7740\u4e1a\u52a1\u7684\u589e\u957f\uff0c\u9700\u8981\u96c6\u6210\u8d8a\u6765\u8d8a\u591a\u7684\u7b2c\u4e09\u65b9\u670d\u52a1\uff0c\u8fd9\u65f6\u5019 ",Object(i.b)("inlineCode",{parentName:"li"},"Startup")," \u7c7b\u5c31\u4f1a\u53d8\u5f97\u8d8a\u6765\u8d8a\u81c3\u80bf\uff0c\u96be\u4ee5\u7ef4\u62a4"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Startup")," \u7c7b\u65e0\u6cd5\u5176\u4ed6\u9879\u76ee\u7c7b\u578b\u8fdb\u884c\u5171\u7528")),Object(i.b)("p",null,"\u6240\u4ee5\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e86\u66f4\u52a0\u7075\u6d3b\u7684\u914d\u7f6e\u65b9\u5f0f\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"AppStartup"),"\u3002"),Object(i.b)("h3",{id:"321-\u5982\u4f55\u914d\u7f6e-appstartup"},"3.2.1 \u5982\u4f55\u914d\u7f6e ",Object(i.b)("inlineCode",{parentName:"h3"},"AppStartup")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u662f\u4e00\u4e2a\u62bd\u8c61\u7684\u7a7a\u7c7b\uff0c\u6ca1\u6709\u4efb\u4f55\u5b9a\u4e49\u6210\u5458\u3002\u6b63\u662f\u56e0\u4e3a\u8fd9\u6837\uff0c\u624d\u63d0\u4f9b\u66f4\u52a0\u7075\u6d3b\u7684\u914d\u7f6e\u65b9\u5f0f\u3002"),Object(i.b)("h3",{id:"322-appstartup-\u7ea6\u5b9a"},"3.2.2 ",Object(i.b)("inlineCode",{parentName:"h3"},"AppStartup")," \u7ea6\u5b9a"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u6d3e\u751f\u7c7b\u53ea\u6709\u4e24\u4e2a\u5c0f\u7ea6\u5b9a\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u4efb\u4f55\u516c\u5f00\u3001\u975e\u9759\u6001\u3001\u8fd4\u56de\u503c\u4e3a ",Object(i.b)("inlineCode",{parentName:"li"},"void")," \u4e14\u65b9\u6cd5\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f ",Object(i.b)("inlineCode",{parentName:"li"},"IServiceCollection")," \u7c7b\u578b\uff0c\u90a3\u4e48\u4ed6\u5c31\u662f\u4e00\u4e2a ",Object(i.b)("inlineCode",{parentName:"li"},"ConfigureServices")," \u65b9\u6cd5"),Object(i.b)("li",{parentName:"ul"},"\u4efb\u4f55\u516c\u5f00\u3001\u975e\u9759\u6001\u3001\u8fd4\u56de\u503c\u4e3a ",Object(i.b)("inlineCode",{parentName:"li"},"void")," \u4e14\u65b9\u6cd5\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f ",Object(i.b)("inlineCode",{parentName:"li"},"IApplicationBuilder")," \u7c7b\u578b\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f ",Object(i.b)("inlineCode",{parentName:"li"},"IWebHostEnvironment")," \u7c7b\u578b\uff0c\u90a3\u4e48\u4ed6\u5c31\u662f\u4e00\u4e2a ",Object(i.b)("inlineCode",{parentName:"li"},"Configure")," \u65b9\u6cd5")),Object(i.b)("p",null,"\u6240\u4ee5\uff0c\u6211\u4eec\u53ef\u4ee5\u81ea\u7531\u7684\u7f16\u5199\u65b9\u6cd5\uff0c\u53ea\u8981\u9075\u5faa\u7ea6\u5b9a\u5373\u53ef\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,7,12,18,23}","{5,7,12,18,23}":!0}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n public class MyStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDataValidation();\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n app.UseSwagger();\n }\n\n // \u53ef\u4ee5\u968f\u610f\u5b9a\u4e49\u540d\u5b57\u548c\u65b9\u6cd5\n public void XXXXName(IServiceCollection services)\n {\n }\n\n // \u53ef\u4ee5\u968f\u610f\u5b9a\u4e49\u540d\u5b57\u548c\u65b9\u6cd5\n public void ZZZName(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("h3",{id:"323-appstartup-\u914d\u7f6e\u987a\u5e8f"},"3.2.3 ",Object(i.b)("inlineCode",{parentName:"h3"},"AppStartup")," \u914d\u7f6e\u987a\u5e8f"),Object(i.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u914d\u7f6e\u987a\u5e8f\u7531\u6240\u5728\u7a0b\u5e8f\u96c6\u7684\u540d\u79f0\u8fdb\u884c\u6b63\u5e8f\u8c03\u7528\uff0c\u5982\u679c\u6211\u4eec\u9700\u8981\u914d\u7f6e\u6267\u884c\u987a\u5e8f\uff0c\u53ea\u9700\u8981\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u6d3e\u751f\u7c7b\u4e2d\u8d34 ",Object(i.b)("inlineCode",{parentName:"p"},"[AppStartup(order)]")," \u7279\u6027\u5373\u53ef\u3002"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"order")," \u6570\u503c\u8d8a\u5927\uff0c\u8d8a\u5728\u524d\u9762\u8c03\u7528\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5}","{5}":!0}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(10)]\n public class FirstStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5}","{5}":!0}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(9)]\n public class SecondStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"FirstStartup")," \u4f1a\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"SecondStartup")," \u4e4b\u524d\u8c03\u7528\u3002"),Object(i.b)("h3",{id:"324-appstartup-\u65b9\u6cd5\u8c03\u7528\u987a\u5e8f"},"3.2.4 ",Object(i.b)("inlineCode",{parentName:"h3"},"AppStartup")," \u65b9\u6cd5\u8c03\u7528\u987a\u5e8f"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u65b9\u6cd5\u8c03\u7528\u987a\u5e8f\u548c\u65b9\u6cd5\u7684\u4e66\u5199\u5148\u540e\u6709\u5173\uff0c\u8d8a\u5728\u524d\u9762\u7684\u65b9\u6cd5\u8d8a\u5148\u8c03\u7528\u3002"),Object(i.b)("h2",{id:"33-\u6846\u67b6\u9ed8\u8ba4-appstartup-\u5b9e\u73b0"},"3.3 \u6846\u67b6\u9ed8\u8ba4 ",Object(i.b)("inlineCode",{parentName:"h2"},"AppStartup")," \u5b9e\u73b0"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u9ed8\u8ba4\u5728\u6bcf\u4e00\u4e2a\u9879\u76ee\u5c42\u4e2d\u90fd\u521b\u5efa\u4e86\u4e00\u4e2a ",Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u6d3e\u751f\u7c7b\uff0c\u65b9\u4fbf\u5927\u5bb6\u914d\u7f6e\u3002\u5982\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"FurStartup.cs"),"\uff1a",Object(i.b)("inlineCode",{parentName:"li"},"Fur")," \u6846\u67b6\u6838\u5fc3\u542f\u52a8\u7c7b\uff08\u901a\u5e38\u65e0\u9700\u914d\u7f6e\uff09"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"FurApplicationStartup.cs"),"\uff1a\u4e1a\u52a1\u670d\u52a1\u542f\u52a8\u7c7b"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"FurCoreStartup.cs"),"\uff1a\u5e94\u7528\u6838\u5fc3\u529f\u80fd\u542f\u52a8\u7c7b"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"FurEntityFrameworkCoreStartup.cs"),"\uff1a\u6570\u636e\u5e93\u76f8\u5173\u542f\u52a8\u7c7b"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"FurWebCoreStartup.cs"),"\uff1a",Object(i.b)("inlineCode",{parentName:"li"},"Web")," \u6838\u5fc3\u542f\u52a8\u914d\u7f6e\u7c7b")),Object(i.b)("h2",{id:"34-startup-\u914d\u7f6e\u6700\u4f73\u5b9e\u8df5"},"3.4 ",Object(i.b)("inlineCode",{parentName:"h2"},"Startup")," \u914d\u7f6e\u6700\u4f73\u5b9e\u8df5"),Object(i.b)("p",null,"\u5efa\u8bae ",Object(i.b)("inlineCode",{parentName:"p"},"Web")," \u542f\u52a8\u5c42\u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"Startup.cs")," \u4fdd\u6301\u4e3a\u7a7a\u65b9\u6cd5\u4f53\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'title="Fur.Web.Entry\\Startup.cs"',title:'"Fur.Web.Entry\\Startup.cs"'}),"using Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Entry\n{\n public class Startup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("p",null,"\u5c06\u6240\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"Web \u5e94\u7528\u5c42")," \u914d\u7f6e\u8fc1\u79fb\u5230 ",Object(i.b)("inlineCode",{parentName:"p"},"FurWebCoreStartup.cs")," \u4e2d\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'title="Fur.Web.Core\\FurWebCoreStartup.cs"',title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Fur.UnifyResult;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddCorsAccessor();\n\n services.AddSpecificationDocuments();\n services.AddControllers()\n .AddDynamicApiControllers()\n .AddDataValidation()\n .AddFriendlyException()\n .AddUnifyResult();\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n if (env.IsDevelopment())\n {\n app.UseDeveloperExceptionPage();\n }\n\n app.UseHttpsRedirection();\n\n app.UseRouting();\n\n app.UseCorsAccessor();\n\n app.UseAuthentication();\n app.UseAuthorization();\n\n app.UseSpecificationDocuments();\n\n app.UseEndpoints(endpoints =>\n {\n endpoints.MapControllers();\n });\n }\n }\n}\n")),Object(i.b)("p",null,"\u8fd9\u6837\uff0c\u540e\u7eed\u66f4\u6362 ",Object(i.b)("inlineCode",{parentName:"p"},"Web \u5e94\u7528\u5c42")," \u4e5f\u65e0\u9700\u91cd\u65b0\u914d\u7f6e ",Object(i.b)("inlineCode",{parentName:"p"},"Startup.cs")),Object(i.b)("h2",{id:"35-\u5173\u4e8e-appsettingsjson"},"3.5 \u5173\u4e8e ",Object(i.b)("inlineCode",{parentName:"h2"},"appsettings.json")),Object(i.b)("p",null,"\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u914d\u7f6e\u653e\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u914d\u7f6e\uff0c\u4f46\u662f\u8fd9\u6837\u7684\u65b9\u5f0f\u548c ",Object(i.b)("inlineCode",{parentName:"p"},"Startup.cs")," \u914d\u7f6e\u4e00\u6837\u7684\u9053\u7406\uff0c\u4e00\u65e6\u6211\u4eec\u66f4\u6362\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"Web \u5e94\u7528\u5c42"),"\uff0c\u90a3\u4e48 ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u53c8\u8981\u91cd\u65b0\u914d\u7f6e\u4e00\u6b21\u3002"),Object(i.b)("p",null,"\u6240\u4ee5\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u66f4\u52a0\u7075\u6d3b\u7684\u65b9\u5f0f\u914d\u7f6e ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json"),"\uff0c",Object(i.b)("strong",{parentName:"p"},"\u53ea\u9700\u8981\u5728\u4efb\u4f55\u9879\u76ee\u5c42\u6839\u76ee\u5f55\u4e0b\u521b\u5efa ",Object(i.b)("inlineCode",{parentName:"strong"},".json")," \u6587\u4ef6\u5373\u53ef")),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"Fur")," \u6846\u67b6\u6700\u540e\u4f1a\u81ea\u52a8\u5408\u5e76\u6240\u6709\u5206\u6563\u7684\u914d\u7f6e\u6587\u4ef6\u3002")),Object(i.b)("p",null,"\u5982\u6211\u4eec\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u5c42\u521b\u5efa ",Object(i.b)("inlineCode",{parentName:"p"},"dbsettings.json")," \u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'title="Fur.EntityFramework.Core\\dbsettings.json"',title:'"Fur.EntityFramework.Core\\dbsettings.json"'}),'{\n "ConnectionStrings": {\n "DbConnectionString": "Server=localhost;Database=Fur;User=sa;Password=000000;MultipleActiveResultSets=True;",\n "Sqlite3ConnectionString": "Data Source=./Fur.db"\n }\n}\n')),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"\u65e0\u9700\u5728 ",Object(i.b)("inlineCode",{parentName:"strong"},"appsettings.json")," \u4e2d\u914d\u7f6e"),"\uff0c\u4e0b\u9762\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u9ed8\u8ba4\u4ee3\u7801:"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "Logging": {\n "LogLevel": {\n "Default": "Information",\n "Microsoft": "Warning",\n "Microsoft.Hosting.Lifetime": "Information",\n "Microsoft.EntityFrameworkCore": "Information"\n }\n },\n "AllowedHosts": "*"\n}\n')),Object(i.b)("p",null,"\u8fd9\u6837\u6211\u4eec\u628a\u914d\u7f6e\u6587\u4ef6\u5206\u6563\u5728\u4e0d\u540c\u9879\u76ee\u5c42\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5171\u7528\u548c\u5171\u4eab\u4e86\u3002"),Object(i.b)("h2",{id:"36-\u795e\u5947\u7684-inject"},"3.6 \u795e\u5947\u7684 ",Object(i.b)("inlineCode",{parentName:"h2"},"Inject()")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Inject()")," \u65b9\u6cd5\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u7684\u6700\u5c0f\u4fb5\u5165\u5f0f\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u8ba9\u4efb\u4f55 ",Object(i.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," Web \u9879\u76ee\u77ac\u95f4\u652f\u6301\u6240\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u7279\u6027\u3002"),Object(i.b)("p",null,"\u6211\u4eec\u521b\u5efa\u4e86\u65b0\u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"Web \u9879\u76ee"),"\uff0c\u53ea\u9700\u8981\u4e09\u4e2a\u6b65\u9aa4\u5373\u53ef\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u6dfb\u52a0 ",Object(i.b)("inlineCode",{parentName:"li"},"Fur.Web.Core")," \u9879\u76ee\u5f15\u7528"),Object(i.b)("li",{parentName:"ul"},"\u5728 ",Object(i.b)("inlineCode",{parentName:"li"},"Program.cs")," \u4e2d\u8c03\u7528\u5373\u53ef"),Object(i.b)("li",{parentName:"ul"},"\u5c06 ",Object(i.b)("inlineCode",{parentName:"li"},"Startup.cs")," \u4ee3\u7801\u8fc1\u79fb\u5230 ",Object(i.b)("inlineCode",{parentName:"li"},"Fur.Web.Core")," \u9879\u76ee\u7684 ",Object(i.b)("inlineCode",{parentName:"li"},"FurWebCoreStartup.cs")," \u4e2d")),Object(i.b)("p",null,"\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{18} title="Fur.Web.Entry\\Program.cs"',"{18}":!0,title:'"Fur.Web.Entry\\Program.cs"'}),"using Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Hosting;\n\nnamespace Fur.Web.Entry\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n CreateHostBuilder(args).Build().Run();\n }\n\n public static IHostBuilder CreateHostBuilder(string[] args)\n {\n return Host.CreateDefaultBuilder(args)\n .ConfigureWebHostDefaults(webBuilder =>\n {\n webBuilder.Inject()\n .UseStartup();\n });\n }\n }\n}\n")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'title="Fur.Web.Entry\\Startup.cs"',title:'"Fur.Web.Entry\\Startup.cs"'}),"using Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Entry\n{\n public class Startup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),Object(i.b)("inlineCode",{parentName:"h5"},"Startup.cs")," \u4ee3\u7801\u8fc1\u79fb")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u53ea\u9700\u8981\u5c06 ",Object(i.b)("inlineCode",{parentName:"p"},"ConfigureServices")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"Configure")," \u65b9\u6cd5\u4ee3\u7801\u8fc1\u79fb\u5230 ",Object(i.b)("inlineCode",{parentName:"p"},"FurWebCoreStartup.cs")," \u4e2d\u5373\u53ef\uff0c\u800c ",Object(i.b)("inlineCode",{parentName:"p"},"Startup.cs")," \u4e2d\u4e24\u4e2a\u65b9\u6cd5\u7559\u7a7a\u5373\u53ef\u3002"))),Object(i.b)("p",null,"\u975e\u5e38\u7b80\u5355\u5427\u3002\u6211\u4eec\u540e\u7eed\u521b\u5efa\u4efb\u4f55 ",Object(i.b)("inlineCode",{parentName:"p"},"MVC"),"\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"RazorPages"),"\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"Blazor")," \u9879\u76ee\u53ea\u9700\u8981\u6dfb\u52a0 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Web.Core")," \u5f15\u7528\u548c\u8c03\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"Inject()")," \u5373\u53ef\u3002"),Object(i.b)("h2",{id:"37-\u53cd\u9988\u4e0e\u5efa\u8bae"},"3.7 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}l.isMDXComponent=!0}}]); \ No newline at end of file +(window.webpackJsonp=window.webpackJsonp||[]).push([[33],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return s})),t.d(n,"b",(function(){return m}));var a=t(0),r=t.n(a);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function p(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function c(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var b=r.a.createContext({}),l=function(e){var n=r.a.useContext(b),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},s=function(e){var n=l(e.components);return r.a.createElement(b.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},d=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,b=o(e,["components","mdxType","originalType","parentName"]),s=l(t),d=a,m=s["".concat(p,".").concat(d)]||s[d]||u[d]||i;return t?r.a.createElement(m,c(c({ref:n},b),{},{components:t})):r.a.createElement(m,c({ref:n},b))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,p=new Array(i);p[0]=d;var c={};for(var o in n)hasOwnProperty.call(n,o)&&(c[o]=n[o]);c.originalType=e,c.mdxType="string"==typeof e?e:a,p[1]=c;for(var b=2;bStartup \u7c7b",id:"31-startup-\u7c7b",children:[{value:"3.1.1 Startup \u4e24\u4e2a\u91cd\u8981\u65b9\u6cd5",id:"311-startup-\u4e24\u4e2a\u91cd\u8981\u65b9\u6cd5",children:[]}]},{value:"3.2 AppStartup",id:"32-appstartup",children:[{value:"3.2.1 \u5982\u4f55\u914d\u7f6e AppStartup",id:"321-\u5982\u4f55\u914d\u7f6e-appstartup",children:[]},{value:"3.2.2 AppStartup \u7ea6\u5b9a",id:"322-appstartup-\u7ea6\u5b9a",children:[]},{value:"3.2.3 AppStartup \u914d\u7f6e\u987a\u5e8f",id:"323-appstartup-\u914d\u7f6e\u987a\u5e8f",children:[]},{value:"3.2.4 AppStartup \u65b9\u6cd5\u8c03\u7528\u987a\u5e8f",id:"324-appstartup-\u65b9\u6cd5\u8c03\u7528\u987a\u5e8f",children:[]}]},{value:"3.3 \u6846\u67b6\u9ed8\u8ba4 AppStartup \u5b9e\u73b0",id:"33-\u6846\u67b6\u9ed8\u8ba4-appstartup-\u5b9e\u73b0",children:[]},{value:"3.4 Startup \u914d\u7f6e\u6700\u4f73\u5b9e\u8df5",id:"34-startup-\u914d\u7f6e\u6700\u4f73\u5b9e\u8df5",children:[]},{value:"3.5 \u5173\u4e8e appsettings.json",id:"35-\u5173\u4e8e-appsettingsjson",children:[]},{value:"3.6 \u795e\u5947\u7684 Inject()",id:"36-\u795e\u5947\u7684-inject",children:[]},{value:"3.7 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"37-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],b={rightToc:o};function l(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(a.a)({},b,t,{components:n,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"31-startup-\u7c7b"},"3.1 ",Object(i.b)("inlineCode",{parentName:"h2"},"Startup")," \u7c7b"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Startup")," \u7c7b\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u9ed8\u8ba4\u8c03\u7528\u7684\u7c7b\uff0c\u8be5\u7c7b\u662f\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Program.cs")," \u4e2d\u914d\u7f6e\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{19} title="Fur.Web.Entry\\Program.cs"',"{19}":!0,title:'"Fur.Web.Entry\\Program.cs"'}),"using Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Hosting;\n\nnamespace Fur.Web.Entry\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n CreateHostBuilder(args).Build().Run();\n }\n\n public static IHostBuilder CreateHostBuilder(string[] args)\n {\n return Host.CreateDefaultBuilder(args)\n .ConfigureWebHostDefaults(webBuilder =>\n {\n webBuilder.Inject()\n .UseStartup();\n });\n }\n }\n}\n")),Object(i.b)("h3",{id:"311-startup-\u4e24\u4e2a\u91cd\u8981\u65b9\u6cd5"},"3.1.1 ",Object(i.b)("inlineCode",{parentName:"h3"},"Startup")," \u4e24\u4e2a\u91cd\u8981\u65b9\u6cd5"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Startup")," \u9ed8\u8ba4\u6709\u4e24\u4e2a\u91cd\u8981\u7684\u65b9\u6cd5:"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"ConfigureServices"),"\uff1a\u914d\u7f6e\u5e94\u7528\u6240\u9700\u670d\u52a1\uff0c\u5728\u8be5\u65b9\u6cd5\u4e2d\u53ef\u4ee5\u6dfb\u52a0\u5e94\u7528\u6240\u9700\u8981\u7684\u529f\u80fd\u6216\u670d\u52a1"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Configure"),"\uff1a\u914d\u7f6e\u5e94\u7528\u8bf7\u6c42\u5904\u7406\u7ba1\u9053")),Object(i.b)("p",null,"\u9ed8\u8ba4\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{9,13} title="Fur.Web.Entry\\Startup.cs"',"{9,13}":!0,title:'"Fur.Web.Entry\\Startup.cs"'}),"using Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Entry\n{\n public class Startup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("p",null,"\u5728\u8fd9\u91cc\uff0c\u4e0d\u6253\u7b97\u8be6\u7ec6\u8bb2 ",Object(i.b)("inlineCode",{parentName:"p"},"Startup")," \u7c7b\u7684\u5177\u4f53\u529f\u80fd\u548c\u4f5c\u7528\u3002"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(i.b)("inlineCode",{parentName:"p"},"Startup")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/startup?view=aspnetcore-3.1"}),"ASP.NET Core - Startup \u7c7b")," \u7ae0\u8282\u3002"))),Object(i.b)("h2",{id:"32-appstartup"},"3.2 ",Object(i.b)("inlineCode",{parentName:"h2"},"AppStartup")),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u63d0\u4f9b\u4e86\u66f4\u4e3a\u7075\u6d3b\u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"Startup")," \u7c7b\u914d\u7f6e\u65b9\u5f0f\uff0c\u65e0\u9700\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Web \u542f\u7528\u5c42")," \u4e2d\u914d\u7f6e\uff0c\u53ef\u5c06\u914d\u7f6e\u653e\u5230\u4efb\u4f55\u9879\u76ee\u5c42\u3002"),Object(i.b)("p",null,"\u53ef\u80fd\u4f1a\u6709\u8bfb\u8005\u6709\u7591\u95ee\uff0c\u4e3a\u4ec0\u4e48\u8981\u591a\u6b64\u4e00\u4e3e\u5462\uff1f\u539f\u56e0\u6709\u51e0\u70b9\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Startup")," \u7c7b\u9ed8\u8ba4\u548c ",Object(i.b)("inlineCode",{parentName:"li"},"Web \u5e94\u7528\u5c42")," \u7ed1\u5b9a\u5728\u4e00\u8d77\uff0c\u8fd9\u6837\u5c31\u4f1a\u5bfc\u81f4\u5982\u679c\u6211\u521b\u5efa\u4e86\u65b0\u7684 ",Object(i.b)("inlineCode",{parentName:"li"},"Web \u5e94\u7528\u5c42"),"\uff0c",Object(i.b)("inlineCode",{parentName:"li"},"Startup")," \u53c8\u8981\u91cd\u65b0\u914d\u7f6e"),Object(i.b)("li",{parentName:"ul"},"\u968f\u7740\u4e1a\u52a1\u7684\u589e\u957f\uff0c\u9700\u8981\u96c6\u6210\u8d8a\u6765\u8d8a\u591a\u7684\u7b2c\u4e09\u65b9\u670d\u52a1\uff0c\u8fd9\u65f6\u5019 ",Object(i.b)("inlineCode",{parentName:"li"},"Startup")," \u7c7b\u5c31\u4f1a\u53d8\u5f97\u8d8a\u6765\u8d8a\u81c3\u80bf\uff0c\u96be\u4ee5\u7ef4\u62a4"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"Startup")," \u7c7b\u65e0\u6cd5\u5176\u4ed6\u9879\u76ee\u7c7b\u578b\u8fdb\u884c\u5171\u7528")),Object(i.b)("p",null,"\u6240\u4ee5\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e86\u66f4\u52a0\u7075\u6d3b\u7684\u914d\u7f6e\u65b9\u5f0f\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"AppStartup"),"\u3002"),Object(i.b)("h3",{id:"321-\u5982\u4f55\u914d\u7f6e-appstartup"},"3.2.1 \u5982\u4f55\u914d\u7f6e ",Object(i.b)("inlineCode",{parentName:"h3"},"AppStartup")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u662f\u4e00\u4e2a\u62bd\u8c61\u7684\u7a7a\u7c7b\uff0c\u6ca1\u6709\u4efb\u4f55\u5b9a\u4e49\u6210\u5458\u3002\u6b63\u662f\u56e0\u4e3a\u8fd9\u6837\uff0c\u624d\u63d0\u4f9b\u66f4\u52a0\u7075\u6d3b\u7684\u914d\u7f6e\u65b9\u5f0f\u3002"),Object(i.b)("h3",{id:"322-appstartup-\u7ea6\u5b9a"},"3.2.2 ",Object(i.b)("inlineCode",{parentName:"h3"},"AppStartup")," \u7ea6\u5b9a"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u6d3e\u751f\u7c7b\u53ea\u6709\u4e24\u4e2a\u5c0f\u7ea6\u5b9a\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u4efb\u4f55\u516c\u5f00\u3001\u975e\u9759\u6001\u3001\u8fd4\u56de\u503c\u4e3a ",Object(i.b)("inlineCode",{parentName:"li"},"void")," \u4e14\u65b9\u6cd5\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f ",Object(i.b)("inlineCode",{parentName:"li"},"IServiceCollection")," \u7c7b\u578b\uff0c\u90a3\u4e48\u4ed6\u5c31\u662f\u4e00\u4e2a ",Object(i.b)("inlineCode",{parentName:"li"},"ConfigureServices")," \u65b9\u6cd5"),Object(i.b)("li",{parentName:"ul"},"\u4efb\u4f55\u516c\u5f00\u3001\u975e\u9759\u6001\u3001\u8fd4\u56de\u503c\u4e3a ",Object(i.b)("inlineCode",{parentName:"li"},"void")," \u4e14\u65b9\u6cd5\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f ",Object(i.b)("inlineCode",{parentName:"li"},"IApplicationBuilder")," \u7c7b\u578b\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f ",Object(i.b)("inlineCode",{parentName:"li"},"IWebHostEnvironment")," \u7c7b\u578b\uff0c\u90a3\u4e48\u4ed6\u5c31\u662f\u4e00\u4e2a ",Object(i.b)("inlineCode",{parentName:"li"},"Configure")," \u65b9\u6cd5")),Object(i.b)("p",null,"\u6240\u4ee5\uff0c\u6211\u4eec\u53ef\u4ee5\u81ea\u7531\u7684\u7f16\u5199\u65b9\u6cd5\uff0c\u53ea\u8981\u9075\u5faa\u7ea6\u5b9a\u5373\u53ef\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,7,12,18,23}","{5,7,12,18,23}":!0}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n public class MyStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDataValidation();\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n app.UseSwagger();\n }\n\n // \u53ef\u4ee5\u968f\u610f\u5b9a\u4e49\u540d\u5b57\u548c\u65b9\u6cd5\n public void XXXXName(IServiceCollection services)\n {\n }\n\n // \u53ef\u4ee5\u968f\u610f\u5b9a\u4e49\u540d\u5b57\u548c\u65b9\u6cd5\n public void ZZZName(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("h3",{id:"323-appstartup-\u914d\u7f6e\u987a\u5e8f"},"3.2.3 ",Object(i.b)("inlineCode",{parentName:"h3"},"AppStartup")," \u914d\u7f6e\u987a\u5e8f"),Object(i.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u914d\u7f6e\u987a\u5e8f\u7531\u6240\u5728\u7a0b\u5e8f\u96c6\u7684\u540d\u79f0\u8fdb\u884c\u6b63\u5e8f\u8c03\u7528\uff0c\u5982\u679c\u6211\u4eec\u9700\u8981\u914d\u7f6e\u6267\u884c\u987a\u5e8f\uff0c\u53ea\u9700\u8981\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u6d3e\u751f\u7c7b\u4e2d\u8d34 ",Object(i.b)("inlineCode",{parentName:"p"},"[AppStartup(order)]")," \u7279\u6027\u5373\u53ef\u3002"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"order")," \u6570\u503c\u8d8a\u5927\uff0c\u8d8a\u5728\u524d\u9762\u8c03\u7528\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5}","{5}":!0}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(10)]\n public class FirstStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5}","{5}":!0}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(9)]\n public class SecondStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"FirstStartup")," \u4f1a\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"SecondStartup")," \u4e4b\u524d\u8c03\u7528\u3002"),Object(i.b)("h3",{id:"324-appstartup-\u65b9\u6cd5\u8c03\u7528\u987a\u5e8f"},"3.2.4 ",Object(i.b)("inlineCode",{parentName:"h3"},"AppStartup")," \u65b9\u6cd5\u8c03\u7528\u987a\u5e8f"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u65b9\u6cd5\u8c03\u7528\u987a\u5e8f\u548c\u65b9\u6cd5\u7684\u4e66\u5199\u5148\u540e\u6709\u5173\uff0c\u8d8a\u5728\u524d\u9762\u7684\u65b9\u6cd5\u8d8a\u5148\u8c03\u7528\u3002"),Object(i.b)("h2",{id:"33-\u6846\u67b6\u9ed8\u8ba4-appstartup-\u5b9e\u73b0"},"3.3 \u6846\u67b6\u9ed8\u8ba4 ",Object(i.b)("inlineCode",{parentName:"h2"},"AppStartup")," \u5b9e\u73b0"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u9ed8\u8ba4\u5728\u6bcf\u4e00\u4e2a\u9879\u76ee\u5c42\u4e2d\u90fd\u521b\u5efa\u4e86\u4e00\u4e2a ",Object(i.b)("inlineCode",{parentName:"p"},"AppStartup")," \u6d3e\u751f\u7c7b\uff0c\u65b9\u4fbf\u5927\u5bb6\u914d\u7f6e\u3002\u5982\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"FurStartup.cs"),"\uff1a",Object(i.b)("inlineCode",{parentName:"li"},"Fur")," \u6846\u67b6\u6838\u5fc3\u542f\u52a8\u7c7b\uff08\u901a\u5e38\u65e0\u9700\u914d\u7f6e\uff09"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"FurApplicationStartup.cs"),"\uff1a\u4e1a\u52a1\u670d\u52a1\u542f\u52a8\u7c7b"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"FurCoreStartup.cs"),"\uff1a\u5e94\u7528\u6838\u5fc3\u529f\u80fd\u542f\u52a8\u7c7b"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"FurEntityFrameworkCoreStartup.cs"),"\uff1a\u6570\u636e\u5e93\u76f8\u5173\u542f\u52a8\u7c7b"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"FurWebCoreStartup.cs"),"\uff1a",Object(i.b)("inlineCode",{parentName:"li"},"Web")," \u6838\u5fc3\u542f\u52a8\u914d\u7f6e\u7c7b")),Object(i.b)("h2",{id:"34-startup-\u914d\u7f6e\u6700\u4f73\u5b9e\u8df5"},"3.4 ",Object(i.b)("inlineCode",{parentName:"h2"},"Startup")," \u914d\u7f6e\u6700\u4f73\u5b9e\u8df5"),Object(i.b)("p",null,"\u5efa\u8bae ",Object(i.b)("inlineCode",{parentName:"p"},"Web")," \u542f\u52a8\u5c42\u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"Startup.cs")," \u4fdd\u6301\u4e3a\u7a7a\u65b9\u6cd5\u4f53\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'title="Fur.Web.Entry\\Startup.cs"',title:'"Fur.Web.Entry\\Startup.cs"'}),"using Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Entry\n{\n public class Startup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("p",null,"\u5c06\u6240\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"Web \u5e94\u7528\u5c42")," \u914d\u7f6e\u8fc1\u79fb\u5230 ",Object(i.b)("inlineCode",{parentName:"p"},"FurWebCoreStartup.cs")," \u4e2d\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'title="Fur.Web.Core\\FurWebCoreStartup.cs"',title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Fur.UnifyResult;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddCorsAccessor();\n\n services.AddSpecificationDocuments();\n services.AddControllers()\n .AddDynamicApiControllers()\n .AddDataValidation()\n .AddFriendlyException()\n .AddUnifyResult();\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n if (env.IsDevelopment())\n {\n app.UseDeveloperExceptionPage();\n }\n\n app.UseHttpsRedirection();\n\n app.UseRouting();\n\n app.UseCorsAccessor();\n\n app.UseAuthentication();\n app.UseAuthorization();\n\n app.UseSpecificationDocuments();\n\n app.UseEndpoints(endpoints =>\n {\n endpoints.MapControllers();\n });\n }\n }\n}\n")),Object(i.b)("p",null,"\u8fd9\u6837\uff0c\u540e\u7eed\u66f4\u6362 ",Object(i.b)("inlineCode",{parentName:"p"},"Web \u5e94\u7528\u5c42")," \u4e5f\u65e0\u9700\u91cd\u65b0\u914d\u7f6e ",Object(i.b)("inlineCode",{parentName:"p"},"Startup.cs")),Object(i.b)("h2",{id:"35-\u5173\u4e8e-appsettingsjson"},"3.5 \u5173\u4e8e ",Object(i.b)("inlineCode",{parentName:"h2"},"appsettings.json")),Object(i.b)("p",null,"\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u914d\u7f6e\u653e\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u914d\u7f6e\uff0c\u4f46\u662f\u8fd9\u6837\u7684\u65b9\u5f0f\u548c ",Object(i.b)("inlineCode",{parentName:"p"},"Startup.cs")," \u914d\u7f6e\u4e00\u6837\u7684\u9053\u7406\uff0c\u4e00\u65e6\u6211\u4eec\u66f4\u6362\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"Web \u5e94\u7528\u5c42"),"\uff0c\u90a3\u4e48 ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u53c8\u8981\u91cd\u65b0\u914d\u7f6e\u4e00\u6b21\u3002"),Object(i.b)("p",null,"\u6240\u4ee5\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u66f4\u52a0\u7075\u6d3b\u7684\u65b9\u5f0f\u914d\u7f6e ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json"),"\uff0c",Object(i.b)("strong",{parentName:"p"},"\u53ea\u9700\u8981\u5728\u4efb\u4f55\u9879\u76ee\u5c42\u6839\u76ee\u5f55\u4e0b\u521b\u5efa ",Object(i.b)("inlineCode",{parentName:"strong"},".json")," \u6587\u4ef6\u5373\u53ef")),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},Object(i.b)("inlineCode",{parentName:"strong"},"Fur")," \u6846\u67b6\u6700\u540e\u4f1a\u81ea\u52a8\u5408\u5e76\u6240\u6709\u5206\u6563\u7684\u914d\u7f6e\u6587\u4ef6\u3002")),Object(i.b)("p",null,"\u5982\u6211\u4eec\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u5c42\u521b\u5efa ",Object(i.b)("inlineCode",{parentName:"p"},"dbsettings.json")," \u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'title="Fur.EntityFramework.Core\\dbsettings.json"',title:'"Fur.EntityFramework.Core\\dbsettings.json"'}),'{\n "ConnectionStrings": {\n "DbConnectionString": "Server=localhost;Database=Fur;User=sa;Password=000000;MultipleActiveResultSets=True;",\n "Sqlite3ConnectionString": "Data Source=./Fur.db"\n }\n}\n')),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"\u65e0\u9700\u5728 ",Object(i.b)("inlineCode",{parentName:"strong"},"appsettings.json")," \u4e2d\u914d\u7f6e"),"\uff0c\u4e0b\u9762\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u9ed8\u8ba4\u4ee3\u7801:"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json"}),'{\n "Logging": {\n "LogLevel": {\n "Default": "Information",\n "Microsoft": "Warning",\n "Microsoft.Hosting.Lifetime": "Information",\n "Microsoft.EntityFrameworkCore": "Information"\n }\n },\n "AllowedHosts": "*"\n}\n')),Object(i.b)("p",null,"\u8fd9\u6837\u6211\u4eec\u628a\u914d\u7f6e\u6587\u4ef6\u5206\u6563\u5728\u4e0d\u540c\u9879\u76ee\u5c42\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5171\u7528\u548c\u5171\u4eab\u4e86\u3002"),Object(i.b)("h2",{id:"36-\u795e\u5947\u7684-inject"},"3.6 \u795e\u5947\u7684 ",Object(i.b)("inlineCode",{parentName:"h2"},"Inject()")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Inject()")," \u65b9\u6cd5\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u7684\u6700\u5c0f\u4fb5\u5165\u5f0f\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u8ba9\u4efb\u4f55 ",Object(i.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," Web \u9879\u76ee\u77ac\u95f4\u652f\u6301\u6240\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u7279\u6027\u3002"),Object(i.b)("p",null,"\u6211\u4eec\u521b\u5efa\u4e86\u65b0\u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"Web \u9879\u76ee"),"\uff0c\u53ea\u9700\u8981\u4e09\u4e2a\u6b65\u9aa4\u5373\u53ef\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u6dfb\u52a0 ",Object(i.b)("inlineCode",{parentName:"li"},"Fur.Web.Core")," \u9879\u76ee\u5f15\u7528"),Object(i.b)("li",{parentName:"ul"},"\u5728 ",Object(i.b)("inlineCode",{parentName:"li"},"Program.cs")," \u4e2d\u8c03\u7528\u5373\u53ef"),Object(i.b)("li",{parentName:"ul"},"\u5c06 ",Object(i.b)("inlineCode",{parentName:"li"},"Startup.cs")," \u4ee3\u7801\u8fc1\u79fb\u5230 ",Object(i.b)("inlineCode",{parentName:"li"},"Fur.Web.Core")," \u9879\u76ee\u7684 ",Object(i.b)("inlineCode",{parentName:"li"},"FurWebCoreStartup.cs")," \u4e2d")),Object(i.b)("p",null,"\u5982\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{18} title="Fur.Web.Entry\\Program.cs"',"{18}":!0,title:'"Fur.Web.Entry\\Program.cs"'}),"using Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Hosting;\n\nnamespace Fur.Web.Entry\n{\n public class Program\n {\n public static void Main(string[] args)\n {\n CreateHostBuilder(args).Build().Run();\n }\n\n public static IHostBuilder CreateHostBuilder(string[] args)\n {\n return Host.CreateDefaultBuilder(args)\n .ConfigureWebHostDefaults(webBuilder =>\n {\n webBuilder.Inject()\n .UseStartup();\n });\n }\n }\n}\n")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'title="Fur.Web.Entry\\Startup.cs"',title:'"Fur.Web.Entry\\Startup.cs"'}),"using Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Entry\n{\n public class Startup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),Object(i.b)("inlineCode",{parentName:"h5"},"Startup.cs")," \u4ee3\u7801\u8fc1\u79fb")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u53ea\u9700\u8981\u5c06 ",Object(i.b)("inlineCode",{parentName:"p"},"ConfigureServices")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"Configure")," \u65b9\u6cd5\u4ee3\u7801\u8fc1\u79fb\u5230 ",Object(i.b)("inlineCode",{parentName:"p"},"FurWebCoreStartup.cs")," \u4e2d\u5373\u53ef\uff0c\u800c ",Object(i.b)("inlineCode",{parentName:"p"},"Startup.cs")," \u4e2d\u4e24\u4e2a\u65b9\u6cd5\u7559\u7a7a\u5373\u53ef\u3002"))),Object(i.b)("p",null,"\u975e\u5e38\u7b80\u5355\u5427\u3002\u6211\u4eec\u540e\u7eed\u521b\u5efa\u4efb\u4f55 ",Object(i.b)("inlineCode",{parentName:"p"},"MVC"),"\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"RazorPages"),"\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"Blazor")," \u9879\u76ee\u53ea\u9700\u8981\u6dfb\u52a0 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Web.Core")," \u5f15\u7528\u548c\u8c03\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"Inject()")," \u5373\u53ef\u3002"),Object(i.b)("h2",{id:"37-\u53cd\u9988\u4e0e\u5efa\u8bae"},"3.7 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/5e077782.5c58ae24.js b/docs/5e077782.5c58ae24.js deleted file mode 100644 index 3643a2ef1ea..00000000000 --- a/docs/5e077782.5c58ae24.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[34],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return s})),t.d(n,"b",(function(){return d}));var i=t(0),a=t.n(i);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function b(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var o=a.a.createContext({}),p=function(e){var n=a.a.useContext(o),t=n;return e&&(t="function"==typeof e?e(n):b(b({},n),e)),t},s=function(e){var n=p(e.components);return a.a.createElement(o.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.a.createElement(a.a.Fragment,{},n)}},j=a.a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,r=e.originalType,c=e.parentName,o=l(e,["components","mdxType","originalType","parentName"]),s=p(t),j=i,d=s["".concat(c,".").concat(j)]||s[j]||u[j]||r;return t?a.a.createElement(d,b(b({ref:n},o),{},{components:t})):a.a.createElement(d,b({ref:n},o))}));function d(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=t.length,c=new Array(r);c[0]=j;var b={};for(var l in n)hasOwnProperty.call(n,l)&&(b[l]=n[l]);b.originalType=e,b.mdxType="string"==typeof e?e:i,c[1]=b;for(var o=2;oIOC/DI \u4f18\u7f3a\u70b9",id:"113-iocdi-\u4f18\u7f3a\u70b9",children:[]},{value:"11.4 \u4f9d\u8d56\u6ce8\u5165\u7684\u4e09\u79cd\u65b9\u5f0f",id:"114-\u4f9d\u8d56\u6ce8\u5165\u7684\u4e09\u79cd\u65b9\u5f0f",children:[{value:"11.4.1 \u6784\u9020\u65b9\u6cd5\u6ce8\u5165",id:"1141-\u6784\u9020\u65b9\u6cd5\u6ce8\u5165",children:[]},{value:"11.4.2 \u5c5e\u6027\u65b9\u5f0f\u6ce8\u5165",id:"1142-\u5c5e\u6027\u65b9\u5f0f\u6ce8\u5165",children:[]},{value:"11.4.3 \u65b9\u6cd5\u53c2\u6570\u6ce8\u5165",id:"1143-\u65b9\u6cd5\u53c2\u6570\u6ce8\u5165",children:[]}]},{value:"11.5 \u6ce8\u518c\u5bf9\u8c61\u751f\u5b58\u671f",id:"115-\u6ce8\u518c\u5bf9\u8c61\u751f\u5b58\u671f",children:[{value:"11.5.1 \u6682\u65f6/\u77ac\u65f6 \u751f\u5b58\u671f",id:"1151-\u6682\u65f6\u77ac\u65f6-\u751f\u5b58\u671f",children:[]},{value:"11.5.2 \u4f5c\u7528\u57df \u751f\u5b58\u671f",id:"1152-\u4f5c\u7528\u57df-\u751f\u5b58\u671f",children:[]},{value:"11.5.3 \u5355\u4f8b \u751f\u5b58\u671f",id:"1153-\u5355\u4f8b-\u751f\u5b58\u671f",children:[]}]},{value:"11.6 \u5185\u7f6e\u4f9d\u8d56\u63a5\u53e3",id:"116-\u5185\u7f6e\u4f9d\u8d56\u63a5\u53e3",children:[]},{value:"11.7 \u5e38\u89c1\u4f7f\u7528",id:"117-\u5e38\u89c1\u4f7f\u7528",children:[{value:"11.7.2 \u7b2c\u4e00\u4e2a\u4f8b\u5b50",id:"1172-\u7b2c\u4e00\u4e2a\u4f8b\u5b50",children:[]},{value:"11.7.3 \u6ce8\u518c\u6cdb\u578b\u5b9e\u4f8b",id:"1173-\u6ce8\u518c\u6cdb\u578b\u5b9e\u4f8b",children:[]},{value:"11.7.4 \u4e00\u4e2a\u63a5\u53e3\u591a\u4e2a\u5b9e\u73b0",id:"1174-\u4e00\u4e2a\u63a5\u53e3\u591a\u4e2a\u5b9e\u73b0",children:[]},{value:"11.7.5 \u65e0\u63a5\u53e3\u65b9\u5f0f",id:"1175-\u65e0\u63a5\u53e3\u65b9\u5f0f",children:[]}]},{value:"11.8 [Injection] \u7279\u6027\u914d\u7f6e",id:"118-injection-\u7279\u6027\u914d\u7f6e",children:[]},{value:"11.9 \u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c",id:"119-\u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c",children:[]},{value:"11.10 appsettings.json \u914d\u7f6e\u6ce8\u518c",id:"1110-appsettingsjson-\u914d\u7f6e\u6ce8\u518c",children:[]},{value:"11.11 \u6ce8\u518c\u987a\u5e8f\u548c\u4f18\u5148\u7ea7",id:"1111-\u6ce8\u518c\u987a\u5e8f\u548c\u4f18\u5148\u7ea7",children:[]},{value:"11.12 Aop \u6ce8\u518c\u62e6\u622a",id:"1112-aop-\u6ce8\u518c\u62e6\u622a",children:[{value:"11.12.1 AOP \u7684\u4f5c\u7528",id:"11121-aop-\u7684\u4f5c\u7528",children:[]}]},{value:"11.13 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"1113-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],p={rightToc:o};function s(e){var n=e.components,t=Object(a.a)(e,["components"]);return Object(r.b)("wrapper",Object(i.a)({},p,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"111-\u4f9d\u8d56\u6ce8\u5165"},"11.1 \u4f9d\u8d56\u6ce8\u5165"),Object(r.b)("p",null,"\u6240\u8c13\u4f9d\u8d56\u6ce8\u5165\uff0c\u662f\u6307\u7a0b\u5e8f\u8fd0\u884c\u8fc7\u7a0b\u4e2d\uff0c\u5982\u679c\u9700\u8981\u8c03\u7528\u53e6\u4e00\u4e2a\u5bf9\u8c61\u534f\u52a9\u65f6\uff0c\u65e0\u987b\u5728\u4ee3\u7801\u4e2d\u521b\u5efa\u88ab\u8c03\u7528\u8005\uff0c\u800c\u662f\u4f9d\u8d56\u4e8e\u5916\u90e8\u7684\u6ce8\u5165\u3002"),Object(r.b)("p",null,"\u901a\u4fd7\u6765\u8bb2\uff0c\u5c31\u662f\u628a\u6709\u4f9d\u8d56\u5173\u7cfb\u7684\u7c7b\u653e\u5230\u5bb9\u5668\u4e2d\uff0c\u7136\u540e\u5728\u6211\u4eec\u9700\u8981\u8fd9\u4e9b\u7c7b\u65f6\uff0c\u5bb9\u5668\u81ea\u52a8\u89e3\u6790\u51fa\u8fd9\u4e9b\u7c7b\u7684\u5b9e\u4f8b\u3002"),Object(r.b)("p",null,"\u4f9d\u8d56\u6ce8\u5165\u6700\u5927\u7684\u597d\u5904\u65f6\u5b9e\u73b0\u7c7b\u7684\u89e3\u8026\uff0c\u5229\u4e8e\u7a0b\u5e8f\u62d3\u5c55\u3001\u5355\u5143\u6d4b\u8bd5\u3001\u81ea\u52a8\u5316\u6a21\u62df\u6d4b\u8bd5\u7b49\u3002"),Object(r.b)("p",null,"\u4f9d\u8d56\u6ce8\u5165\u7684\u82f1\u6587\u4e3a\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"Dependency Injection"),"\uff0c\u7b80\u79f0 ",Object(r.b)("inlineCode",{parentName:"p"},"DI")),Object(r.b)("h2",{id:"112-\u63a7\u5236\u53cd\u8f6c"},"11.2 \u63a7\u5236\u53cd\u8f6c"),Object(r.b)("p",null,"\u63a7\u5236\u53cd\u8f6c\u53ea\u662f\u4e00\u4e2a\u6982\u5ff5\uff0c\u4e5f\u5c31\u662f\u5c06\u521b\u5efa\u5bf9\u8c61\u5b9e\u4f8b\u7684\u63a7\u5236\u6743\uff08\u539f\u672c\u662f\u7a0b\u5e8f\u5458\uff09\u4ece\u4ee3\u7801\u63a7\u5236\u6743\u5265\u79bb\u5230 ",Object(r.b)("inlineCode",{parentName:"p"},"IOC \u5bb9\u5668")," \u4e2d\u63a7\u5236\u3002"),Object(r.b)("p",null,"\u63a7\u5236\u53cd\u8f6c\u7684\u82f1\u6587\u4e3a\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"Inversion of Control"),"\uff0c\u7b80\u79f0 ",Object(r.b)("inlineCode",{parentName:"p"},"IOC")),Object(r.b)("h2",{id:"113-iocdi-\u4f18\u7f3a\u70b9"},"11.3 ",Object(r.b)("inlineCode",{parentName:"h2"},"IOC/DI")," \u4f18\u7f3a\u70b9"),Object(r.b)("p",null,"\u4f20\u7edf\u7684\u4ee3\u7801\uff0c\u6bcf\u4e2a\u5bf9\u8c61\u8d1f\u8d23\u7ba1\u7406\u4e0e\u81ea\u5df1\u9700\u8981\u4f9d\u8d56\u7684\u5bf9\u8c61\uff0c\u5bfc\u81f4\u5982\u679c\u9700\u8981\u5207\u6362\u4f9d\u8d56\u5bf9\u8c61\u7684\u5b9e\u73b0\u7c7b\u65f6\uff0c\u9700\u8981\u4fee\u6539\u591a\u5904\u5730\u65b9\u3002\u540c\u65f6\uff0c\u8fc7\u5ea6\u8026\u5408\u4e5f\u4f7f\u5f97\u5bf9\u8c61\u96be\u4ee5\u8fdb\u884c\u5355\u5143\u6d4b\u8bd5\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u4f9d\u8d56\u6ce8\u5165\u628a\u5bf9\u8c61\u7684\u521b\u9020\u4ea4\u7ed9\u5916\u90e8\u53bb\u7ba1\u7406,\u5f88\u597d\u7684\u89e3\u51b3\u4e86\u4ee3\u7801\u7d27\u8026\u5408\uff08tight couple\uff09\u7684\u95ee\u9898\uff0c\u662f\u4e00\u79cd\u8ba9\u4ee3\u7801\u5b9e\u73b0\u677e\u8026\u5408\uff08loose couple\uff09\u7684\u673a\u5236"),Object(r.b)("li",{parentName:"ul"},"\u677e\u8026\u5408\u8ba9\u4ee3\u7801\u66f4\u5177\u7075\u6d3b\u6027\uff0c\u80fd\u66f4\u597d\u5730\u5e94\u5bf9\u9700\u6c42\u53d8\u52a8\uff0c\u4ee5\u53ca\u65b9\u4fbf\u5355\u5143\u6d4b\u8bd5"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u76ee\u524d\u4e3b\u6d41\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"IOC/DI")," \u57fa\u672c\u91c7\u7528\u53cd\u5c04\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u4f9d\u8d56\u6ce8\u5165\uff0c\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4f1a\u5f71\u54cd\u6027\u80fd")))),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u8bf4\u660e")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5728\u672c\u7ae0\u8282\u4e0d\u6253\u7b97\u7ec6\u8bb2 ",Object(r.b)("inlineCode",{parentName:"p"},"\u4f9d\u8d56\u6ce8\u5165/\u63a7\u5236\u53cd\u8f6c")," \u5177\u4f53\u5b9e\u73b0\u548c\u5e94\u7528\u573a\u666f\uff0c\u60f3\u4e86\u89e3\u66f4\u591a\u77e5\u8bc6\uff0c\u53ef\u67e5\u9605 \u3010",Object(r.b)("a",Object(i.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-5.0"}),"ASP.NET Core \u4f9d\u8d56\u6ce8\u5165"),"\u3011 \u5b98\u65b9\u6587\u6863\u3002"))),Object(r.b)("h2",{id:"114-\u4f9d\u8d56\u6ce8\u5165\u7684\u4e09\u79cd\u65b9\u5f0f"},"11.4 \u4f9d\u8d56\u6ce8\u5165\u7684\u4e09\u79cd\u65b9\u5f0f"),Object(r.b)("h3",{id:"1141-\u6784\u9020\u65b9\u6cd5\u6ce8\u5165"},"11.4.1 \u6784\u9020\u65b9\u6cd5\u6ce8\u5165"),Object(r.b)("p",null,"\u76ee\u524d\u6784\u9020\u65b9\u6cd5\u6ce8\u5165\u662f\u4f9d\u8d56\u6ce8\u5165\u63a8\u8350\u4f7f\u7528\u65b9\u5f0f\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u5728\u6784\u9020\u65b9\u6cd5\u4e2d\u4f53\u73b0\u51fa\u5bf9\u5176\u4ed6\u7c7b\u7684\u4f9d\u8d56\uff0c\u4e00\u773c\u5c31\u80fd\u770b\u51fa\u8fd9\u4e2a\u7c7b\u9700\u8981\u5176\u4ed6\u90a3\u4e9b\u7c7b\u624d\u80fd\u5de5\u4f5c"),Object(r.b)("li",{parentName:"ul"},"\u8131\u79bb\u4e86 IOC \u6846\u67b6\uff0c\u8fd9\u4e2a\u7c7b\u4ecd\u7136\u53ef\u4ee5\u5de5\u4f5c\uff0cPOJO \u7684\u6982\u5ff5"),Object(r.b)("li",{parentName:"ul"},"\u4e00\u65e6\u5bf9\u8c61\u521d\u59cb\u5316\u6210\u529f\u4e86\uff0c\u8fd9\u4e2a\u5bf9\u8c61\u7684\u72b6\u6001\u80af\u5b9a\u662f\u6b63\u786e\u7684"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u6784\u9020\u51fd\u6570\u4f1a\u6709\u5f88\u591a\u53c2\u6570\uff08Bad smell\uff09"),Object(r.b)("li",{parentName:"ul"},"\u6709\u4e9b\u7c7b\u662f\u9700\u8981\u9ed8\u8ba4\u6784\u9020\u51fd\u6570\u7684\uff0c\u6bd4\u5982 MVC \u6846\u67b6\u7684 Controller \u7c7b\uff0c\u4e00\u65e6\u4f7f\u7528\u6784\u9020\u51fd\u6570\u6ce8\u5165\uff0c\u5c31\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u6784\u9020\u51fd\u6570"),Object(r.b)("li",{parentName:"ul"},"\u8fd9\u4e2a\u7c7b\u91cc\u9762\u7684\u6709\u4e9b\u65b9\u6cd5\u5e76\u4e0d\u9700\u8981\u7528\u5230\u8fd9\u4e9b\u4f9d\u8d56\uff08Bad smell\uff09")))),Object(r.b)("p",null,"\u4ee3\u7801\u793a\u4f8b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{4}","{4}":!0}),"public class FurService\n{\n private readonly IRepository _repository;\n public FurService(IRepository repository)\n {\n _repository = repository;\n }\n}\n")),Object(r.b)("h3",{id:"1142-\u5c5e\u6027\u65b9\u5f0f\u6ce8\u5165"},"11.4.2 \u5c5e\u6027\u65b9\u5f0f\u6ce8\u5165"),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u901a\u8fc7\u5c5e\u6027\u65b9\u5f0f\u6ce8\u5165\u5bb9\u6613\u548c\u7c7b\u7684\u5b9e\u4f8b\u5c5e\u6027\u6df7\u6dc6\uff0c\u4e0d\u5efa\u8bae\u4f7f\u7528\u3002")),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u5728\u5bf9\u8c61\u7684\u6574\u4e2a\u751f\u547d\u5468\u671f\u5185\uff0c\u53ef\u4ee5\u968f\u65f6\u52a8\u6001\u7684\u6539\u53d8\u4f9d\u8d56"),Object(r.b)("li",{parentName:"ul"},"\u975e\u5e38\u7075\u6d3b"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u5bf9\u8c61\u5728\u521b\u5efa\u540e\uff0c\u88ab\u8bbe\u7f6e\u4f9d\u8d56\u5bf9\u8c61\u4e4b\u524d\u8fd9\u6bb5\u65f6\u95f4\u72b6\u6001\u662f\u4e0d\u5bf9\u7684"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u76f4\u89c2\uff0c\u65e0\u6cd5\u6e05\u6670\u5730\u8868\u793a\u54ea\u4e9b\u5c5e\u6027\u662f\u5fc5\u987b\u7684")))),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{3}","{3}":!0}),"public class FurService\n{\n public IRepository Repository { get; set; }\n}\n")),Object(r.b)("h3",{id:"1143-\u65b9\u6cd5\u53c2\u6570\u6ce8\u5165"},"11.4.3 \u65b9\u6cd5\u53c2\u6570\u6ce8\u5165"),Object(r.b)("p",null,"\u65b9\u6cd5\u53c2\u6570\u6ce8\u5165\u7684\u610f\u601d\u662f\u5728\u521b\u5efa\u5bf9\u8c61\u540e\uff0c\u901a\u8fc7\u81ea\u52a8\u8c03\u7528\u67d0\u4e2a\u65b9\u6cd5\u6765\u6ce8\u5165\u4f9d\u8d56\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u4f18\u70b9\uff1a"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u6bd4\u8f83\u7075\u6d3b"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u7f3a\u70b9\uff1a"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u65b0\u52a0\u5165\u4f9d\u8d56\u65f6\u4f1a\u7834\u574f\u539f\u6709\u7684\u65b9\u6cd5\u7b7e\u540d\uff0c\u5982\u679c\u8fd9\u4e2a\u65b9\u6cd5\u5df2\u7ecf\u88ab\u5176\u4ed6\u5f88\u591a\u6a21\u5757\u7528\u5230\u5c31\u5f88\u9ebb\u70e6"),Object(r.b)("li",{parentName:"ul"},"\u4e0e\u6784\u9020\u65b9\u6cd5\u6ce8\u5165\u4e00\u6837\uff0c\u4f1a\u6709\u5f88\u591a\u53c2\u6570")))),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{3}","{3}":!0}),"public class FurService\n{\n public Person GetById([FromServices]IRepository repository, int id)\n {\n return repository.Find(id);\n }\n}\n")),Object(r.b)("h2",{id:"115-\u6ce8\u518c\u5bf9\u8c61\u751f\u5b58\u671f"},"11.5 \u6ce8\u518c\u5bf9\u8c61\u751f\u5b58\u671f"),Object(r.b)("h3",{id:"1151-\u6682\u65f6\u77ac\u65f6-\u751f\u5b58\u671f"},"11.5.1 ",Object(r.b)("inlineCode",{parentName:"h3"},"\u6682\u65f6/\u77ac\u65f6")," \u751f\u5b58\u671f"),Object(r.b)("p",null,"\u6682\u65f6\u751f\u5b58\u671f\u670d\u52a1\u662f\u6bcf\u6b21\u4ece\u670d\u52a1\u5bb9\u5668\u8fdb\u884c\u8bf7\u6c42\u65f6\u521b\u5efa\u7684\u3002 \u8fd9\u79cd\u751f\u5b58\u671f\u9002\u5408\u8f7b\u91cf\u7ea7\u3001 \u65e0\u72b6\u6001\u7684\u670d\u52a1\u3002"),Object(r.b)("p",null,"\u5728\u5904\u7406\u8bf7\u6c42\u7684\u5e94\u7528\u4e2d\uff0c\u5728\u8bf7\u6c42\u7ed3\u675f\u65f6\u4f1a\u91ca\u653e\u6682\u65f6\u670d\u52a1\u3002"),Object(r.b)("p",null,"\u901a\u5e38\u6211\u4eec\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"ITransient")," \u63a5\u53e3\u4f9d\u8d56\u8868\u793a\u8be5\u751f\u547d\u5468\u671f\u3002"),Object(r.b)("h3",{id:"1152-\u4f5c\u7528\u57df-\u751f\u5b58\u671f"},"11.5.2 ",Object(r.b)("inlineCode",{parentName:"h3"},"\u4f5c\u7528\u57df")," \u751f\u5b58\u671f"),Object(r.b)("p",null,"\u4f5c\u7528\u57df\u751f\u5b58\u671f\u670d\u52a1\u9488\u5bf9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8bf7\u6c42\uff08\u8fde\u63a5\uff09\u521b\u5efa\u4e00\u6b21\u3002\u5728\u5904\u7406\u8bf7\u6c42\u7684\u5e94\u7528\u4e2d\uff0c\u5728\u8bf7\u6c42\u7ed3\u675f\u65f6\u4f1a\u91ca\u653e\u6709\u4f5c\u7528\u57df\u7684\u670d\u52a1\u3002"),Object(r.b)("p",null,"\u901a\u5e38\u6211\u4eec\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"IScoped")," \u63a5\u53e3\u4f9d\u8d56\u8868\u793a\u8be5\u751f\u547d\u5468\u671f\u3002"),Object(r.b)("h3",{id:"1153-\u5355\u4f8b-\u751f\u5b58\u671f"},"11.5.3 ",Object(r.b)("inlineCode",{parentName:"h3"},"\u5355\u4f8b")," \u751f\u5b58\u671f"),Object(r.b)("p",null,"\u5728\u9996\u6b21\u8bf7\u6c42\u5b83\u4eec\u65f6\u8fdb\u884c\u521b\u5efa\uff0c\u4e4b\u540e\u6bcf\u4e2a\u540e\u7eed\u8bf7\u6c42\u90fd\u4f7f\u7528\u76f8\u540c\u7684\u5b9e\u4f8b\u3002"),Object(r.b)("p",null,"\u901a\u5e38\u6211\u4eec\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"ISingleton")," \u63a5\u53e3\u4f9d\u8d56\u8868\u793a\u8be5\u751f\u547d\u5468\u671f\u3002"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(r.b)("inlineCode",{parentName:"p"},"\u670d\u52a1\u751f\u5b58\u671f")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(r.b)("a",Object(i.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-5.0#service-lifetimes"}),"ASP.NET Core - \u4f9d\u8d56\u6ce8\u5165 - \u670d\u52a1\u751f\u5b58\u671f")," \u7ae0\u8282\u3002"))),Object(r.b)("h2",{id:"116-\u5185\u7f6e\u4f9d\u8d56\u63a5\u53e3"},"11.6 \u5185\u7f6e\u4f9d\u8d56\u63a5\u53e3"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e09\u4e2a\u63a5\u53e3\u4f9d\u8d56\u5206\u522b\u5bf9\u5e94\u4e0d\u540c\u7684\u670d\u52a1\u751f\u5b58\u671f\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ITransient"),"\uff1a\u5bf9\u5e94\u6682\u65f6/\u77ac\u65f6\u4f5c\u7528\u57df\u670d\u52a1\u751f\u5b58\u671f"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"IScoped"),"\uff1a\u5bf9\u5e94\u8bf7\u6c42\u4f5c\u7528\u57df\u670d\u52a1\u751f\u5b58\u671f"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ISingleton"),"\uff1a\u5bf9\u5e94\u5355\u4f8b\u4f5c\u7528\u57df\u670d\u52a1\u751f\u5b58\u671f")),Object(r.b)("h2",{id:"117-\u5e38\u89c1\u4f7f\u7528"},"11.7 \u5e38\u89c1\u4f7f\u7528"),Object(r.b)("h3",{id:"1172-\u7b2c\u4e00\u4e2a\u4f8b\u5b50"},"11.7.2 \u7b2c\u4e00\u4e2a\u4f8b\u5b50"),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"IBusinessService")," \u63a5\u53e3\u548c ",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService")," \u5b9e\u73b0\u7c7b\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12}","{7,12}":!0}),"using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DependencyInjection;\n\nnamespace Fur.Application\n{\n public interface IBusinessService\n {\n Person Get(int id);\n }\n\n public class BusinessService : IBusinessService, ITransient\n {\n private readonly IRepository _personRepository;\n\n public BusinessService(IRepository personRepository)\n {\n _personRepository = personRepository;\n }\n\n public Person Get(int id)\n {\n return _personRepository.Find(id);\n }\n }\n}\n")),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"PersonController")," \u63a7\u5236\u5668\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{11,19}","{11,19}":!0}),'using Fur.Application;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n [ApiController]\n public class PersonController : ControllerBase\n {\n private readonly IBusinessService _businessService;\n public PersonController(IBusinessService businessService)\n {\n _businessService = businessService;\n }\n\n [HttpGet]\n public IActionResult Get(int id)\n {\n var person = _businessService.Get(id);\n return new JsonResult(person);\n }\n }\n}\n')),Object(r.b)("img",{src:Object(c.a)("img/di1.gif")}),Object(r.b)("hr",null),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u4f8b\u5b50\u89e3\u8bf4")),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u4e14\u65b9\u4fbf\u7684\u5b9e\u73b0\u4f9d\u8d56\u6ce8\u5165\u7684\u65b9\u5f0f\uff0c\u53ea\u9700\u8981\u5b9e\u4f8b\u7c7b\u7ee7\u627f\u5bf9\u5e94\u751f\u5b58\u671f\u7684\u63a5\u53e3\u5373\u53ef\uff0c\u8fd9\u91cc\u7ee7\u627f\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"ITransient"),"\uff0c\u4e5f\u5c31\u8868\u660e\u4e86\u8fd9\u662f\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"\u6682\u65f6/\u77ac\u65f6")," \u4f5c\u7528\u57df\u5b9e\u4f8b\u7c7b\u3002\u8be5\u7c7b\u5c31\u53ef\u4ee5\u4f5c\u4e3a\u88ab\u6ce8\u5165\u5bf9\u8c61\uff0c\u540c\u65f6\u4e5f\u80fd\u6ce8\u5165\u5176\u4ed6\u63a5\u53e3\u5bf9\u8c61\u3002"),Object(r.b)("p",null,"\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService")," \u6ce8\u5165\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"IRepository")," \u4ed3\u50a8\u63a5\u53e3\uff0c\u540c\u65f6 ",Object(r.b)("inlineCode",{parentName:"p"},"PersonController")," \u63a7\u5236\u5668\u6ce8\u5165\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"IBusinessService")," \u63a5\u53e3\u3002"),Object(r.b)("p",null,"\u8fd9\u6837 ",Object(r.b)("inlineCode",{parentName:"p"},"PersonController")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService")," \u4e4b\u95f4\u5c31\u5b9e\u73b0\u4e86\u89e3\u8026\uff0c\u4e0d\u518d\u4f9d\u8d56\u4e8e\u5177\u4f53\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService")," \u5b9e\u4f8b\u3002"),Object(r.b)("p",null,"\u8fd9\u5c31\u662f\u4f9d\u8d56\u6ce8\u5165/\u63a7\u5236\u53cd\u8f6c\u6700\u7ecf\u5178\u7684\u4f8b\u5b50\u3002"),Object(r.b)("h3",{id:"1173-\u6ce8\u518c\u6cdb\u578b\u5b9e\u4f8b"},"11.7.3 \u6ce8\u518c\u6cdb\u578b\u5b9e\u4f8b"),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"IBusinessService")," \u63a5\u53e3\u548c ",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService")," \u5b9e\u73b0\u7c7b\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12}","{7,12}":!0}),"using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DependencyInjection;\n\nnamespace Fur.Application\n{\n public interface IBusinessService\n {\n Person Get(int id);\n }\n\n public class BusinessService : IBusinessService, ITransient\n {\n private readonly IRepository _personRepository;\n\n public BusinessService(IRepository personRepository)\n {\n _personRepository = personRepository;\n }\n\n public Person Get(int id)\n {\n return _personRepository.Find(id);\n }\n }\n}\n")),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"PersonController")," \u63a7\u5236\u5668\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{11,19}","{11,19}":!0}),'using Fur.Application;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n [ApiController]\n public class PersonController : ControllerBase\n {\n private readonly IBusinessService _businessService;\n public PersonController(IBusinessService businessService)\n {\n _businessService = businessService;\n }\n\n [HttpGet]\n public IActionResult Get(int id)\n {\n var person = _businessService.Get(id);\n return new JsonResult(person);\n }\n }\n}\n')),Object(r.b)("h3",{id:"1174-\u4e00\u4e2a\u63a5\u53e3\u591a\u4e2a\u5b9e\u73b0"},"11.7.4 \u4e00\u4e2a\u63a5\u53e3\u591a\u4e2a\u5b9e\u73b0"),Object(r.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a\u63a5\u53e3\u53ea\u5bf9\u5e94\u4e00\u4e2a\u5b9e\u73b0\u7c7b\uff0c\u4f46\u6709\u4e9b\u7279\u6b8a\u60c5\u51b5\uff0c\u9700\u8981\u9700\u8981\u591a\u4e2a\u5b9e\u73b0\u7c7b\u6ce8\u518c\u540c\u4e00\u4e2a\u63a5\u53e3\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"p"},"DbContext")," \u591a\u6570\u636e\u5e93\u60c5\u51b5\u3002"),Object(r.b)("p",null,"\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4f9d\u8d56\u6ce8\u5165 ",Object(r.b)("inlineCode",{parentName:"p"},"Func")," \u59d4\u6258\u6765\u89e3\u6790\u591a\u4e2a\u5b9e\u4f8b\uff0c\u5176\u4e2d\u59d4\u6258\u7684\u53c2\u6570\u5206\u522b\u4e3a\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u53c2\u6570 1\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"string")," \u7c7b\u578b\uff0c\u4e0d\u540c\u5b9e\u73b0\u7c7b\u552f\u4e00\u6807\u8bc6\uff0c\u9ed8\u8ba4\u4e3a ",Object(r.b)("inlineCode",{parentName:"li"},"nameof(\u5b9e\u73b0\u7c7b)")," \u540d\u79f0"),Object(r.b)("li",{parentName:"ul"},"\u53c2\u6570 2\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Type")," \u7c7b\u578b\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"IPrivateDependency")," \u6d3e\u751f\u63a5\u53e3\uff0c\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"li"},"ITransient"),"\u3001",Object(r.b)("inlineCode",{parentName:"li"},"IScoped"),"\u3001",Object(r.b)("inlineCode",{parentName:"li"},"ISingleton")),Object(r.b)("li",{parentName:"ul"},"\u8fd4\u56de\u503c\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"object")," \u7c7b\u578b\uff0c\u8fd4\u56de\u5177\u4f53\u7684\u5b9e\u73b0\u7c7b\u5b9e\u4f8b")),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"IBusinessService")," \u63a5\u53e3\u548c ",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService"),"\u3001",Object(r.b)("inlineCode",{parentName:"p"},"OtherBusinessService")," \u4e24\u4e2a\u5b9e\u73b0\u7c7b\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,10,18}","{5,10,18}":!0}),'using Fur.DependencyInjection;\n\nnamespace Fur.Application\n{\n public interface IBusinessService\n {\n string GetName();\n }\n\n public class BusinessService : IBusinessService, ITransient\n {\n public string GetName()\n {\n return "\u6211\u662f\uff1a" + nameof(BusinessService);\n }\n }\n\n public class OtherBusinessService : IBusinessService, ITransient\n {\n public string GetName()\n {\n return "\u6211\u662f\uff1a" + nameof(OtherBusinessService);\n }\n }\n}\n')),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"ValueController")," \u63a7\u5236\u5668\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{15,17,18}","{15,17,18}":!0}),'using Fur.Application;\nusing Fur.DependencyInjection;\nusing Microsoft.AspNetCore.Mvc;\nusing System;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n [ApiController]\n public class ValueController : ControllerBase\n {\n private readonly IBusinessService _businessService;\n private readonly IBusinessService _otherBusinessService;\n\n public ValueController(Func resolveNamed)\n {\n _businessService = resolveNamed("BusinessService", default) as IBusinessService;\n _otherBusinessService = resolveNamed("OtherBusinessService", default) as IBusinessService;\n }\n\n [HttpGet]\n public string GetName()\n {\n return _businessService.GetName() + "----------" + _otherBusinessService.GetName();\n }\n }\n}\n')),Object(r.b)("img",{src:Object(c.a)("img/di2.gif")}),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c\u9700\u8981\u81ea\u5b9a\u4e49\u89e3\u6790\u540d\u79f0\uff0c\u53ea\u9700\u8981\u8d34 ",Object(r.b)("inlineCode",{parentName:"p"},'[Injection(Named = "\u540d\u79f0")]')," \u5373\u53ef\uff0c\u5982\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,11}","{5,11}":!0}),'using Fur.DependencyInjection;\n\nnamespace Fur.Application\n{\n [Injection(Named = "BusName1")]\n public class BusinessService : IBusinessService, ITransient\n {\n // ...\n }\n\n [Injection(Named = "BusName2")]\n public class OtherBusinessService : IBusinessService, ITransient\n {\n // ...\n }\n}\n')),Object(r.b)("p",{parentName:"div"},"\u89e3\u6790\u670d\u52a1\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs"}),'_businessService = resolveNamed("BusName1", default) as IBusinessService;\n_otherBusinessService = resolveNamed("BusName2", default) as IBusinessService;\n')))),Object(r.b)("h3",{id:"1175-\u65e0\u63a5\u53e3\u65b9\u5f0f"},"11.7.5 \u65e0\u63a5\u53e3\u65b9\u5f0f"),Object(r.b)("p",null,"\u6709\u4e9b\u65f6\u5019\uff0c\u6211\u4eec\u4e0d\u60f3\u5b9a\u4e49\u63a5\u53e3\uff0c\u800c\u662f\u60f3\u628a\u5b9e\u4f8b\u7c7b\u4f5c\u4e3a\u53ef\u4f9d\u8d56\u6ce8\u5165\u7684\u5bf9\u8c61\uff0c\u5982 MVC \u4e2d\u7684\u63a7\u5236\u5668\u3002"),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"SelfService")," \u5b9e\u4f8b\u7c7b\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,11}","{7,11}":!0}),"using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DependencyInjection;\n\nnamespace Fur.Application\n{\n public class SelfService : ITransient\n {\n private readonly IRepository _personRepository;\n\n public SelfService(IRepository personRepository)\n {\n _personRepository = personRepository;\n }\n\n public Person Get(int id)\n {\n return _personRepository.Find(id);\n }\n }\n}\n")),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"ValueController")," \u63a7\u5236\u5668\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{13,21}","{13,21}":!0}),'using Fur.Application;\nusing Fur.Core;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n [ApiController]\n public class ValueController : ControllerBase\n {\n private readonly SelfService _selfService;\n\n public ValueController(SelfService selfService)\n {\n _selfService = selfService;\n }\n\n [HttpGet]\n public Person Get(int id)\n {\n return _selfService.Get(id);\n }\n }\n}\n')),Object(r.b)("h2",{id:"118-injection-\u7279\u6027\u914d\u7f6e"},"11.8 ",Object(r.b)("inlineCode",{parentName:"h2"},"[Injection]")," \u7279\u6027\u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b ",Object(r.b)("inlineCode",{parentName:"p"},"[Injection]")," \u7279\u6027\u53ef\u4ee5\u6539\u53d8\u6ce8\u518c\u65b9\u5f0f\uff0c\u540c\u65f6\u8fd8\u80fd\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"AOP")," \u62e6\u622a\u3002"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"[Injection]")," \u63d0\u4f9b\u4ee5\u4e0b\u914d\u7f6e\u652f\u6301\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Action"),"\uff1a\u914d\u7f6e\u6ce8\u518c\u884c\u4e3a\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"InjectionActions")," \u7c7b\u578b\uff0c\u53ef\u9009\u503c\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Add"),"\uff1a",Object(r.b)("strong",{parentName:"li"},"\u9ed8\u8ba4\u503c"),"\uff0c\u8868\u793a\u65e0\u9650\u5236\u6dfb\u52a0\u6ce8\u518c\u670d\u52a1\uff0c\u8be5\u65b9\u5f0f\u652f\u6301\u4e00\u4e2a\u63a5\u53e3\u591a\u4e2a\u5b9e\u73b0"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"TryAdd"),"\uff1a\u8868\u793a\u6ce8\u518c\u5df2\u5b58\u5728\u5219\u8df3\u8fc7\u6ce8\u518c"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Pattern"),"\uff1a\u914d\u7f6e\u6ce8\u518c\u9009\u9879\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"InjectionPatterns")," \u7c7b\u578b\uff0c\u53ef\u9009\u503c\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Self"),"\uff1a\u53ea\u6ce8\u518c\u81ea\u5df1"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"FirstInterface"),"\uff1a\u53ea\u6ce8\u518c\u7b2c\u4e00\u4e2a\u63a5\u53e3"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"SelfWithFirstInterface"),"\uff1a\u6ce8\u518c\u81ea\u5df1\u548c\u7b2c\u4e00\u4e2a\u63a5\u53e3\uff0c",Object(r.b)("strong",{parentName:"li"},"\u9ed8\u8ba4\u503c")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ImplementedInterfaces"),"\uff1a\u6ce8\u518c\u6240\u6709\u63a5\u53e3"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"All"),"\uff1a\u6ce8\u518c\u81ea\u5df1\u5305\u62ec\u6240\u6709\u63a5\u53e3"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Named"),"\uff1a\u914d\u7f6e\u5b9e\u4f8b\u522b\u540d\uff0c\u901a\u8fc7\u522b\u540d\u53ef\u4ee5\u89e3\u6790\u63a5\u53e3\uff0c\u5982\u540c\u4e00\u4e2a\u63a5\u53e3\u6709\u591a\u4e2a\u5b9e\u73b0\uff0c\u90a3\u4e48\u53ef\u4ee5\u901a\u8fc7\u522b\u540d\u89e3\u6790\u4e0d\u540c\u7684\u5b9e\u73b0\uff0c\u9ed8\u8ba4\u53ea\u4e3a\u5b9e\u73b0\u7c7b\u7684\u7c7b\u540d"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Order"),"\uff1a\u6ce8\u518c\u6392\u5e8f\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u5219\u8d8a\u5728\u6700\u540e\u6ce8\u518c\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"0")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Proxy"),"\uff1a\u914d\u7f6e\u4ee3\u7406\u62e6\u622a\u7c7b\u578b\uff0c\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"li"},"AOP"),"\uff0c",Object(r.b)("strong",{parentName:"li"},"\u4ee3\u7406\u7c7b\u578b\u5fc5\u987b\u7ee7\u627f ",Object(r.b)("inlineCode",{parentName:"strong"},"DispatchProxy")," \u7c7b\u548c ",Object(r.b)("inlineCode",{parentName:"strong"},"IDispatchProxy")," \u63a5\u53e3"),"\uff0c\u65e0\u9ed8\u8ba4\u503c")),Object(r.b)("h2",{id:"119-\u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c"},"11.9 \u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c"),Object(r.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u7684\u6ce8\u518c\u65b9\u5f0f\u53ef\u4ee5\u6ee1\u8db3\u5927\u591a\u6570\u4f9d\u8d56\u6ce8\u5165\u7684\u9700\u6c42\uff0c\u5982\u6709\u7279\u522b\u6ce8\u518c\u9700\u6c42\uff0c\u53ea\u9700\u8981\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Startup")," \u4e2d\u914d\u7f6e\u5373\u53ef\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs"}),"services.AddScoped(typeof(ISpecService), provider = > {\n // \u81ea\u5b9a\u4e49\u4efb\u4f55\u521b\u5efa\u5b9e\u4f8b\u7684\u65b9\u5f0f\n var instance = new SpecService(); // \u6216\u8005\u53ef\u4ee5\u901a\u8fc7 AOP\u63d2\u4ef6\u8fd4\u56de\u4ee3\u7406\u5b9e\u4f8b\n\n return instance;\n});\n")),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u8865\u5145\u8bf4\u660e")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"AppDbContext")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u8fd8\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"ISqlDispatchProxy")," \u90fd\u662f\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u521b\u5efa\u7684\u3002"))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u77e5\u8bc6\u5bfc\u822a")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a\u81ea\u5b9a\u4e49\u9ad8\u7ea7\u4e2d\u6ce8\u518c\uff0c\u53ef\u67e5\u9605 \u3010",Object(r.b)("a",Object(i.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-5.0"}),"ASP.NET Core \u4f9d\u8d56\u6ce8\u5165"),"\u3011 \u5b98\u65b9\u6587\u6863\u3002"))),Object(r.b)("h2",{id:"1110-appsettingsjson-\u914d\u7f6e\u6ce8\u518c"},"11.10 ",Object(r.b)("inlineCode",{parentName:"h2"},"appsettings.json")," \u914d\u7f6e\u6ce8\u518c"),Object(r.b)("p",null,"\u9664\u4e86\u5728\u4ee3\u7801\u4e2d\u5b9e\u73b0\u4f9d\u8d56\u6ce8\u5165\uff0c\u4e5f\u53ef\u4ee5\u5b9e\u73b0\u52a8\u6001\u4f9d\u8d56\u6ce8\u5165\uff0c\u65e0\u9700\u4fee\u6539\u4ee3\u7801\u6216\u91cd\u65b0\u7f16\u8bd1\u5373\u53ef\u5b9e\u73b0\u70ed\u62d4\u63d2\uff08\u63d2\u4ef6\uff09\u6548\u679c\u3002\u914d\u7f6e\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-json",metastring:"{3}","{3}":!0}),'{\n "AppSettings": {\n "DependencyInjectionSettings": {\n "Definitions": [\n {\n "Interface": "Fur.Application;Fur.Application.ITestService",\n "Service": "Fur.Application;Fur.Application.TestService",\n "RegisterType": "Transient",\n "Action": "Add",\n "Pattern": "SelfWithFirstInterface",\n "Named": "TestService",\n "Order": 1,\n "Proxy": "Fur.Application;Fur.Application.LogDispathProxy"\n }\n ]\n }\n }\n}\n')),Object(r.b)("p",null,"\u914d\u7f6e\u8bf4\u660e\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DependencyInjectionSettings"),"\uff1a\u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e\u6839\u8282\u70b9",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Definitions"),"\uff1a\u52a8\u6001\u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e\u8282\u70b9\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"ExternalService")," \u6570\u7ec4\u7c7b\u578b",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ExternalService"),"\uff1a\u914d\u7f6e\u5355\u4e2a\u4f9d\u8d56\u6ce8\u5165\u4fe1\u606f",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Interface"),"\uff1a\u914d\u7f6e\u4f9d\u8d56\u63a5\u53e3\u4fe1\u606f\uff0c\u683c\u5f0f\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"\u7a0b\u5e8f\u96c6\u540d\u79f0;\u63a5\u53e3\u5b8c\u6574\u540d\u79f0"),"\uff0c\u5982\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Fur.Application;Fur.Application.ITestService")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Service"),"\uff1a\u914d\u7f6e\u63a5\u53e3\u5b9e\u73b0\u4fe1\u606f\uff0c\u683c\u5f0f\u540c\u4e0a"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"RegisterType"),"\uff1a\u914d\u7f6e\u4f9d\u8d56\u6ce8\u5165\u7684\u5bf9\u8c61\u751f\u5b58\u671f\uff0c\u53d6\u503c\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Transient"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"Scoped"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"Singleton")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Action"),"\uff1a\u6ce8\u518c\u884c\u4e3a\uff0c\u53ef\u9009\u503c\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Add"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"TryAdd"),"\uff0c\u53c2\u89c1 ",Object(r.b)("a",Object(i.a)({parentName:"li"},{href:"#118-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"}),"#118-injection-\u7279\u6027\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Pattern"),"\uff1a\u6ce8\u518c\u9009\u9879\uff0c\u53c2\u89c1 ",Object(r.b)("a",Object(i.a)({parentName:"li"},{href:"#118-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"}),"#118-injection-\u7279\u6027\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Named"),"\uff1a\u6ce8\u518c\u522b\u540d\uff0c\u53c2\u89c1 ",Object(r.b)("a",Object(i.a)({parentName:"li"},{href:"#118-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"}),"#118-injection-\u7279\u6027\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Order"),"\uff1a\u6ce8\u518c\u6392\u5e8f\uff0c\u53c2\u89c1 ",Object(r.b)("a",Object(i.a)({parentName:"li"},{href:"#118-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"}),"#118-injection-\u7279\u6027\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Proxy"),"\uff1a\u914d\u7f6e\u4ee3\u7406\u62e6\u622a\uff0c\uff0c\u683c\u5f0f\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"\u7a0b\u5e8f\u96c6\u540d\u79f0;\u4ee3\u7406\u7c7b\u5b8c\u6574\u540d\u79f0"),"\uff0c\u53c2\u89c1 ",Object(r.b)("a",Object(i.a)({parentName:"li"},{href:"#118-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"}),"#118-injection-\u7279\u6027\u914d\u7f6e"))))))))),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u5173\u4e8e\u5916\u90e8\u7a0b\u5e8f\u96c6")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c\u52a8\u6001\u6ce8\u5165\u7684\u5bf9\u8c61\u662f\u5916\u90e8\u7a0b\u5e8f\u96c6\uff0c\u90a3\u4e48\u9996\u5148\u5148\u6ce8\u518c\u5916\u90e8\u7a0b\u5e8f\u96c6\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-json"}),'{\n "AppSettings": {\n "ExternalAssemblies": ["\u5916\u90e8\u7a0b\u5e8f\u96c6\u540d\u79f0", "Taobao.Pay"] // \u652f\u6301\u591a\u4e2a\n }\n}\n')))),Object(r.b)("h2",{id:"1111-\u6ce8\u518c\u987a\u5e8f\u548c\u4f18\u5148\u7ea7"},"11.11 \u6ce8\u518c\u987a\u5e8f\u548c\u4f18\u5148\u7ea7"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u9ed8\u8ba4\u6ce8\u518c\u987a\u5e8f\u662f\u6309\u7167\u7a0b\u5e8f\u96c6\u626b\u63cf\u987a\u5e8f\u8fdb\u884c\u6ce8\u518c\uff0c\u5982\u679c\u9700\u8981\u6539\u53d8\u6ce8\u518c\u987a\u5e8f\uff0c\u53ef\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"[Injection(Order)]")," \u7279\u6027\u6307\u5b9a\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Order")," \u503c\u8d8a\u5927\uff0c\u5219\u8d8a\u5728\u6700\u540e\u6ce8\u518c\u3002"),Object(r.b)("p",null,"\u53e6\u5916 ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u914d\u7f6e\u7684\u4f18\u5148\u7ea7\u6700\u5927\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u914d\u7f6e\u7684\u6ce8\u518c\u4f1a\u8986\u76d6\u4e4b\u524d\u6240\u6709\u6ce8\u518c\u3002"),Object(r.b)("h2",{id:"1112-aop-\u6ce8\u518c\u62e6\u622a"},"11.12 ",Object(r.b)("inlineCode",{parentName:"h2"},"Aop")," \u6ce8\u518c\u62e6\u622a"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"AOP")," \u662f\u975e\u5e38\u91cd\u8981\u7684\u601d\u60f3\u548c\u6280\u672f\uff0c\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"\u9762\u5411\u5207\u9762")," \u7f16\u7a0b\uff0c\u53ef\u4ee5\u8ba9\u6211\u4eec\u5728\u4e0d\u6539\u52a8\u539f\u6765\u4ee3\u7801\u7684\u60c5\u51b5\u4e0b\u8fdb\u884c\u52a8\u6001\u7be1\u6539\u4e1a\u52a1\u4ee3\u7801\u3002"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"Aop")," \u975e\u5e38\u7b80\u5355\uff0c\u5982\uff1a"),Object(r.b)("p",null,"\u5047\u8bbe\u6211\u4eec\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"ITestService")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"TestService")," \u4e24\u4e2a\u7c7b\u578b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs"}),"public class ITestService\n{\n string SayHello(string word);\n}\n")),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs"}),'public class TestService: ITestService, ITransient\n{\n public string SayHello(string word)\n {\n return $"Hello {word}";\n }\n}\n')),Object(r.b)("p",null,"\u73b0\u5728\u6211\u4eec\u6709\u4e00\u4e2a\u9700\u6c42\uff0c\u6211\u4eec\u5e0c\u671b\u8c03\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"SayHello")," \u7684\u65f6\u5019\u53ef\u4ee5\u8bb0\u5f55\u65e5\u5fd7\u548c\u6743\u9650\u63a7\u5236\uff08\u4e4b\u524d\u6ca1\u6709\u8003\u8651\u5230\u7684\u9700\u6c42\uff09\u3002"),Object(r.b)("p",null,"\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u53ea\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u4ee3\u7406\u7c7b\u5373\u53ef\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"p"},"LogDispatchProxy")," "),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,3,7,25}","{1,3,7,25}":!0}),'using Fur.DependencyInjection;\nusing System;\nusing System.Reflection;\n\nnamespace Fur.Application\n{\n public class LogDispatchProxy : DispatchProxy, IDispatchProxy\n {\n /// \n /// \u5f53\u524d\u670d\u52a1\u5b9e\u4f8b\n /// \n public object Target { get; set; }\n\n /// \n /// \u670d\u52a1\u63d0\u4f9b\u5668\uff0c\u53ef\u4ee5\u7528\u6765\u89e3\u6790\u670d\u52a1\uff0c\u5982\uff1aServices.GetService()\n /// \n public IServiceProvider Services { get; set; }\n\n /// \n /// \u62e6\u622a\u65b9\u6cd5\n /// \n /// \n /// \n /// \n protected override object Invoke(MethodInfo targetMethod, object[] args)\n {\n Console.WriteLine("SayHello \u65b9\u6cd5\u88ab\u8c03\u7528\u4e86");\n\n var result = targetMethod.Invoke(Target, args);\n\n Console.WriteLine("SayHello \u65b9\u6cd5\u8fd4\u56de\u503c\uff1a" + result);\n\n return result;\n }\n }\n}\n')),Object(r.b)("p",null,"\u4e4b\u540e\u6211\u4eec\u53ea\u9700\u8981\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"TestService")," \u589e\u52a0 ",Object(r.b)("inlineCode",{parentName:"p"},"[Injection]")," \u7279\u6027\u5373\u53ef\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),'[Injection(Proxy = typeof(LogDispatchProxy))]\npublic class TestService: ITestService, ITransient\n{\n public string SayHello(string word)\n {\n return $"Hello {word}";\n }\n}\n')),Object(r.b)("p",null,"\u4e4b\u540e ",Object(r.b)("inlineCode",{parentName:"p"},"SayHello")," \u65b9\u6cd5\u88ab\u8c03\u7528\u7684\u65f6\u5019\u5c31\u53ef\u4ee5\u5b9e\u73b0\u52a8\u6001\u62e6\u622a\u4e86\uff0c\u6bd4\u5982\u8fd9\u91cc\u5199\u65e5\u5fd7\u3002"),Object(r.b)("h3",{id:"11121-aop-\u7684\u4f5c\u7528"},"11.12.1 ",Object(r.b)("inlineCode",{parentName:"h3"},"AOP")," \u7684\u4f5c\u7528"),Object(r.b)("p",null,"\u8fd9\u79cd\u9762\u5411\u5207\u9762\u7684\u80fd\u529b\uff08\u52a8\u6001\u62e6\u622a/\u4ee3\u7406\uff09\u53ef\u4ee5\u5b9e\u73b0\u5f88\u591a\u5f88\u591a\u529f\u80fd\uff0c\u5982\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u65e5\u5fd7\u8bb0\u5f55"),Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u4fee\u6539\u53c2\u6570"),Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u4fee\u6539\u8fd4\u56de\u503c"),Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u65b9\u6cd5\u91cd\u5b9a\u5411"),Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u4fee\u6539\u4ee3\u7801\u903b\u8f91"),Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u5b9e\u73b0\u5f02\u5e38\u76d1\u542c")),Object(r.b)("p",null,"\u8fd8\u53ef\u4ee5\u505a\u66f4\u591a\u66f4\u591a\u7684\u4e8b\u60c5\u3002"),Object(r.b)("h2",{id:"1113-\u53cd\u9988\u4e0e\u5efa\u8bae"},"11.13 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(i.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/5e077782.ad54b8c8.js b/docs/5e077782.ad54b8c8.js new file mode 100644 index 00000000000..d2ecd1bd9c2 --- /dev/null +++ b/docs/5e077782.ad54b8c8.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[34],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return s})),t.d(n,"b",(function(){return d}));var i=t(0),a=t.n(i);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function b(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var o=a.a.createContext({}),p=function(e){var n=a.a.useContext(o),t=n;return e&&(t="function"==typeof e?e(n):b(b({},n),e)),t},s=function(e){var n=p(e.components);return a.a.createElement(o.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.a.createElement(a.a.Fragment,{},n)}},j=a.a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,r=e.originalType,c=e.parentName,o=l(e,["components","mdxType","originalType","parentName"]),s=p(t),j=i,d=s["".concat(c,".").concat(j)]||s[j]||u[j]||r;return t?a.a.createElement(d,b(b({ref:n},o),{},{components:t})):a.a.createElement(d,b({ref:n},o))}));function d(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=t.length,c=new Array(r);c[0]=j;var b={};for(var l in n)hasOwnProperty.call(n,l)&&(b[l]=n[l]);b.originalType=e,b.mdxType="string"==typeof e?e:i,c[1]=b;for(var o=2;ofunction(e,n,t,{forcePrependBaseUrl:i=!1,absolute:r=!1}={}){if(!t)return t;if(t.startsWith("#"))return t;if(Object(a.b)(t))return t;if(i)return n+t;const c=t.startsWith(n)?t:n+t.replace(/^\//,"");return r?e+c:c}(n,e,t,i)}}function c(e,n={}){const{withBaseUrl:t}=r();return t(e,n)}},145:function(e,n,t){"use strict";function i(e){return!0===/^(\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!i(e)}t.d(n,"b",(function(){return i})),t.d(n,"a",(function(){return a}))},89:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return b})),t.d(n,"metadata",(function(){return l})),t.d(n,"rightToc",(function(){return o})),t.d(n,"default",(function(){return s}));var i=t(2),a=t(6),r=(t(0),t(142)),c=t(144),b={id:"dependency-injection",title:"11. \u4f9d\u8d56\u6ce8\u5165/\u63a7\u5236\u53cd\u8f6c",sidebar_label:"11. \u4f9d\u8d56\u6ce8\u5165/\u63a7\u5236\u53cd\u8f6c"},l={unversionedId:"dependency-injection",id:"dependency-injection",isDocsHomePage:!1,title:"11. \u4f9d\u8d56\u6ce8\u5165/\u63a7\u5236\u53cd\u8f6c",description:"11.1 \u4f9d\u8d56\u6ce8\u5165",source:"@site/docs\\dependency-injection.mdx",slug:"/dependency-injection",permalink:"/docs/dependency-injection",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/dependency-injection.mdx",version:"current",sidebar_label:"11. \u4f9d\u8d56\u6ce8\u5165/\u63a7\u5236\u53cd\u8f6c",sidebar:"docs",previous:{title:"10. SaaS \u591a\u79df\u6237",permalink:"/docs/saas"},next:{title:"12. \u5bf9\u8c61\u6570\u636e\u6620\u5c04",permalink:"/docs/object-mapper"}},o=[{value:"11.1 \u4f9d\u8d56\u6ce8\u5165",id:"111-\u4f9d\u8d56\u6ce8\u5165",children:[]},{value:"11.2 \u63a7\u5236\u53cd\u8f6c",id:"112-\u63a7\u5236\u53cd\u8f6c",children:[]},{value:"11.3 IOC/DI \u4f18\u7f3a\u70b9",id:"113-iocdi-\u4f18\u7f3a\u70b9",children:[]},{value:"11.4 \u4f9d\u8d56\u6ce8\u5165\u7684\u4e09\u79cd\u65b9\u5f0f",id:"114-\u4f9d\u8d56\u6ce8\u5165\u7684\u4e09\u79cd\u65b9\u5f0f",children:[{value:"11.4.1 \u6784\u9020\u65b9\u6cd5\u6ce8\u5165",id:"1141-\u6784\u9020\u65b9\u6cd5\u6ce8\u5165",children:[]},{value:"11.4.2 \u5c5e\u6027\u65b9\u5f0f\u6ce8\u5165",id:"1142-\u5c5e\u6027\u65b9\u5f0f\u6ce8\u5165",children:[]},{value:"11.4.3 \u65b9\u6cd5\u53c2\u6570\u6ce8\u5165",id:"1143-\u65b9\u6cd5\u53c2\u6570\u6ce8\u5165",children:[]}]},{value:"11.5 \u6ce8\u518c\u5bf9\u8c61\u751f\u5b58\u671f",id:"115-\u6ce8\u518c\u5bf9\u8c61\u751f\u5b58\u671f",children:[{value:"11.5.1 \u6682\u65f6/\u77ac\u65f6 \u751f\u5b58\u671f",id:"1151-\u6682\u65f6\u77ac\u65f6-\u751f\u5b58\u671f",children:[]},{value:"11.5.2 \u4f5c\u7528\u57df \u751f\u5b58\u671f",id:"1152-\u4f5c\u7528\u57df-\u751f\u5b58\u671f",children:[]},{value:"11.5.3 \u5355\u4f8b \u751f\u5b58\u671f",id:"1153-\u5355\u4f8b-\u751f\u5b58\u671f",children:[]}]},{value:"11.6 \u5185\u7f6e\u4f9d\u8d56\u63a5\u53e3",id:"116-\u5185\u7f6e\u4f9d\u8d56\u63a5\u53e3",children:[]},{value:"11.7 \u5e38\u89c1\u4f7f\u7528",id:"117-\u5e38\u89c1\u4f7f\u7528",children:[{value:"11.7.2 \u7b2c\u4e00\u4e2a\u4f8b\u5b50",id:"1172-\u7b2c\u4e00\u4e2a\u4f8b\u5b50",children:[]},{value:"11.7.3 \u6ce8\u518c\u6cdb\u578b\u5b9e\u4f8b",id:"1173-\u6ce8\u518c\u6cdb\u578b\u5b9e\u4f8b",children:[]},{value:"11.7.4 \u4e00\u4e2a\u63a5\u53e3\u591a\u4e2a\u5b9e\u73b0",id:"1174-\u4e00\u4e2a\u63a5\u53e3\u591a\u4e2a\u5b9e\u73b0",children:[]},{value:"11.7.5 \u65e0\u63a5\u53e3\u65b9\u5f0f",id:"1175-\u65e0\u63a5\u53e3\u65b9\u5f0f",children:[]}]},{value:"11.8 [Injection] \u7279\u6027\u914d\u7f6e",id:"118-injection-\u7279\u6027\u914d\u7f6e",children:[]},{value:"11.9 \u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c",id:"119-\u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c",children:[]},{value:"11.10 appsettings.json \u914d\u7f6e\u6ce8\u518c",id:"1110-appsettingsjson-\u914d\u7f6e\u6ce8\u518c",children:[]},{value:"11.11 \u6ce8\u518c\u987a\u5e8f\u548c\u4f18\u5148\u7ea7",id:"1111-\u6ce8\u518c\u987a\u5e8f\u548c\u4f18\u5148\u7ea7",children:[]},{value:"11.12 Aop \u6ce8\u518c\u62e6\u622a",id:"1112-aop-\u6ce8\u518c\u62e6\u622a",children:[{value:"11.12.1 AOP \u7684\u4f5c\u7528",id:"11121-aop-\u7684\u4f5c\u7528",children:[]}]},{value:"11.13 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"1113-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],p={rightToc:o};function s(e){var n=e.components,t=Object(a.a)(e,["components"]);return Object(r.b)("wrapper",Object(i.a)({},p,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"111-\u4f9d\u8d56\u6ce8\u5165"},"11.1 \u4f9d\u8d56\u6ce8\u5165"),Object(r.b)("p",null,"\u6240\u8c13\u4f9d\u8d56\u6ce8\u5165\uff0c\u662f\u6307\u7a0b\u5e8f\u8fd0\u884c\u8fc7\u7a0b\u4e2d\uff0c\u5982\u679c\u9700\u8981\u8c03\u7528\u53e6\u4e00\u4e2a\u5bf9\u8c61\u534f\u52a9\u65f6\uff0c\u65e0\u987b\u5728\u4ee3\u7801\u4e2d\u521b\u5efa\u88ab\u8c03\u7528\u8005\uff0c\u800c\u662f\u4f9d\u8d56\u4e8e\u5916\u90e8\u7684\u6ce8\u5165\u3002"),Object(r.b)("p",null,"\u901a\u4fd7\u6765\u8bb2\uff0c\u5c31\u662f\u628a\u6709\u4f9d\u8d56\u5173\u7cfb\u7684\u7c7b\u653e\u5230\u5bb9\u5668\u4e2d\uff0c\u7136\u540e\u5728\u6211\u4eec\u9700\u8981\u8fd9\u4e9b\u7c7b\u65f6\uff0c\u5bb9\u5668\u81ea\u52a8\u89e3\u6790\u51fa\u8fd9\u4e9b\u7c7b\u7684\u5b9e\u4f8b\u3002"),Object(r.b)("p",null,"\u4f9d\u8d56\u6ce8\u5165\u6700\u5927\u7684\u597d\u5904\u65f6\u5b9e\u73b0\u7c7b\u7684\u89e3\u8026\uff0c\u5229\u4e8e\u7a0b\u5e8f\u62d3\u5c55\u3001\u5355\u5143\u6d4b\u8bd5\u3001\u81ea\u52a8\u5316\u6a21\u62df\u6d4b\u8bd5\u7b49\u3002"),Object(r.b)("p",null,"\u4f9d\u8d56\u6ce8\u5165\u7684\u82f1\u6587\u4e3a\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"Dependency Injection"),"\uff0c\u7b80\u79f0 ",Object(r.b)("inlineCode",{parentName:"p"},"DI")),Object(r.b)("h2",{id:"112-\u63a7\u5236\u53cd\u8f6c"},"11.2 \u63a7\u5236\u53cd\u8f6c"),Object(r.b)("p",null,"\u63a7\u5236\u53cd\u8f6c\u53ea\u662f\u4e00\u4e2a\u6982\u5ff5\uff0c\u4e5f\u5c31\u662f\u5c06\u521b\u5efa\u5bf9\u8c61\u5b9e\u4f8b\u7684\u63a7\u5236\u6743\uff08\u539f\u672c\u662f\u7a0b\u5e8f\u5458\uff09\u4ece\u4ee3\u7801\u63a7\u5236\u6743\u5265\u79bb\u5230 ",Object(r.b)("inlineCode",{parentName:"p"},"IOC \u5bb9\u5668")," \u4e2d\u63a7\u5236\u3002"),Object(r.b)("p",null,"\u63a7\u5236\u53cd\u8f6c\u7684\u82f1\u6587\u4e3a\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"Inversion of Control"),"\uff0c\u7b80\u79f0 ",Object(r.b)("inlineCode",{parentName:"p"},"IOC")),Object(r.b)("h2",{id:"113-iocdi-\u4f18\u7f3a\u70b9"},"11.3 ",Object(r.b)("inlineCode",{parentName:"h2"},"IOC/DI")," \u4f18\u7f3a\u70b9"),Object(r.b)("p",null,"\u4f20\u7edf\u7684\u4ee3\u7801\uff0c\u6bcf\u4e2a\u5bf9\u8c61\u8d1f\u8d23\u7ba1\u7406\u4e0e\u81ea\u5df1\u9700\u8981\u4f9d\u8d56\u7684\u5bf9\u8c61\uff0c\u5bfc\u81f4\u5982\u679c\u9700\u8981\u5207\u6362\u4f9d\u8d56\u5bf9\u8c61\u7684\u5b9e\u73b0\u7c7b\u65f6\uff0c\u9700\u8981\u4fee\u6539\u591a\u5904\u5730\u65b9\u3002\u540c\u65f6\uff0c\u8fc7\u5ea6\u8026\u5408\u4e5f\u4f7f\u5f97\u5bf9\u8c61\u96be\u4ee5\u8fdb\u884c\u5355\u5143\u6d4b\u8bd5\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u4f9d\u8d56\u6ce8\u5165\u628a\u5bf9\u8c61\u7684\u521b\u9020\u4ea4\u7ed9\u5916\u90e8\u53bb\u7ba1\u7406,\u5f88\u597d\u7684\u89e3\u51b3\u4e86\u4ee3\u7801\u7d27\u8026\u5408\uff08tight couple\uff09\u7684\u95ee\u9898\uff0c\u662f\u4e00\u79cd\u8ba9\u4ee3\u7801\u5b9e\u73b0\u677e\u8026\u5408\uff08loose couple\uff09\u7684\u673a\u5236"),Object(r.b)("li",{parentName:"ul"},"\u677e\u8026\u5408\u8ba9\u4ee3\u7801\u66f4\u5177\u7075\u6d3b\u6027\uff0c\u80fd\u66f4\u597d\u5730\u5e94\u5bf9\u9700\u6c42\u53d8\u52a8\uff0c\u4ee5\u53ca\u65b9\u4fbf\u5355\u5143\u6d4b\u8bd5"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u76ee\u524d\u4e3b\u6d41\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"IOC/DI")," \u57fa\u672c\u91c7\u7528\u53cd\u5c04\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u4f9d\u8d56\u6ce8\u5165\uff0c\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4f1a\u5f71\u54cd\u6027\u80fd")))),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u8bf4\u660e")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5728\u672c\u7ae0\u8282\u4e0d\u6253\u7b97\u7ec6\u8bb2 ",Object(r.b)("inlineCode",{parentName:"p"},"\u4f9d\u8d56\u6ce8\u5165/\u63a7\u5236\u53cd\u8f6c")," \u5177\u4f53\u5b9e\u73b0\u548c\u5e94\u7528\u573a\u666f\uff0c\u60f3\u4e86\u89e3\u66f4\u591a\u77e5\u8bc6\uff0c\u53ef\u67e5\u9605 \u3010",Object(r.b)("a",Object(i.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-5.0"}),"ASP.NET Core \u4f9d\u8d56\u6ce8\u5165"),"\u3011 \u5b98\u65b9\u6587\u6863\u3002"))),Object(r.b)("h2",{id:"114-\u4f9d\u8d56\u6ce8\u5165\u7684\u4e09\u79cd\u65b9\u5f0f"},"11.4 \u4f9d\u8d56\u6ce8\u5165\u7684\u4e09\u79cd\u65b9\u5f0f"),Object(r.b)("h3",{id:"1141-\u6784\u9020\u65b9\u6cd5\u6ce8\u5165"},"11.4.1 \u6784\u9020\u65b9\u6cd5\u6ce8\u5165"),Object(r.b)("p",null,"\u76ee\u524d\u6784\u9020\u65b9\u6cd5\u6ce8\u5165\u662f\u4f9d\u8d56\u6ce8\u5165\u63a8\u8350\u4f7f\u7528\u65b9\u5f0f\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u5728\u6784\u9020\u65b9\u6cd5\u4e2d\u4f53\u73b0\u51fa\u5bf9\u5176\u4ed6\u7c7b\u7684\u4f9d\u8d56\uff0c\u4e00\u773c\u5c31\u80fd\u770b\u51fa\u8fd9\u4e2a\u7c7b\u9700\u8981\u5176\u4ed6\u90a3\u4e9b\u7c7b\u624d\u80fd\u5de5\u4f5c"),Object(r.b)("li",{parentName:"ul"},"\u8131\u79bb\u4e86 IOC \u6846\u67b6\uff0c\u8fd9\u4e2a\u7c7b\u4ecd\u7136\u53ef\u4ee5\u5de5\u4f5c\uff0cPOJO \u7684\u6982\u5ff5"),Object(r.b)("li",{parentName:"ul"},"\u4e00\u65e6\u5bf9\u8c61\u521d\u59cb\u5316\u6210\u529f\u4e86\uff0c\u8fd9\u4e2a\u5bf9\u8c61\u7684\u72b6\u6001\u80af\u5b9a\u662f\u6b63\u786e\u7684"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u6784\u9020\u51fd\u6570\u4f1a\u6709\u5f88\u591a\u53c2\u6570\uff08Bad smell\uff09"),Object(r.b)("li",{parentName:"ul"},"\u6709\u4e9b\u7c7b\u662f\u9700\u8981\u9ed8\u8ba4\u6784\u9020\u51fd\u6570\u7684\uff0c\u6bd4\u5982 MVC \u6846\u67b6\u7684 Controller \u7c7b\uff0c\u4e00\u65e6\u4f7f\u7528\u6784\u9020\u51fd\u6570\u6ce8\u5165\uff0c\u5c31\u65e0\u6cd5\u4f7f\u7528\u9ed8\u8ba4\u6784\u9020\u51fd\u6570"),Object(r.b)("li",{parentName:"ul"},"\u8fd9\u4e2a\u7c7b\u91cc\u9762\u7684\u6709\u4e9b\u65b9\u6cd5\u5e76\u4e0d\u9700\u8981\u7528\u5230\u8fd9\u4e9b\u4f9d\u8d56\uff08Bad smell\uff09")))),Object(r.b)("p",null,"\u4ee3\u7801\u793a\u4f8b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{4}","{4}":!0}),"public class FurService\n{\n private readonly IRepository _repository;\n public FurService(IRepository repository)\n {\n _repository = repository;\n }\n}\n")),Object(r.b)("h3",{id:"1142-\u5c5e\u6027\u65b9\u5f0f\u6ce8\u5165"},"11.4.2 \u5c5e\u6027\u65b9\u5f0f\u6ce8\u5165"),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u901a\u8fc7\u5c5e\u6027\u65b9\u5f0f\u6ce8\u5165\u5bb9\u6613\u548c\u7c7b\u7684\u5b9e\u4f8b\u5c5e\u6027\u6df7\u6dc6\uff0c\u4e0d\u5efa\u8bae\u4f7f\u7528\u3002")),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u5728\u5bf9\u8c61\u7684\u6574\u4e2a\u751f\u547d\u5468\u671f\u5185\uff0c\u53ef\u4ee5\u968f\u65f6\u52a8\u6001\u7684\u6539\u53d8\u4f9d\u8d56"),Object(r.b)("li",{parentName:"ul"},"\u975e\u5e38\u7075\u6d3b"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u5bf9\u8c61\u5728\u521b\u5efa\u540e\uff0c\u88ab\u8bbe\u7f6e\u4f9d\u8d56\u5bf9\u8c61\u4e4b\u524d\u8fd9\u6bb5\u65f6\u95f4\u72b6\u6001\u662f\u4e0d\u5bf9\u7684"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u76f4\u89c2\uff0c\u65e0\u6cd5\u6e05\u6670\u5730\u8868\u793a\u54ea\u4e9b\u5c5e\u6027\u662f\u5fc5\u987b\u7684")))),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{3}","{3}":!0}),"public class FurService\n{\n public IRepository Repository { get; set; }\n}\n")),Object(r.b)("h3",{id:"1143-\u65b9\u6cd5\u53c2\u6570\u6ce8\u5165"},"11.4.3 \u65b9\u6cd5\u53c2\u6570\u6ce8\u5165"),Object(r.b)("p",null,"\u65b9\u6cd5\u53c2\u6570\u6ce8\u5165\u7684\u610f\u601d\u662f\u5728\u521b\u5efa\u5bf9\u8c61\u540e\uff0c\u901a\u8fc7\u81ea\u52a8\u8c03\u7528\u67d0\u4e2a\u65b9\u6cd5\u6765\u6ce8\u5165\u4f9d\u8d56\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u4f18\u70b9\uff1a"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u6bd4\u8f83\u7075\u6d3b"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u7f3a\u70b9\uff1a"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u65b0\u52a0\u5165\u4f9d\u8d56\u65f6\u4f1a\u7834\u574f\u539f\u6709\u7684\u65b9\u6cd5\u7b7e\u540d\uff0c\u5982\u679c\u8fd9\u4e2a\u65b9\u6cd5\u5df2\u7ecf\u88ab\u5176\u4ed6\u5f88\u591a\u6a21\u5757\u7528\u5230\u5c31\u5f88\u9ebb\u70e6"),Object(r.b)("li",{parentName:"ul"},"\u4e0e\u6784\u9020\u65b9\u6cd5\u6ce8\u5165\u4e00\u6837\uff0c\u4f1a\u6709\u5f88\u591a\u53c2\u6570")))),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{3}","{3}":!0}),"public class FurService\n{\n public Person GetById([FromServices]IRepository repository, int id)\n {\n return repository.Find(id);\n }\n}\n")),Object(r.b)("h2",{id:"115-\u6ce8\u518c\u5bf9\u8c61\u751f\u5b58\u671f"},"11.5 \u6ce8\u518c\u5bf9\u8c61\u751f\u5b58\u671f"),Object(r.b)("h3",{id:"1151-\u6682\u65f6\u77ac\u65f6-\u751f\u5b58\u671f"},"11.5.1 ",Object(r.b)("inlineCode",{parentName:"h3"},"\u6682\u65f6/\u77ac\u65f6")," \u751f\u5b58\u671f"),Object(r.b)("p",null,"\u6682\u65f6\u751f\u5b58\u671f\u670d\u52a1\u662f\u6bcf\u6b21\u4ece\u670d\u52a1\u5bb9\u5668\u8fdb\u884c\u8bf7\u6c42\u65f6\u521b\u5efa\u7684\u3002 \u8fd9\u79cd\u751f\u5b58\u671f\u9002\u5408\u8f7b\u91cf\u7ea7\u3001 \u65e0\u72b6\u6001\u7684\u670d\u52a1\u3002"),Object(r.b)("p",null,"\u5728\u5904\u7406\u8bf7\u6c42\u7684\u5e94\u7528\u4e2d\uff0c\u5728\u8bf7\u6c42\u7ed3\u675f\u65f6\u4f1a\u91ca\u653e\u6682\u65f6\u670d\u52a1\u3002"),Object(r.b)("p",null,"\u901a\u5e38\u6211\u4eec\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"ITransient")," \u63a5\u53e3\u4f9d\u8d56\u8868\u793a\u8be5\u751f\u547d\u5468\u671f\u3002"),Object(r.b)("h3",{id:"1152-\u4f5c\u7528\u57df-\u751f\u5b58\u671f"},"11.5.2 ",Object(r.b)("inlineCode",{parentName:"h3"},"\u4f5c\u7528\u57df")," \u751f\u5b58\u671f"),Object(r.b)("p",null,"\u4f5c\u7528\u57df\u751f\u5b58\u671f\u670d\u52a1\u9488\u5bf9\u6bcf\u4e2a\u5ba2\u6237\u7aef\u8bf7\u6c42\uff08\u8fde\u63a5\uff09\u521b\u5efa\u4e00\u6b21\u3002\u5728\u5904\u7406\u8bf7\u6c42\u7684\u5e94\u7528\u4e2d\uff0c\u5728\u8bf7\u6c42\u7ed3\u675f\u65f6\u4f1a\u91ca\u653e\u6709\u4f5c\u7528\u57df\u7684\u670d\u52a1\u3002"),Object(r.b)("p",null,"\u901a\u5e38\u6211\u4eec\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"IScoped")," \u63a5\u53e3\u4f9d\u8d56\u8868\u793a\u8be5\u751f\u547d\u5468\u671f\u3002"),Object(r.b)("h3",{id:"1153-\u5355\u4f8b-\u751f\u5b58\u671f"},"11.5.3 ",Object(r.b)("inlineCode",{parentName:"h3"},"\u5355\u4f8b")," \u751f\u5b58\u671f"),Object(r.b)("p",null,"\u5728\u9996\u6b21\u8bf7\u6c42\u5b83\u4eec\u65f6\u8fdb\u884c\u521b\u5efa\uff0c\u4e4b\u540e\u6bcf\u4e2a\u540e\u7eed\u8bf7\u6c42\u90fd\u4f7f\u7528\u76f8\u540c\u7684\u5b9e\u4f8b\u3002"),Object(r.b)("p",null,"\u901a\u5e38\u6211\u4eec\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"ISingleton")," \u63a5\u53e3\u4f9d\u8d56\u8868\u793a\u8be5\u751f\u547d\u5468\u671f\u3002"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(r.b)("inlineCode",{parentName:"p"},"\u670d\u52a1\u751f\u5b58\u671f")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(r.b)("a",Object(i.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-5.0#service-lifetimes"}),"ASP.NET Core - \u4f9d\u8d56\u6ce8\u5165 - \u670d\u52a1\u751f\u5b58\u671f")," \u7ae0\u8282\u3002"))),Object(r.b)("h2",{id:"116-\u5185\u7f6e\u4f9d\u8d56\u63a5\u53e3"},"11.6 \u5185\u7f6e\u4f9d\u8d56\u63a5\u53e3"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e09\u4e2a\u63a5\u53e3\u4f9d\u8d56\u5206\u522b\u5bf9\u5e94\u4e0d\u540c\u7684\u670d\u52a1\u751f\u5b58\u671f\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ITransient"),"\uff1a\u5bf9\u5e94\u6682\u65f6/\u77ac\u65f6\u4f5c\u7528\u57df\u670d\u52a1\u751f\u5b58\u671f"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"IScoped"),"\uff1a\u5bf9\u5e94\u8bf7\u6c42\u4f5c\u7528\u57df\u670d\u52a1\u751f\u5b58\u671f"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ISingleton"),"\uff1a\u5bf9\u5e94\u5355\u4f8b\u4f5c\u7528\u57df\u670d\u52a1\u751f\u5b58\u671f")),Object(r.b)("h2",{id:"117-\u5e38\u89c1\u4f7f\u7528"},"11.7 \u5e38\u89c1\u4f7f\u7528"),Object(r.b)("h3",{id:"1172-\u7b2c\u4e00\u4e2a\u4f8b\u5b50"},"11.7.2 \u7b2c\u4e00\u4e2a\u4f8b\u5b50"),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"IBusinessService")," \u63a5\u53e3\u548c ",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService")," \u5b9e\u73b0\u7c7b\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12}","{7,12}":!0}),"using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DependencyInjection;\n\nnamespace Fur.Application\n{\n public interface IBusinessService\n {\n Person Get(int id);\n }\n\n public class BusinessService : IBusinessService, ITransient\n {\n private readonly IRepository _personRepository;\n\n public BusinessService(IRepository personRepository)\n {\n _personRepository = personRepository;\n }\n\n public Person Get(int id)\n {\n return _personRepository.Find(id);\n }\n }\n}\n")),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"PersonController")," \u63a7\u5236\u5668\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{11,19}","{11,19}":!0}),'using Fur.Application;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n [ApiController]\n public class PersonController : ControllerBase\n {\n private readonly IBusinessService _businessService;\n public PersonController(IBusinessService businessService)\n {\n _businessService = businessService;\n }\n\n [HttpGet]\n public IActionResult Get(int id)\n {\n var person = _businessService.Get(id);\n return new JsonResult(person);\n }\n }\n}\n')),Object(r.b)("img",{src:Object(c.a)("img/di1.gif")}),Object(r.b)("hr",null),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u4f8b\u5b50\u89e3\u8bf4")),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u4e14\u65b9\u4fbf\u7684\u5b9e\u73b0\u4f9d\u8d56\u6ce8\u5165\u7684\u65b9\u5f0f\uff0c\u53ea\u9700\u8981\u5b9e\u4f8b\u7c7b\u7ee7\u627f\u5bf9\u5e94\u751f\u5b58\u671f\u7684\u63a5\u53e3\u5373\u53ef\uff0c\u8fd9\u91cc\u7ee7\u627f\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"ITransient"),"\uff0c\u4e5f\u5c31\u8868\u660e\u4e86\u8fd9\u662f\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"\u6682\u65f6/\u77ac\u65f6")," \u4f5c\u7528\u57df\u5b9e\u4f8b\u7c7b\u3002\u8be5\u7c7b\u5c31\u53ef\u4ee5\u4f5c\u4e3a\u88ab\u6ce8\u5165\u5bf9\u8c61\uff0c\u540c\u65f6\u4e5f\u80fd\u6ce8\u5165\u5176\u4ed6\u63a5\u53e3\u5bf9\u8c61\u3002"),Object(r.b)("p",null,"\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService")," \u6ce8\u5165\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"IRepository")," \u4ed3\u50a8\u63a5\u53e3\uff0c\u540c\u65f6 ",Object(r.b)("inlineCode",{parentName:"p"},"PersonController")," \u63a7\u5236\u5668\u6ce8\u5165\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"IBusinessService")," \u63a5\u53e3\u3002"),Object(r.b)("p",null,"\u8fd9\u6837 ",Object(r.b)("inlineCode",{parentName:"p"},"PersonController")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService")," \u4e4b\u95f4\u5c31\u5b9e\u73b0\u4e86\u89e3\u8026\uff0c\u4e0d\u518d\u4f9d\u8d56\u4e8e\u5177\u4f53\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService")," \u5b9e\u4f8b\u3002"),Object(r.b)("p",null,"\u8fd9\u5c31\u662f\u4f9d\u8d56\u6ce8\u5165/\u63a7\u5236\u53cd\u8f6c\u6700\u7ecf\u5178\u7684\u4f8b\u5b50\u3002"),Object(r.b)("h3",{id:"1173-\u6ce8\u518c\u6cdb\u578b\u5b9e\u4f8b"},"11.7.3 \u6ce8\u518c\u6cdb\u578b\u5b9e\u4f8b"),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"IBusinessService")," \u63a5\u53e3\u548c ",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService")," \u5b9e\u73b0\u7c7b\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,12}","{7,12}":!0}),"using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DependencyInjection;\n\nnamespace Fur.Application\n{\n public interface IBusinessService\n {\n Person Get(int id);\n }\n\n public class BusinessService : IBusinessService, ITransient\n {\n private readonly IRepository _personRepository;\n\n public BusinessService(IRepository personRepository)\n {\n _personRepository = personRepository;\n }\n\n public Person Get(int id)\n {\n return _personRepository.Find(id);\n }\n }\n}\n")),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"PersonController")," \u63a7\u5236\u5668\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{11,19}","{11,19}":!0}),'using Fur.Application;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n [ApiController]\n public class PersonController : ControllerBase\n {\n private readonly IBusinessService _businessService;\n public PersonController(IBusinessService businessService)\n {\n _businessService = businessService;\n }\n\n [HttpGet]\n public IActionResult Get(int id)\n {\n var person = _businessService.Get(id);\n return new JsonResult(person);\n }\n }\n}\n')),Object(r.b)("h3",{id:"1174-\u4e00\u4e2a\u63a5\u53e3\u591a\u4e2a\u5b9e\u73b0"},"11.7.4 \u4e00\u4e2a\u63a5\u53e3\u591a\u4e2a\u5b9e\u73b0"),Object(r.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a\u63a5\u53e3\u53ea\u5bf9\u5e94\u4e00\u4e2a\u5b9e\u73b0\u7c7b\uff0c\u4f46\u6709\u4e9b\u7279\u6b8a\u60c5\u51b5\uff0c\u9700\u8981\u9700\u8981\u591a\u4e2a\u5b9e\u73b0\u7c7b\u6ce8\u518c\u540c\u4e00\u4e2a\u63a5\u53e3\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"p"},"DbContext")," \u591a\u6570\u636e\u5e93\u60c5\u51b5\u3002"),Object(r.b)("p",null,"\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4f9d\u8d56\u6ce8\u5165 ",Object(r.b)("inlineCode",{parentName:"p"},"Func")," \u59d4\u6258\u6765\u89e3\u6790\u591a\u4e2a\u5b9e\u4f8b\uff0c\u5176\u4e2d\u59d4\u6258\u7684\u53c2\u6570\u5206\u522b\u4e3a\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u53c2\u6570 1\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"string")," \u7c7b\u578b\uff0c\u4e0d\u540c\u5b9e\u73b0\u7c7b\u552f\u4e00\u6807\u8bc6\uff0c\u9ed8\u8ba4\u4e3a ",Object(r.b)("inlineCode",{parentName:"li"},"nameof(\u5b9e\u73b0\u7c7b)")," \u540d\u79f0"),Object(r.b)("li",{parentName:"ul"},"\u53c2\u6570 2\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Type")," \u7c7b\u578b\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"IPrivateDependency")," \u6d3e\u751f\u63a5\u53e3\uff0c\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"li"},"ITransient"),"\u3001",Object(r.b)("inlineCode",{parentName:"li"},"IScoped"),"\u3001",Object(r.b)("inlineCode",{parentName:"li"},"ISingleton")),Object(r.b)("li",{parentName:"ul"},"\u8fd4\u56de\u503c\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"object")," \u7c7b\u578b\uff0c\u8fd4\u56de\u5177\u4f53\u7684\u5b9e\u73b0\u7c7b\u5b9e\u4f8b")),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"IBusinessService")," \u63a5\u53e3\u548c ",Object(r.b)("inlineCode",{parentName:"p"},"BusinessService"),"\u3001",Object(r.b)("inlineCode",{parentName:"p"},"OtherBusinessService")," \u4e24\u4e2a\u5b9e\u73b0\u7c7b\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,10,18}","{5,10,18}":!0}),'using Fur.DependencyInjection;\n\nnamespace Fur.Application\n{\n public interface IBusinessService\n {\n string GetName();\n }\n\n public class BusinessService : IBusinessService, ITransient\n {\n public string GetName()\n {\n return "\u6211\u662f\uff1a" + nameof(BusinessService);\n }\n }\n\n public class OtherBusinessService : IBusinessService, ITransient\n {\n public string GetName()\n {\n return "\u6211\u662f\uff1a" + nameof(OtherBusinessService);\n }\n }\n}\n')),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"ValueController")," \u63a7\u5236\u5668\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{15,17,18}","{15,17,18}":!0}),'using Fur.Application;\nusing Fur.DependencyInjection;\nusing Microsoft.AspNetCore.Mvc;\nusing System;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n [ApiController]\n public class ValueController : ControllerBase\n {\n private readonly IBusinessService _businessService;\n private readonly IBusinessService _otherBusinessService;\n\n public ValueController(Func resolveNamed)\n {\n _businessService = resolveNamed("BusinessService", default) as IBusinessService;\n _otherBusinessService = resolveNamed("OtherBusinessService", default) as IBusinessService;\n }\n\n [HttpGet]\n public string GetName()\n {\n return _businessService.GetName() + "----------" + _otherBusinessService.GetName();\n }\n }\n}\n')),Object(r.b)("img",{src:Object(c.a)("img/di2.gif")}),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c\u9700\u8981\u81ea\u5b9a\u4e49\u89e3\u6790\u540d\u79f0\uff0c\u53ea\u9700\u8981\u8d34 ",Object(r.b)("inlineCode",{parentName:"p"},'[Injection(Named = "\u540d\u79f0")]')," \u5373\u53ef\uff0c\u5982\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,11}","{5,11}":!0}),'using Fur.DependencyInjection;\n\nnamespace Fur.Application\n{\n [Injection(Named = "BusName1")]\n public class BusinessService : IBusinessService, ITransient\n {\n // ...\n }\n\n [Injection(Named = "BusName2")]\n public class OtherBusinessService : IBusinessService, ITransient\n {\n // ...\n }\n}\n')),Object(r.b)("p",{parentName:"div"},"\u89e3\u6790\u670d\u52a1\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs"}),'_businessService = resolveNamed("BusName1", default) as IBusinessService;\n_otherBusinessService = resolveNamed("BusName2", default) as IBusinessService;\n')))),Object(r.b)("h3",{id:"1175-\u65e0\u63a5\u53e3\u65b9\u5f0f"},"11.7.5 \u65e0\u63a5\u53e3\u65b9\u5f0f"),Object(r.b)("p",null,"\u6709\u4e9b\u65f6\u5019\uff0c\u6211\u4eec\u4e0d\u60f3\u5b9a\u4e49\u63a5\u53e3\uff0c\u800c\u662f\u60f3\u628a\u5b9e\u4f8b\u7c7b\u4f5c\u4e3a\u53ef\u4f9d\u8d56\u6ce8\u5165\u7684\u5bf9\u8c61\uff0c\u5982 MVC \u4e2d\u7684\u63a7\u5236\u5668\u3002"),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"SelfService")," \u5b9e\u4f8b\u7c7b\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{7,11}","{7,11}":!0}),"using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DependencyInjection;\n\nnamespace Fur.Application\n{\n public class SelfService : ITransient\n {\n private readonly IRepository _personRepository;\n\n public SelfService(IRepository personRepository)\n {\n _personRepository = personRepository;\n }\n\n public Person Get(int id)\n {\n return _personRepository.Find(id);\n }\n }\n}\n")),Object(r.b)("p",null,"\u521b\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"ValueController")," \u63a7\u5236\u5668\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{13,21}","{13,21}":!0}),'using Fur.Application;\nusing Fur.Core;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n [ApiController]\n public class ValueController : ControllerBase\n {\n private readonly SelfService _selfService;\n\n public ValueController(SelfService selfService)\n {\n _selfService = selfService;\n }\n\n [HttpGet]\n public Person Get(int id)\n {\n return _selfService.Get(id);\n }\n }\n}\n')),Object(r.b)("h2",{id:"118-injection-\u7279\u6027\u914d\u7f6e"},"11.8 ",Object(r.b)("inlineCode",{parentName:"h2"},"[Injection]")," \u7279\u6027\u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b ",Object(r.b)("inlineCode",{parentName:"p"},"[Injection]")," \u7279\u6027\u53ef\u4ee5\u6539\u53d8\u6ce8\u518c\u65b9\u5f0f\uff0c\u540c\u65f6\u8fd8\u80fd\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"AOP")," \u62e6\u622a\u3002"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"[Injection]")," \u63d0\u4f9b\u4ee5\u4e0b\u914d\u7f6e\u652f\u6301\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Action"),"\uff1a\u914d\u7f6e\u6ce8\u518c\u884c\u4e3a\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"InjectionActions")," \u7c7b\u578b\uff0c\u53ef\u9009\u503c\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Add"),"\uff1a",Object(r.b)("strong",{parentName:"li"},"\u9ed8\u8ba4\u503c"),"\uff0c\u8868\u793a\u65e0\u9650\u5236\u6dfb\u52a0\u6ce8\u518c\u670d\u52a1\uff0c\u8be5\u65b9\u5f0f\u652f\u6301\u4e00\u4e2a\u63a5\u53e3\u591a\u4e2a\u5b9e\u73b0"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"TryAdd"),"\uff1a\u8868\u793a\u6ce8\u518c\u5df2\u5b58\u5728\u5219\u8df3\u8fc7\u6ce8\u518c"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Pattern"),"\uff1a\u914d\u7f6e\u6ce8\u518c\u9009\u9879\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"InjectionPatterns")," \u7c7b\u578b\uff0c\u53ef\u9009\u503c\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Self"),"\uff1a\u53ea\u6ce8\u518c\u81ea\u5df1"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"FirstInterface"),"\uff1a\u53ea\u6ce8\u518c\u7b2c\u4e00\u4e2a\u63a5\u53e3"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"SelfWithFirstInterface"),"\uff1a\u6ce8\u518c\u81ea\u5df1\u548c\u7b2c\u4e00\u4e2a\u63a5\u53e3\uff0c",Object(r.b)("strong",{parentName:"li"},"\u9ed8\u8ba4\u503c")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ImplementedInterfaces"),"\uff1a\u6ce8\u518c\u6240\u6709\u63a5\u53e3"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"All"),"\uff1a\u6ce8\u518c\u81ea\u5df1\u5305\u62ec\u6240\u6709\u63a5\u53e3"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Named"),"\uff1a\u914d\u7f6e\u5b9e\u4f8b\u522b\u540d\uff0c\u901a\u8fc7\u522b\u540d\u53ef\u4ee5\u89e3\u6790\u63a5\u53e3\uff0c\u5982\u540c\u4e00\u4e2a\u63a5\u53e3\u6709\u591a\u4e2a\u5b9e\u73b0\uff0c\u90a3\u4e48\u53ef\u4ee5\u901a\u8fc7\u522b\u540d\u89e3\u6790\u4e0d\u540c\u7684\u5b9e\u73b0\uff0c\u9ed8\u8ba4\u53ea\u4e3a\u5b9e\u73b0\u7c7b\u7684\u7c7b\u540d"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Order"),"\uff1a\u6ce8\u518c\u6392\u5e8f\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u5219\u8d8a\u5728\u6700\u540e\u6ce8\u518c\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"0")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Proxy"),"\uff1a\u914d\u7f6e\u4ee3\u7406\u62e6\u622a\u7c7b\u578b\uff0c\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"li"},"AOP"),"\uff0c",Object(r.b)("strong",{parentName:"li"},"\u4ee3\u7406\u7c7b\u578b\u5fc5\u987b\u7ee7\u627f ",Object(r.b)("inlineCode",{parentName:"strong"},"DispatchProxy")," \u7c7b\u548c ",Object(r.b)("inlineCode",{parentName:"strong"},"IDispatchProxy")," \u63a5\u53e3"),"\uff0c\u65e0\u9ed8\u8ba4\u503c")),Object(r.b)("h2",{id:"119-\u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c"},"11.9 \u81ea\u5b9a\u4e49\u9ad8\u7ea7\u6ce8\u518c"),Object(r.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u7684\u6ce8\u518c\u65b9\u5f0f\u53ef\u4ee5\u6ee1\u8db3\u5927\u591a\u6570\u4f9d\u8d56\u6ce8\u5165\u7684\u9700\u6c42\uff0c\u5982\u6709\u7279\u522b\u6ce8\u518c\u9700\u6c42\uff0c\u53ea\u9700\u8981\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Startup")," \u4e2d\u914d\u7f6e\u5373\u53ef\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs"}),"services.AddScoped(typeof(ISpecService), provider = > {\n // \u81ea\u5b9a\u4e49\u4efb\u4f55\u521b\u5efa\u5b9e\u4f8b\u7684\u65b9\u5f0f\n var instance = new SpecService(); // \u6216\u8005\u53ef\u4ee5\u901a\u8fc7 AOP\u63d2\u4ef6\u8fd4\u56de\u4ee3\u7406\u5b9e\u4f8b\n\n return instance;\n});\n")),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u8865\u5145\u8bf4\u660e")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"AppDbContext")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u8fd8\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"ISqlDispatchProxy")," \u90fd\u662f\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u521b\u5efa\u7684\u3002"))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u77e5\u8bc6\u5bfc\u822a")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a\u81ea\u5b9a\u4e49\u9ad8\u7ea7\u4e2d\u6ce8\u518c\uff0c\u53ef\u67e5\u9605 \u3010",Object(r.b)("a",Object(i.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-5.0"}),"ASP.NET Core \u4f9d\u8d56\u6ce8\u5165"),"\u3011 \u5b98\u65b9\u6587\u6863\u3002"))),Object(r.b)("h2",{id:"1110-appsettingsjson-\u914d\u7f6e\u6ce8\u518c"},"11.10 ",Object(r.b)("inlineCode",{parentName:"h2"},"appsettings.json")," \u914d\u7f6e\u6ce8\u518c"),Object(r.b)("p",null,"\u9664\u4e86\u5728\u4ee3\u7801\u4e2d\u5b9e\u73b0\u4f9d\u8d56\u6ce8\u5165\uff0c\u4e5f\u53ef\u4ee5\u5b9e\u73b0\u52a8\u6001\u4f9d\u8d56\u6ce8\u5165\uff0c\u65e0\u9700\u4fee\u6539\u4ee3\u7801\u6216\u91cd\u65b0\u7f16\u8bd1\u5373\u53ef\u5b9e\u73b0\u70ed\u62d4\u63d2\uff08\u63d2\u4ef6\uff09\u6548\u679c\u3002\u914d\u7f6e\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-json",metastring:"{3}","{3}":!0}),'{\n "AppSettings": {\n "DependencyInjectionSettings": {\n "Definitions": [\n {\n "Interface": "Fur.Application;Fur.Application.ITestService",\n "Service": "Fur.Application;Fur.Application.TestService",\n "RegisterType": "Transient",\n "Action": "Add",\n "Pattern": "SelfWithFirstInterface",\n "Named": "TestService",\n "Order": 1,\n "Proxy": "Fur.Application;Fur.Application.LogDispathProxy"\n }\n ]\n }\n }\n}\n')),Object(r.b)("p",null,"\u914d\u7f6e\u8bf4\u660e\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DependencyInjectionSettings"),"\uff1a\u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e\u6839\u8282\u70b9",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Definitions"),"\uff1a\u52a8\u6001\u4f9d\u8d56\u6ce8\u5165\u914d\u7f6e\u8282\u70b9\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"ExternalService")," \u6570\u7ec4\u7c7b\u578b",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ExternalService"),"\uff1a\u914d\u7f6e\u5355\u4e2a\u4f9d\u8d56\u6ce8\u5165\u4fe1\u606f",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Interface"),"\uff1a\u914d\u7f6e\u4f9d\u8d56\u63a5\u53e3\u4fe1\u606f\uff0c\u683c\u5f0f\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"\u7a0b\u5e8f\u96c6\u540d\u79f0;\u63a5\u53e3\u5b8c\u6574\u540d\u79f0"),"\uff0c\u5982\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Fur.Application;Fur.Application.ITestService")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Service"),"\uff1a\u914d\u7f6e\u63a5\u53e3\u5b9e\u73b0\u4fe1\u606f\uff0c\u683c\u5f0f\u540c\u4e0a"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"RegisterType"),"\uff1a\u914d\u7f6e\u4f9d\u8d56\u6ce8\u5165\u7684\u5bf9\u8c61\u751f\u5b58\u671f\uff0c\u53d6\u503c\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Transient"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"Scoped"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"Singleton")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Action"),"\uff1a\u6ce8\u518c\u884c\u4e3a\uff0c\u53ef\u9009\u503c\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Add"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"TryAdd"),"\uff0c\u53c2\u89c1 ",Object(r.b)("a",Object(i.a)({parentName:"li"},{href:"#118-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"}),"#118-injection-\u7279\u6027\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Pattern"),"\uff1a\u6ce8\u518c\u9009\u9879\uff0c\u53c2\u89c1 ",Object(r.b)("a",Object(i.a)({parentName:"li"},{href:"#118-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"}),"#118-injection-\u7279\u6027\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Named"),"\uff1a\u6ce8\u518c\u522b\u540d\uff0c\u53c2\u89c1 ",Object(r.b)("a",Object(i.a)({parentName:"li"},{href:"#118-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"}),"#118-injection-\u7279\u6027\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Order"),"\uff1a\u6ce8\u518c\u6392\u5e8f\uff0c\u53c2\u89c1 ",Object(r.b)("a",Object(i.a)({parentName:"li"},{href:"#118-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"}),"#118-injection-\u7279\u6027\u914d\u7f6e")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Proxy"),"\uff1a\u914d\u7f6e\u4ee3\u7406\u62e6\u622a\uff0c\uff0c\u683c\u5f0f\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"\u7a0b\u5e8f\u96c6\u540d\u79f0;\u4ee3\u7406\u7c7b\u5b8c\u6574\u540d\u79f0"),"\uff0c\u53c2\u89c1 ",Object(r.b)("a",Object(i.a)({parentName:"li"},{href:"#118-injection-%E7%89%B9%E6%80%A7%E9%85%8D%E7%BD%AE"}),"#118-injection-\u7279\u6027\u914d\u7f6e"))))))))),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u5173\u4e8e\u5916\u90e8\u7a0b\u5e8f\u96c6")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c\u52a8\u6001\u6ce8\u5165\u7684\u5bf9\u8c61\u662f\u5916\u90e8\u7a0b\u5e8f\u96c6\uff0c\u90a3\u4e48\u9996\u5148\u5148\u6ce8\u518c\u5916\u90e8\u7a0b\u5e8f\u96c6\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-json"}),'{\n "AppSettings": {\n "ExternalAssemblies": ["\u5916\u90e8\u7a0b\u5e8f\u96c6\u540d\u79f0", "Taobao.Pay"] // \u652f\u6301\u591a\u4e2a\n }\n}\n')))),Object(r.b)("h2",{id:"1111-\u6ce8\u518c\u987a\u5e8f\u548c\u4f18\u5148\u7ea7"},"11.11 \u6ce8\u518c\u987a\u5e8f\u548c\u4f18\u5148\u7ea7"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u9ed8\u8ba4\u6ce8\u518c\u987a\u5e8f\u662f\u6309\u7167\u7a0b\u5e8f\u96c6\u626b\u63cf\u987a\u5e8f\u8fdb\u884c\u6ce8\u518c\uff0c\u5982\u679c\u9700\u8981\u6539\u53d8\u6ce8\u518c\u987a\u5e8f\uff0c\u53ef\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"[Injection(Order)]")," \u7279\u6027\u6307\u5b9a\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Order")," \u503c\u8d8a\u5927\uff0c\u5219\u8d8a\u5728\u6700\u540e\u6ce8\u518c\u3002"),Object(r.b)("p",null,"\u53e6\u5916 ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u914d\u7f6e\u7684\u4f18\u5148\u7ea7\u6700\u5927\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u914d\u7f6e\u7684\u6ce8\u518c\u4f1a\u8986\u76d6\u4e4b\u524d\u6240\u6709\u6ce8\u518c\u3002"),Object(r.b)("h2",{id:"1112-aop-\u6ce8\u518c\u62e6\u622a"},"11.12 ",Object(r.b)("inlineCode",{parentName:"h2"},"Aop")," \u6ce8\u518c\u62e6\u622a"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"AOP")," \u662f\u975e\u5e38\u91cd\u8981\u7684\u601d\u60f3\u548c\u6280\u672f\uff0c\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"\u9762\u5411\u5207\u9762")," \u7f16\u7a0b\uff0c\u53ef\u4ee5\u8ba9\u6211\u4eec\u5728\u4e0d\u6539\u52a8\u539f\u6765\u4ee3\u7801\u7684\u60c5\u51b5\u4e0b\u8fdb\u884c\u52a8\u6001\u7be1\u6539\u4e1a\u52a1\u4ee3\u7801\u3002"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"Aop")," \u975e\u5e38\u7b80\u5355\uff0c\u5982\uff1a"),Object(r.b)("p",null,"\u5047\u8bbe\u6211\u4eec\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"ITestService")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"TestService")," \u4e24\u4e2a\u7c7b\u578b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs"}),"public class ITestService\n{\n string SayHello(string word);\n}\n")),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs"}),'public class TestService: ITestService, ITransient\n{\n public string SayHello(string word)\n {\n return $"Hello {word}";\n }\n}\n')),Object(r.b)("p",null,"\u73b0\u5728\u6211\u4eec\u6709\u4e00\u4e2a\u9700\u6c42\uff0c\u6211\u4eec\u5e0c\u671b\u8c03\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"SayHello")," \u7684\u65f6\u5019\u53ef\u4ee5\u8bb0\u5f55\u65e5\u5fd7\u548c\u6743\u9650\u63a7\u5236\uff08\u4e4b\u524d\u6ca1\u6709\u8003\u8651\u5230\u7684\u9700\u6c42\uff09\u3002"),Object(r.b)("p",null,"\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u53ea\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u4ee3\u7406\u7c7b\u5373\u53ef\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"p"},"LogDispatchProxy")," "),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,3,7,25}","{1,3,7,25}":!0}),'using Fur.DependencyInjection;\nusing System;\nusing System.Reflection;\n\nnamespace Fur.Application\n{\n public class LogDispatchProxy : DispatchProxy, IDispatchProxy\n {\n /// \n /// \u5f53\u524d\u670d\u52a1\u5b9e\u4f8b\n /// \n public object Target { get; set; }\n\n /// \n /// \u670d\u52a1\u63d0\u4f9b\u5668\uff0c\u53ef\u4ee5\u7528\u6765\u89e3\u6790\u670d\u52a1\uff0c\u5982\uff1aServices.GetService()\n /// \n public IServiceProvider Services { get; set; }\n\n /// \n /// \u62e6\u622a\u65b9\u6cd5\n /// \n /// \n /// \n /// \n protected override object Invoke(MethodInfo targetMethod, object[] args)\n {\n Console.WriteLine("SayHello \u65b9\u6cd5\u88ab\u8c03\u7528\u4e86");\n\n var result = targetMethod.Invoke(Target, args);\n\n Console.WriteLine("SayHello \u65b9\u6cd5\u8fd4\u56de\u503c\uff1a" + result);\n\n return result;\n }\n }\n}\n')),Object(r.b)("p",null,"\u4e4b\u540e\u6211\u4eec\u53ea\u9700\u8981\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"TestService")," \u589e\u52a0 ",Object(r.b)("inlineCode",{parentName:"p"},"[Injection]")," \u7279\u6027\u5373\u53ef\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),'[Injection(Proxy = typeof(LogDispatchProxy))]\npublic class TestService: ITestService, ITransient\n{\n public string SayHello(string word)\n {\n return $"Hello {word}";\n }\n}\n')),Object(r.b)("p",null,"\u4e4b\u540e ",Object(r.b)("inlineCode",{parentName:"p"},"SayHello")," \u65b9\u6cd5\u88ab\u8c03\u7528\u7684\u65f6\u5019\u5c31\u53ef\u4ee5\u5b9e\u73b0\u52a8\u6001\u62e6\u622a\u4e86\uff0c\u6bd4\u5982\u8fd9\u91cc\u5199\u65e5\u5fd7\u3002"),Object(r.b)("h3",{id:"11121-aop-\u7684\u4f5c\u7528"},"11.12.1 ",Object(r.b)("inlineCode",{parentName:"h3"},"AOP")," \u7684\u4f5c\u7528"),Object(r.b)("p",null,"\u8fd9\u79cd\u9762\u5411\u5207\u9762\u7684\u80fd\u529b\uff08\u52a8\u6001\u62e6\u622a/\u4ee3\u7406\uff09\u53ef\u4ee5\u5b9e\u73b0\u5f88\u591a\u5f88\u591a\u529f\u80fd\uff0c\u5982\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u65e5\u5fd7\u8bb0\u5f55"),Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u4fee\u6539\u53c2\u6570"),Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u4fee\u6539\u8fd4\u56de\u503c"),Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u65b9\u6cd5\u91cd\u5b9a\u5411"),Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u4fee\u6539\u4ee3\u7801\u903b\u8f91"),Object(r.b)("li",{parentName:"ul"},"\u52a8\u6001\u5b9e\u73b0\u5f02\u5e38\u76d1\u542c")),Object(r.b)("p",null,"\u8fd8\u53ef\u4ee5\u505a\u66f4\u591a\u66f4\u591a\u7684\u4e8b\u60c5\u3002"),Object(r.b)("h2",{id:"1113-\u53cd\u9988\u4e0e\u5efa\u8bae"},"11.13 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(i.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/62953dcd.c5d8591d.js b/docs/62953dcd.c5d8591d.js new file mode 100644 index 00000000000..097eaf26545 --- /dev/null +++ b/docs/62953dcd.c5d8591d.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[35],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return s})),t.d(n,"b",(function(){return u}));var a=t(0),r=t.n(a);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var b=r.a.createContext({}),l=function(e){var n=r.a.useContext(b),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},s=function(e){var n=l(e.components);return r.a.createElement(b.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},m=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,b=p(e,["components","mdxType","originalType","parentName"]),s=l(t),m=a,u=s["".concat(c,".").concat(m)]||s[m]||d[m]||i;return t?r.a.createElement(u,o(o({ref:n},b),{},{components:t})):r.a.createElement(u,o({ref:n},b))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,c=new Array(i);c[0]=m;var o={};for(var p in n)hasOwnProperty.call(n,p)&&(o[p]=n[p]);o.originalType=e,o.mdxType="string"==typeof e?e:a,c[1]=o;for(var b=2;bfunction(e,n,t,{forcePrependBaseUrl:a=!1,absolute:i=!1}={}){if(!t)return t;if(t.startsWith("#"))return t;if(Object(r.b)(t))return t;if(a)return n+t;const c=t.startsWith(n)?t:n+t.replace(/^\//,"");return i?e+c:c}(n,e,t,a)}}function c(e,n={}){const{withBaseUrl:t}=i();return t(e,n)}},145:function(e,n,t){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function r(e){return void 0!==e&&!a(e)}t.d(n,"b",(function(){return a})),t.d(n,"a",(function(){return r}))},90:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return o})),t.d(n,"metadata",(function(){return p})),t.d(n,"rightToc",(function(){return b})),t.d(n,"default",(function(){return s}));var a=t(2),r=t(6),i=(t(0),t(142)),c=t(144),o={id:"friendly-exception",title:"7. \u53cb\u597d\u5f02\u5e38\u5904\u7406",sidebar_label:"7. \u53cb\u597d\u5f02\u5e38\u5904\u7406"},p={unversionedId:"friendly-exception",id:"friendly-exception",isDocsHomePage:!1,title:"7. \u53cb\u597d\u5f02\u5e38\u5904\u7406",description:"7.1 \u4ec0\u4e48\u662f\u5f02\u5e38",source:"@site/docs\\friendly-exception.mdx",slug:"/friendly-exception",permalink:"/docs/friendly-exception",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/friendly-exception.mdx",version:"current",sidebar_label:"7. \u53cb\u597d\u5f02\u5e38\u5904\u7406",sidebar:"docs",previous:{title:"6. \u89c4\u8303\u5316\u63a5\u53e3\u6587\u6863",permalink:"/docs/specification-document"},next:{title:"8. \u6570\u636e\u6821\u9a8c",permalink:"/docs/data-validation"}},b=[{value:"7.1 \u4ec0\u4e48\u662f\u5f02\u5e38",id:"71-\u4ec0\u4e48\u662f\u5f02\u5e38",children:[]},{value:"7.2 \u5904\u7406\u5f02\u5e38\u65b9\u5f0f",id:"72-\u5904\u7406\u5f02\u5e38\u65b9\u5f0f",children:[]},{value:"7.3 \u4ec0\u4e48\u662f\u53cb\u597d\u5f02\u5e38\u5904\u7406",id:"73-\u4ec0\u4e48\u662f\u53cb\u597d\u5f02\u5e38\u5904\u7406",children:[{value:"7.3.1 \u975e\u53cb\u597d\u5f02\u5e38\u5904\u7406",id:"731-\u975e\u53cb\u597d\u5f02\u5e38\u5904\u7406",children:[]},{value:"7.3.2 \u53cb\u597d\u5f02\u5e38\u5904\u7406",id:"732-\u53cb\u597d\u5f02\u5e38\u5904\u7406",children:[]}]},{value:"7.4 \u53cb\u597d\u5f02\u5e38\u5904\u7406\u4f7f\u7528\u793a\u4f8b",id:"74-\u53cb\u597d\u5f02\u5e38\u5904\u7406\u4f7f\u7528\u793a\u4f8b",children:[{value:"7.4.1 \u6ce8\u518c\u53cb\u597d\u5f02\u5e38\u670d\u52a1",id:"741-\u6ce8\u518c\u53cb\u597d\u5f02\u5e38\u670d\u52a1",children:[]},{value:"7.4.2 \u4e24\u4e2a\u4f8b\u5b50",id:"742-\u4e24\u4e2a\u4f8b\u5b50",children:[]}]},{value:"7.5 \u5173\u4e8e Oops.Oh",id:"75-\u5173\u4e8e-oopsoh",children:[{value:"7.6.1 \u4e3a\u4ec0\u4e48\u8d77\u8fd9\u4e2a\u540d\u5b57\uff1f",id:"761-\u4e3a\u4ec0\u4e48\u8d77\u8fd9\u4e2a\u540d\u5b57\uff1f",children:[]},{value:"7.6.2 Oops.Oh \u91cd\u8f7d\u65b9\u6cd5",id:"762-oopsoh-\u91cd\u8f7d\u65b9\u6cd5",children:[]}]},{value:"7.6 \u6700\u4f73\u5b9e\u8df5 \ud83e\udd17",id:"76-\u6700\u4f73\u5b9e\u8df5-",children:[{value:"7.6.1 \u521b\u5efa\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b",id:"761-\u521b\u5efa\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b",children:[]},{value:"7.6.2 \u5173\u4e8e [ErrorCodeItemMetadata]",id:"762-\u5173\u4e8e-errorcodeitemmetadata",children:[]},{value:"7.6.3 \u9759\u6001\u5f02\u5e38\u7c7b\u4f7f\u7528",id:"763-\u9759\u6001\u5f02\u5e38\u7c7b\u4f7f\u7528",children:[]},{value:"7.6.4 \u66f4\u591a\u4f8b\u5b50",id:"764-\u66f4\u591a\u4f8b\u5b50",children:[]}]},{value:"7.7 \u591a\u4e2a\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b",id:"77-\u591a\u4e2a\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b",children:[]},{value:"7.8 IErrorCodeTypeProvider \u63d0\u4f9b\u5668",id:"78-ierrorcodetypeprovider-\u63d0\u4f9b\u5668",children:[]},{value:"7.9 appsetting.json \u4e2d\u914d\u7f6e",id:"79-appsettingjson-\u4e2d\u914d\u7f6e",children:[]},{value:"7.10 [IfException] \u4f7f\u7528",id:"710-ifexception-\u4f7f\u7528",children:[{value:"7.10.1 \u4f7f\u7528\u793a\u4f8b",id:"7101-\u4f7f\u7528\u793a\u4f8b",children:[]},{value:"7.10.2 \u66f4\u591a\u4f8b\u5b50",id:"7102-\u66f4\u591a\u4f8b\u5b50",children:[]}]},{value:"7.11 \u5f02\u5e38\u6d88\u606f\u4f18\u5148\u7ea7",id:"711-\u5f02\u5e38\u6d88\u606f\u4f18\u5148\u7ea7",children:[]},{value:"7.12 \u591a\u8bed\u8a00\u652f\u6301",id:"712-\u591a\u8bed\u8a00\u652f\u6301",children:[]},{value:"7.13 \u5f02\u5e38\u6a21\u578b\u63d0\u4f9b\u5668",id:"713-\u5f02\u5e38\u6a21\u578b\u63d0\u4f9b\u5668",children:[]},{value:"7.14 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"714-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],l={rightToc:b};function s(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(a.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"71-\u4ec0\u4e48\u662f\u5f02\u5e38"},"7.1 \u4ec0\u4e48\u662f\u5f02\u5e38"),Object(i.b)("p",null,"\u5f02\u5e38\u4e00\u822c\u662f\u6307\u8fd0\u884c\u671f\uff08\u6b64\u5904\u7279\u6307 ",Object(i.b)("inlineCode",{parentName:"p"},"Exception")," \u7c7b\uff09\u4f1a\u53d1\u751f\u7684\u5bfc\u81f4\u7a0b\u5e8f\u610f\u5916\u4e2d\u6b62\u7684\u95ee\u9898\uff0c\u662f\u4e00\u79cd\u5bf9\u95ee\u9898\u7684\u63cf\u8ff0\u540e\u7684\u5c01\u88c5\u5bf9\u8c61\u3002"),Object(i.b)("p",null,"\u5728\u8fc7\u53bb\u5f00\u53d1\u4e2d\uff0c\u901a\u5e38\u5f02\u5e38\u7531\u7cfb\u7edf\u8fd0\u884c\u65f6\u51fa\u9519\u629b\u51fa\uff0c\u4f46\u73b0\u5728\u7684\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u5e94\u5728\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u5408\u7406\u7684\u629b\u51fa\u5f02\u5e38\uff0c\u6bd4\u5982\u66f4\u65b0\u4e00\u6761\u4e0d\u5b58\u5728\u7684\u5b9e\u4f53\uff0c\u6216\u67e5\u8be2\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u6570\u636e\u7b49\u7b49\u3002"),Object(i.b)("h2",{id:"72-\u5904\u7406\u5f02\u5e38\u65b9\u5f0f"},"7.2 \u5904\u7406\u5f02\u5e38\u65b9\u5f0f"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u4e0d\u5904\u7406\uff0c\u76f4\u63a5\u4e2d\u65ad\u7a0b\u5e8f\u6267\u884c\uff08\u4e0d\u63a8\u8350\uff09"),Object(i.b)("li",{parentName:"ul"},"\u901a\u8fc7 ",Object(i.b)("inlineCode",{parentName:"li"},"try catch finally")," \u5904\u7406\uff08\u4e0d\u63a8\u8350\uff09"),Object(i.b)("li",{parentName:"ul"},"\u5168\u5c40\u7edf\u4e00\u5904\u7406\uff0c\u5e76\u8bb0\u5f55\u5f02\u5e38\u4fe1\u606f",Object(i.b)("strong",{parentName:"li"},"\uff08\u63a8\u8350\uff09")),Object(i.b)("li",{parentName:"ul"},"\u5f02\u5e38\u6ce8\u89e3\u65b9\u5f0f\u5904\u7406\uff0c\u652f\u6301",Object(i.b)("strong",{parentName:"li"},"\u672c\u5730\u5316")," ",Object(i.b)("strong",{parentName:"li"},"\uff08\u63a8\u8350\uff09"))),Object(i.b)("h2",{id:"73-\u4ec0\u4e48\u662f\u53cb\u597d\u5f02\u5e38\u5904\u7406"},"7.3 \u4ec0\u4e48\u662f\u53cb\u597d\u5f02\u5e38\u5904\u7406"),Object(i.b)("h3",{id:"731-\u975e\u53cb\u597d\u5f02\u5e38\u5904\u7406"},"7.3.1 \u975e\u53cb\u597d\u5f02\u5e38\u5904\u7406"),Object(i.b)("p",null,"\u5728\u4e86\u89e3\u53cb\u597d\u5f02\u5e38\u5904\u7406\u4e4b\u524d\u53ef\u4ee5\u770b\u770b\u975e\u53cb\u597d\u5f02\u5e38\u5904\u7406\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u5bf9\u7ec8\u7aef\u7528\u6237\u629b\u51fa ",Object(i.b)("inlineCode",{parentName:"li"},"500\u72b6\u6001\u7801")," \u5806\u6808\u4fe1\u606f"),Object(i.b)("li",{parentName:"ul"},"\u5927\u91cf\u7684 ",Object(i.b)("inlineCode",{parentName:"li"},"try catch")," \u4ee3\u7801\uff0c\u6c61\u67d3\u6b63\u5e38\u4e1a\u52a1\u903b\u8f91"),Object(i.b)("li",{parentName:"ul"},"\u6ca1\u6709\u89c4\u8303\u5316\u7684\u5f02\u5e38\u72b6\u6001\u7801\u548c\u5f02\u5e38\u6d88\u606f\u7ba1\u7406"),Object(i.b)("li",{parentName:"ul"},"\u6ca1\u6709\u5f02\u5e38\u65e5\u5fd7\u6536\u96c6\u8bb0\u5f55"),Object(i.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u5f02\u5e38\u6d88\u606f\u672c\u5730\u5316\u5904\u7406"),Object(i.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u5f02\u5e38\u7b56\u7565\uff0c\u5931\u8d25\u540e\u7a0b\u5e8f\u7acb\u5373\u7ec8\u6b62"),Object(i.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u5206\u5e03\u5f0f\u4e8b\u52a1 CAP"),Object(i.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u5f02\u5e38\u4f20\u64ad"),Object(i.b)("li",{parentName:"ul"},"\u8fd4\u56de\u7684\u5f02\u5e38\u683c\u5f0f\u6742\u4e71")),Object(i.b)("h3",{id:"732-\u53cb\u597d\u5f02\u5e38\u5904\u7406"},"7.3.2 \u53cb\u597d\u5f02\u5e38\u5904\u7406"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u5bf9\u7ec8\u7aef\u7528\u6237\u63d0\u793a\u53cb\u597d"),Object(i.b)("li",{parentName:"ul"},"\u5bf9\u540e\u7aef\u5f00\u53d1\u4eba\u5458\u63d0\u4f9b\u8be6\u7ec6\u7684\u5f02\u5e38\u5806\u6808"),Object(i.b)("li",{parentName:"ul"},"\u4e0d\u5e72\u6270\u6b63\u5e38\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801\uff0c\u5982 \u6ca1\u6709 ",Object(i.b)("inlineCode",{parentName:"li"},"try catch")," \u4ee3\u7801"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u5f02\u5e38\u72b6\u6001\u7801\u591a\u65b9\u8bbe\u7f6e"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u5f02\u5e38\u6d88\u606f\u672c\u5730\u5316"),Object(i.b)("li",{parentName:"ul"},"\u5f02\u5e38\u4fe1\u606f\u7edf\u4e00\u914d\u7f6e\u7ba1\u7406"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u5f02\u5e38\u7b56\u7565\uff0c\u5982\u91cd\u8bd5"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u5f02\u5e38\u65e5\u5fd7\u6536\u96c6\u8bb0\u5f55"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301 CAP \u5206\u5e03\u5f0f\u4e8b\u52a1\u5173\u8054"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u5185\u90e8\u5f02\u5e38\u5916\u90e8\u4f20\u64ad"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u8fd4\u56de\u7edf\u4e00\u7684\u5f02\u5e38\u683c\u5f0f\u6570\u636e")),Object(i.b)("h2",{id:"74-\u53cb\u597d\u5f02\u5e38\u5904\u7406\u4f7f\u7528\u793a\u4f8b"},"7.4 \u53cb\u597d\u5f02\u5e38\u5904\u7406\u4f7f\u7528\u793a\u4f8b"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u53cb\u597d\u5f02\u5e38\u5904\u7406\u65b9\u5f0f\u3002"),Object(i.b)("h3",{id:"741-\u6ce8\u518c\u53cb\u597d\u5f02\u5e38\u670d\u52a1"},"7.4.1 \u6ce8\u518c\u53cb\u597d\u5f02\u5e38\u670d\u52a1"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddControllers()\n .AddFriendlyException();\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},".AddFriendlyException()")," \u9700\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"services.AddControllers()")," \u4e4b\u540e\u6ce8\u518c\u3002"))),Object(i.b)("h3",{id:"742-\u4e24\u4e2a\u4f8b\u5b50"},"7.4.2 \u4e24\u4e2a\u4f8b\u5b50"),Object(i.b)("h4",{id:"\u7b80\u5355\u629b\u4e2a\u5f02\u5e38"},"\u7b80\u5355\u629b\u4e2a\u5f02\u5e38"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,12}","{2,12}":!0}),'using Fur.DynamicApiController;\nusing Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh($"{id} \u4e0d\u80fd\u5c0f\u4e8e3");\n }\n\n return id;\n }\n }\n}\n')),Object(i.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(c.a)("img/yhyc1.gif")}),Object(i.b)("h4",{id:"\u629b\u51fa\u7279\u5b9a\u7c7b\u578b\u5f02\u5e38"},"\u629b\u51fa\u7279\u5b9a\u7c7b\u578b\u5f02\u5e38"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,13}","{2,13}":!0}),'using Fur.DynamicApiController;\nusing Fur.FriendlyException;\nusing System;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh($"{id} \u4e0d\u80fd\u5c0f\u4e8e3\u3002", typeof(InvalidOperationException));\n }\n\n return id;\n }\n }\n}\n')),Object(i.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(c.a)("img/yhyc2.png")}),Object(i.b)("h2",{id:"75-\u5173\u4e8e-oopsoh"},"7.5 \u5173\u4e8e Oops.Oh"),Object(i.b)("p",null,"\u901a\u8fc7\u4e0a\u9762\u7684\u4f8b\u5b50\u53ef\u4ee5\u770b\u51fa\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"Oops.Oh(errorMessage)")," \u53ef\u4ee5\u7ed3\u5408 ",Object(i.b)("inlineCode",{parentName:"p"},"throw")," \u629b\u51fa\u5f02\u5e38\u3002\u5bf9\u4e8e\u719f\u6089",Object(i.b)("inlineCode",{parentName:"p"},"C#"),"\u7684\u4eba\u5458\u6765\u8bf4\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"throw")," \u540e\u9762\u53ea\u80fd ",Object(i.b)("inlineCode",{parentName:"p"},"Exception")," \u5b9e\u4f8b\u3002",Object(i.b)("inlineCode",{parentName:"p"},"Oops.Oh(...)")," \u65b9\u6cd5\u8fd4\u56de\u6b63\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"Exception")," \u5b9e\u4f8b\u3002"),Object(i.b)("h3",{id:"761-\u4e3a\u4ec0\u4e48\u8d77\u8fd9\u4e2a\u540d\u5b57\uff1f"},"7.6.1 \u4e3a\u4ec0\u4e48\u8d77\u8fd9\u4e2a\u540d\u5b57\uff1f"),Object(i.b)("p",null,"\u8fd9\u4e2a\u540d\u5b57\u6765\u6e90\u4e8e\u4e00\u4e2a\u82f1\u8bed\u53e5\u5b50\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"Oh, Oops!"),"\uff0c\u610f\u601d\u662f ",Object(i.b)("strong",{parentName:"p"},"\u5662\uff08\u54ce\uff09\uff0c\u51fa\u9519\u4e86\uff01"),"\uff0c\u6240\u4ee5\u5c31\u6709\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"Oops.Oh"),"\u3002"),Object(i.b)("h3",{id:"762-oopsoh-\u91cd\u8f7d\u65b9\u6cd5"},"7.6.2 ",Object(i.b)("inlineCode",{parentName:"h3"},"Oops.Oh")," \u91cd\u8f7d\u65b9\u6cd5"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{13,22,30,39}","{13,22,30,39}":!0}),'using System;\n\nnamespace Fur.FriendlyException\n{\n public static class Oops\n {\n /// \n /// \u629b\u51fa\u5b57\u7b26\u4e32\u5f02\u5e38\n /// \n /// \u5f02\u5e38\u6d88\u606f\n /// String.Format \u53c2\u6570\n /// \u5f02\u5e38\u5b9e\u4f8b\n public static Exception Oh(string errorMessage, params object[] args);\n\n /// \n /// \u629b\u51fa\u5b57\u7b26\u4e32\u5f02\u5e38\n /// \n /// \u5f02\u5e38\u6d88\u606f\n /// \u5177\u4f53\u5f02\u5e38\u7c7b\u578b\n /// String.Format \u53c2\u6570\n /// \u5f02\u5e38\u5b9e\u4f8b\n public static Exception Oh(string errorMessage, Type exceptionType, params object[] args);\n\n /// \n /// \u629b\u51fa\u9519\u8bef\u7801\u5f02\u5e38\n /// \n /// \u9519\u8bef\u7801\n /// String.Format \u53c2\u6570\n /// \u5f02\u5e38\u5b9e\u4f8b\n public static Exception Oh(object errorCode, params object[] args);\n\n /// \n /// \u629b\u51fa\u9519\u8bef\u7801\u5f02\u5e38\n /// \n /// \u9519\u8bef\u7801\n /// \u5177\u4f53\u5f02\u5e38\u7c7b\u578b\n /// String.Format \u53c2\u6570\n /// \u5f02\u5e38\u5b9e\u4f8b\n public static Exception Oh(object errorCode, Type exceptionType, params object[] args);\n }\n}\n')),Object(i.b)("h2",{id:"76-\u6700\u4f73\u5b9e\u8df5-"},"7.6 \u6700\u4f73\u5b9e\u8df5 \ud83e\udd17"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u4e14\u89c4\u8303\u5316\u7684\u53cb\u597d\u5f02\u5e38\u5904\u7406\u65b9\u5f0f\uff0c\u901a\u8fc7\u8fd9\u4e2a\u65b9\u5f0f\u53ef\u4ee5\u65b9\u4fbf\u7ba1\u7406\u5f02\u5e38\u72b6\u6001\u7801\u3001\u5f02\u5e38\u4fe1\u606f\u53ca\u5f02\u5e38\u672c\u5730\u5316\u3002"),Object(i.b)("h3",{id:"761-\u521b\u5efa\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b"},"7.6.1 \u521b\u5efa\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b"),Object(i.b)("p",null,"\u5b9e\u73b0\u81ea\u5b9a\u4e49\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b\u5fc5\u987b\u9075\u5faa\u4ee5\u4e0b\u914d\u7f6e\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u7c7b\u578b\u5fc5\u987b\u662f\u516c\u5f00\u4e14\u65f6 ",Object(i.b)("inlineCode",{parentName:"li"},"Enum")," \u679a\u4e3e\u7c7b\u578b"),Object(i.b)("li",{parentName:"ul"},"\u679a\u4e3e\u7c7b\u578b\u5fc5\u987b\u8d34\u6709 ",Object(i.b)("inlineCode",{parentName:"li"},"[ErrorCodeType]")," \u7279\u6027"),Object(i.b)("li",{parentName:"ul"},"\u679a\u4e3e\u4e2d\u6bcf\u4e00\u9879\u5fc5\u987b\u8d34\u6709 ",Object(i.b)("inlineCode",{parentName:"li"},"[ErrorCodeItemMetadata]")," \u7279\u6027")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,8,11,14,17}","{1,5,8,11,14,17}":!0}),'using Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n [ErrorCodeType]\n public enum ErrorCodes\n {\n [ErrorCodeItemMetadata("{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n z1000,\n\n [ErrorCodeItemMetadata("\u6570\u636e\u4e0d\u5b58\u5728")]\n x1000,\n\n [ErrorCodeItemMetadata("{0} \u53d1\u73b0 {1} \u4e2a\u5f02\u5e38", "\u767e\u5c0f\u50e7", 2)]\n x1001,\n\n [ErrorCodeItemMetadata("\u670d\u52a1\u5668\u8fd0\u884c\u5f02\u5e38", ErrorCode = "Error")]\n SERVER_ERROR\n }\n}\n')),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"important")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeType]")," \u7279\u6027\u548c ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u63d0\u4f9b\u5668\u63a5\u53e3\u6765\u63d0\u4f9b\u5f02\u5e38\u4fe1\u606f\u626b\u63cf\uff0c\u8fd9\u91cc\u7528\u7684\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeType]")," \u7279\u6027\u7c7b\u3002"))),Object(i.b)("h3",{id:"762-\u5173\u4e8e-errorcodeitemmetadata"},"7.6.2 \u5173\u4e8e ",Object(i.b)("inlineCode",{parentName:"h3"},"[ErrorCodeItemMetadata]")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86",Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeItemMetadata]")," \u7279\u6027\u7528\u6765\u6807\u8bc6",Object(i.b)("strong",{parentName:"p"},"\u679a\u4e3e\u5b57\u6bb5"),"\u5f02\u5e38\u5143\u6570\u636e\uff0c\u8be5\u7279\u6027\u652f\u6301\u4f20\u5165 ",Object(i.b)("inlineCode",{parentName:"p"},"\u6d88\u606f\u5185\u5bb9")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u53c2\u6570"),"\u3002\u6700\u7ec8\u4f1a\u4f7f\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"String.Format(\u6d88\u606f\u5185\u5bb9\uff0c\u683c\u5f0f\u5316\u53c2\u6570)")," \u8fdb\u884c\u683c\u5f0f\u5316\u3002"),Object(i.b)("p",null,"\u5982\u679c\u6d88\u606f\u5185\u5bb9\u4e2d\u5305\u542b",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u5360\u4f4d\u7b26"),"\u4f46\u672a\u6307\u5b9a",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u53c2\u6570"),"\uff0c\u90a3\u4e48\u4f1a\u67e5\u627e\u5f02\u5e38\u6240\u5728\u65b9\u6cd5\u662f\u5426\u8d34\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"[IfException]")," \u7279\u6027\u4e14\u542b\u6709\u683c\u5f0f\u5316\u53c2\u6570\uff0c\u63a5\u7740\u5c31\u4f1a\u67e5\u627e ",Object(i.b)("inlineCode",{parentName:"p"},"Oops.Oh")," \u4e2d\u6307\u5b9a\u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u53c2\u6570"),"\u3002"),Object(i.b)("h3",{id:"763-\u9759\u6001\u5f02\u5e38\u7c7b\u4f7f\u7528"},"7.6.3 \u9759\u6001\u5f02\u5e38\u7c7b\u4f7f\u7528"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,12}","{2,12}":!0}),"using Fur.DynamicApiController;\nusing Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh(ErrorCodes.z1000, id, 3);\n }\n\n return id;\n }\n }\n}\n")),Object(i.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(c.a)("img/yhyc3.gif")}),Object(i.b)("h3",{id:"764-\u66f4\u591a\u4f8b\u5b50"},"7.6.4 \u66f4\u591a\u4f8b\u5b50"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'throw Oops.Oh(1000);\nthrow Oops.Oh(ErrorCodes.x1000);\nthrow Oops.Oh("\u54c8\u54c8\u54c8\u54c8");\nthrow Oops.Oh(errorCode: "x1001");\nthrow Oops.Oh(1000, typeof(Exception));\n')),Object(i.b)("h2",{id:"77-\u591a\u4e2a\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b"},"7.7 \u591a\u4e2a\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5-6,21-22}","{5-6,21-22}":!0}),'using Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n [ErrorCodeType]\n public enum ErrorCodes\n {\n [ErrorCodeItemMetadata("{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n z1000,\n\n [ErrorCodeItemMetadata("\u6570\u636e\u4e0d\u5b58\u5728")]\n x1000,\n\n [ErrorCodeItemMetadata("{0} \u53d1\u73b0 {1} \u4e2a\u5f02\u5e38", "\u767e\u5c0f\u50e7", 2)]\n x1001,\n\n [ErrorCodeItemMetadata("\u670d\u52a1\u5668\u8fd0\u884c\u5f02\u5e38", ErrorCode = "Error")]\n SERVER_ERROR\n }\n\n [ErrorCodeType]\n public enum UserErrorCodes\n {\n [ErrorCodeItemMetadata("\u7528\u6237\u6570\u636e\u4e0d\u5b58\u5728")]\n u1000,\n\n [ErrorCodeItemMetadata("\u5176\u4ed6\u5f02\u5e38")]\n u1001\n }\n}\n')),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u591a\u4e2a\u5f02\u5e38\u9759\u6001\u7c7b\u4e2d\u4e5f\u5fc5\u987b\u4fdd\u8bc1\u5e38\u91cf\u503c\u552f\u4e00\u6027\uff0c\u4e0d\u53ef\u91cd\u590d\u3002"))),Object(i.b)("h2",{id:"78-ierrorcodetypeprovider-\u63d0\u4f9b\u5668"},"7.8 ",Object(i.b)("inlineCode",{parentName:"h2"},"IErrorCodeTypeProvider")," \u63d0\u4f9b\u5668"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u8fd8\u63d0\u4f9b\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u5f02\u5e38\u6d88\u606f\u63d0\u4f9b\u5668\u63a5\u53e3\uff0c\u65b9\u4fbf\u5728\u4e0d\u80fd\u8d34 ",Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeType]")," \u7279\u6027\u60c5\u51b5\u4e0b\u4f7f\u7528\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,6,8-11}","{2,6,8-11}":!0}),"using Fur.FriendlyException;\nusing System;\n\nnamespace Fur.Application\n{\n public class CustomErrorCodeTypeProvider : IErrorCodeTypeProvider\n {\n public Type[] Definitions => new[] {\n typeof(ErrorCodes),\n typeof(ErrorCodes2)\n };\n }\n}\n")),Object(i.b)("p",null,"\u542f\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u63d0\u4f9b\u5668\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddControllers()\n .AddFriendlyException();\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u53ea\u6709\u4f7f\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u65b9\u5f0f\u624d\u9700\u4f7f\u7528\u6cdb\u578b\u65b9\u5f0f\u6ce8\u518c\u3002\u901a\u8fc7\u4e0a\u9762\u7684\u65b9\u5f0f\u6ce8\u518c\u53ef\u4ee5\u540c\u65f6\u652f\u6301 ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeType]")," \u65b9\u5f0f\u3002"))),Object(i.b)("h2",{id:"79-appsettingjson-\u4e2d\u914d\u7f6e"},"7.9 ",Object(i.b)("inlineCode",{parentName:"h2"},"appsetting.json")," \u4e2d\u914d\u7f6e"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u8fd8\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u914d\u7f6e\u6587\u4ef6\u914d\u7f6e\u5f02\u5e38\uff0c\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u5b9e\u73b0\u5f02\u5e38\u4fe1\u606f\u540e\u671f\u914d\u7f6e\uff0c\u4e5f\u5c31\u662f\u65e0\u9700\u5728\u5f00\u53d1\u9636\u6bb5\u9884\u5148\u5b9a\u4e49\u3002"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-9} title="Fur.Web.Entry/appsettings.json"',"{2-9}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "ErrorCodeMessageSettings": {\n "Definitions": [\n [5000, "{0} \u4e0d\u80fd\u5c0f\u4e8e {1}"],\n [5001, "\u6211\u53eb {0} \u540d\u5b57", "\u767e\u5c0f\u50e7"],\n [5002, "Oops! \u51fa\u9519\u4e86"]\n ]\n }\n }\n}\n')),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Definitions")," \u7c7b\u578b\u4e3a\u4e8c\u7ef4\u6570\u7ec4\uff0c\u4e8c\u7ef4\u6570\u7ec4\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6570\u7ec4\u7b2c\u4e00\u4e2a\u53c2\u6570\u4e3a ",Object(i.b)("inlineCode",{parentName:"p"},"ErrorCode")," \u4e5f\u5c31\u662f\u9519\u8bef\u7801\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e3a ",Object(i.b)("inlineCode",{parentName:"p"},"ErrorMessage")," \u6d88\u606f\u5185\u5bb9\uff0c\u5269\u4f59\u53c2\u6570\u4f5c\u4e3a ",Object(i.b)("inlineCode",{parentName:"p"},"ErrorMessage")," \u7684\u683c\u5f0f\u5316\u53c2\u6570\u3002"),Object(i.b)("h4",{id:"\u4f7f\u7528\u793a\u4f8b"},"\u4f7f\u7528\u793a\u4f8b"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,12}","{2,12}":!0}),"using Fur.DynamicApiController;\nusing Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh(5000, id, 3); // \u53ef\u4ee5\u5c06 5000\u4f5c\u4e3a\u5e38\u91cf\u914d\u7f6e\u8d77\u6765\n }\n\n return id;\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeType]")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u53ef\u4ee5\u540c\u65f6\u4f7f\u7528\u3002"))),Object(i.b)("h2",{id:"710-ifexception-\u4f7f\u7528"},"7.10 ",Object(i.b)("inlineCode",{parentName:"h2"},"[IfException]")," \u4f7f\u7528"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"[IfException]")," \u7279\u6027\u53ef\u4ee5",Object(i.b)("strong",{parentName:"p"},"\u8986\u76d6\u9ed8\u8ba4\u6d88\u606f\u914d\u7f6e"),"\u3002\u4e5f\u5c31\u662f\u8986\u76d6 ",Object(i.b)("inlineCode",{parentName:"p"},"\u5f02\u5e38\u6d88\u606f\u7c7b\u578b")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u7684\u914d\u7f6e\u3002"),Object(i.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"[IfException]")," \u53ea\u80fd\u8d34\u5728\u65b9\u6cd5\u4e0a\uff0c\u652f\u6301\u591a\u4e2a\uff0c\u800c\u4e14\u8be5\u65b9\u6cd5\u6240\u5728\u7684\u7c7b\u7c7b\u578b\u5fc5\u987b\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"ControllerBase")," \u5b50\u7c7b \u6216 \u5b9e\u73b0 ",Object(i.b)("inlineCode",{parentName:"p"},"IDynamicApiController")," \u63a5\u53e3\u3002"))),Object(i.b)("h3",{id:"7101-\u4f7f\u7528\u793a\u4f8b"},"7.10.1 \u4f7f\u7528\u793a\u4f8b"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u5f02\u5e38\u6d88\u606f\u7c7b\u5b9a\u4e49")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,4}","{1,4}":!0}),'[ErrorCodeType]\npublic static class ErrorCodes\n{\n [ErrorCodeItemMetadata("{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n z1000\n}\n')),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u8986\u76d6\u9ed8\u8ba4\u914d\u7f6e")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{8}","{8}":!0}),'using Fur.DynamicApiController;\nusing Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [IfException(ErrorCodes.z1000, ErrorMessage = "\u6211\u8986\u76d6\u4e86\u9ed8\u8ba4\u7684\uff1a{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh(ErrorCodes.z1000, id, 3);\n }\n\n return id;\n }\n }\n}\n')),Object(i.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(c.a)("img/yhyc4.png")}),Object(i.b)("h3",{id:"7102-\u66f4\u591a\u4f8b\u5b50"},"7.10.2 \u66f4\u591a\u4f8b\u5b50"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8-11}","{2,8-11}":!0}),'using Fur.DynamicApiController;\nusing Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [IfException(ErrorCodes.z1000, ErrorMessage = "\u6211\u8986\u76d6\u4e86\u9ed8\u8ba4\u7684\uff1a{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n [IfException(ErrorCodes.x1001, "\u683c\u5f0f\u5316\u53c2\u65701", "\u683c\u5f0f\u5316\u53c2\u65702", ErrorMessage = "\u6211\u8986\u76d6\u4e86\u9ed8\u8ba4\u7684\uff1a{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n [IfException(ErrorCodes.x1000, "\u683c\u5f0f\u5316\u53c2\u65701", "\u683c\u5f0f\u5316\u53c2\u65702")]\n [IfException(ErrorCodes.SERVER_ERROR, "\u683c\u5f0f\u5316\u53c2\u65701", "\u683c\u5f0f\u5316\u53c2\u65702")]\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh(ErrorCodes.z1000, id, 3);\n }\n\n return id;\n }\n }\n}\n')),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u683c\u5f0f\u5316\u6d41\u7a0b")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u5982\u679c\u6d88\u606f\u5185\u5bb9\u4e2d\u5305\u542b",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u5360\u4f4d\u7b26"),"\u4f46\u672a\u6307\u5b9a",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u53c2\u6570"),"\uff0c\u90a3\u4e48\u4f1a\u67e5\u627e\u5f02\u5e38\u6240\u5728\u65b9\u6cd5\u662f\u5426\u8d34\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"[IfException]")," \u7279\u6027\u4e14\u542b\u6709\u683c\u5f0f\u5316\u53c2\u6570\uff0c\u63a5\u7740\u5c31\u4f1a\u67e5\u627e ",Object(i.b)("inlineCode",{parentName:"p"},"Oops.Oh")," \u4e2d\u6307\u5b9a\u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u53c2\u6570"),"\u3002"))),Object(i.b)("h2",{id:"711-\u5f02\u5e38\u6d88\u606f\u4f18\u5148\u7ea7"},"7.11 \u5f02\u5e38\u6d88\u606f\u4f18\u5148\u7ea7"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeItemMetadata]")," -> ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," -> ",Object(i.b)("inlineCode",{parentName:"p"},"[IfException]"),"\u3002",Object(i.b)("strong",{parentName:"p"},"\uff08\u4f4e -> \u9ad8\uff09")),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"[IfException]")," \u4f1a\u8986\u76d6 ",Object(i.b)("inlineCode",{parentName:"li"},"appsettings.json")," \u5b9a\u4e49\u7684\u72b6\u6001\u7801\u6d88\u606f\u3002"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"appsettings.json")," \u4f1a\u8986\u76d6 ",Object(i.b)("inlineCode",{parentName:"li"},"[ErrorCodeItemMetadata]")," \u5b9a\u4e49\u7684\u6d88\u606f\u3002")),Object(i.b)("h2",{id:"712-\u591a\u8bed\u8a00\u652f\u6301"},"7.12 \u591a\u8bed\u8a00\u652f\u6301"),Object(i.b)("p",null,"\u6587\u6863\u6574\u7406\u4e2d..."),Object(i.b)("h2",{id:"713-\u5f02\u5e38\u6a21\u578b\u63d0\u4f9b\u5668"},"7.13 \u5f02\u5e38\u6a21\u578b\u63d0\u4f9b\u5668"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b ",Object(i.b)("inlineCode",{parentName:"p"},"\u89c4\u8303\u5316\u7ed3\u679c")," \u529f\u80fd\uff0c\u53ef\u4ee5\u901a\u8fc7\u5b9e\u73b0 ",Object(i.b)("inlineCode",{parentName:"p"},"IUnifyResultProvider")," \u63d0\u4f9b\u5668\u5b9e\u73b0\u5f02\u5e38\u8fd4\u56de\u503c\u5b9a\u5236\uff0c\u5982\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"RESTfulResultProvider"),"\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'using Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.AspNetCore.Mvc.Filters;\nusing Microsoft.AspNetCore.Mvc.ModelBinding;\nusing System.Collections.Generic;\n\nnamespace Fur.UnifyResult\n{\n /// \n /// RESTful \u98ce\u683c\u8fd4\u56de\u503c\n /// \n public class RESTfulResultProvider : IUnifyResultProvider\n {\n /// \n /// \u5f02\u5e38\u8fd4\u56de\u503c\n /// \n /// \n /// \n public IActionResult OnException(ExceptionContext context)\n {\n return new JsonResult(new RESTfulResult\n {\n StatusCode = StatusCodes.Status500InternalServerError,\n Successed = false,\n Data = null,\n Errors = context.Exception.Message\n });\n }\n\n /// \n /// \u6210\u529f\u8fd4\u56de\u503c\n /// \n /// \n /// \n public IActionResult OnSuccessed(ActionExecutedContext context)\n {\n object data;\n // \u5904\u7406\u5185\u5bb9\u7ed3\u679c\n if (context.Result is ContentResult contentResult) data = contentResult.Content;\n // \u5904\u7406\u5bf9\u8c61\u7ed3\u679c\n else if (context.Result is ObjectResult objectResult) data = objectResult.Value;\n else return null;\n\n return new JsonResult(new RESTfulResult\n {\n StatusCode = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK,\n Successed = true,\n Data = data,\n Errors = null\n });\n }\n\n /// \n /// \u9a8c\u8bc1\u5931\u8d25\u8fd4\u56de\u503c\n /// \n /// \n /// \n /// \n /// \n /// \n public IActionResult OnValidateFailed(ActionExecutingContext context, ModelStateDictionary modelStates, Dictionary> validationResults, string validateFaildMessage)\n {\n return new JsonResult(new RESTfulResult\n {\n StatusCode = StatusCodes.Status400BadRequest,\n Successed = false,\n Data = null,\n Errors = validationResults\n });\n }\n }\n}\n')),Object(i.b)("p",null,"\u4e4b\u540e\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Startup.cs")," \u4e2d\u6ce8\u518c\u5373\u53ef\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"services.AddControllers().AddUnifyResult();\n")),Object(i.b)("h2",{id:"714-\u53cd\u9988\u4e0e\u5efa\u8bae"},"7.14 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/62953dcd.dc05b734.js b/docs/62953dcd.dc05b734.js deleted file mode 100644 index fa71bcbb095..00000000000 --- a/docs/62953dcd.dc05b734.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[35],{142:function(e,n,t){"use strict";t.d(n,"a",(function(){return s})),t.d(n,"b",(function(){return u}));var a=t(0),r=t.n(a);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var b=r.a.createContext({}),l=function(e){var n=r.a.useContext(b),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},s=function(e){var n=l(e.components);return r.a.createElement(b.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},m=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,b=p(e,["components","mdxType","originalType","parentName"]),s=l(t),m=a,u=s["".concat(c,".").concat(m)]||s[m]||d[m]||i;return t?r.a.createElement(u,o(o({ref:n},b),{},{components:t})):r.a.createElement(u,o({ref:n},b))}));function u(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,c=new Array(i);c[0]=m;var o={};for(var p in n)hasOwnProperty.call(n,p)&&(o[p]=n[p]);o.originalType=e,o.mdxType="string"==typeof e?e:a,c[1]=o;for(var b=2;bOops.Oh \u91cd\u8f7d\u65b9\u6cd5",id:"762-oopsoh-\u91cd\u8f7d\u65b9\u6cd5",children:[]}]},{value:"7.6 \u6700\u4f73\u5b9e\u8df5 \ud83e\udd17",id:"76-\u6700\u4f73\u5b9e\u8df5-",children:[{value:"7.6.1 \u521b\u5efa\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b",id:"761-\u521b\u5efa\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b",children:[]},{value:"7.6.2 \u5173\u4e8e [ErrorCodeItemMetadata]",id:"762-\u5173\u4e8e-errorcodeitemmetadata",children:[]},{value:"7.6.3 \u9759\u6001\u5f02\u5e38\u7c7b\u4f7f\u7528",id:"763-\u9759\u6001\u5f02\u5e38\u7c7b\u4f7f\u7528",children:[]},{value:"7.6.4 \u66f4\u591a\u4f8b\u5b50",id:"764-\u66f4\u591a\u4f8b\u5b50",children:[]}]},{value:"7.7 \u591a\u4e2a\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b",id:"77-\u591a\u4e2a\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b",children:[]},{value:"7.8 IErrorCodeTypeProvider \u63d0\u4f9b\u5668",id:"78-ierrorcodetypeprovider-\u63d0\u4f9b\u5668",children:[]},{value:"7.9 appsetting.json \u4e2d\u914d\u7f6e",id:"79-appsettingjson-\u4e2d\u914d\u7f6e",children:[]},{value:"7.10 [IfException] \u4f7f\u7528",id:"710-ifexception-\u4f7f\u7528",children:[{value:"7.10.1 \u4f7f\u7528\u793a\u4f8b",id:"7101-\u4f7f\u7528\u793a\u4f8b",children:[]},{value:"7.10.2 \u66f4\u591a\u4f8b\u5b50",id:"7102-\u66f4\u591a\u4f8b\u5b50",children:[]}]},{value:"7.11 \u5f02\u5e38\u6d88\u606f\u4f18\u5148\u7ea7",id:"711-\u5f02\u5e38\u6d88\u606f\u4f18\u5148\u7ea7",children:[]},{value:"7.12 \u591a\u8bed\u8a00\u652f\u6301",id:"712-\u591a\u8bed\u8a00\u652f\u6301",children:[]},{value:"7.13 \u5f02\u5e38\u6a21\u578b\u63d0\u4f9b\u5668",id:"713-\u5f02\u5e38\u6a21\u578b\u63d0\u4f9b\u5668",children:[]},{value:"7.14 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"714-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],l={rightToc:b};function s(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(i.b)("wrapper",Object(a.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"71-\u4ec0\u4e48\u662f\u5f02\u5e38"},"7.1 \u4ec0\u4e48\u662f\u5f02\u5e38"),Object(i.b)("p",null,"\u5f02\u5e38\u4e00\u822c\u662f\u6307\u8fd0\u884c\u671f\uff08\u6b64\u5904\u7279\u6307 ",Object(i.b)("inlineCode",{parentName:"p"},"Exception")," \u7c7b\uff09\u4f1a\u53d1\u751f\u7684\u5bfc\u81f4\u7a0b\u5e8f\u610f\u5916\u4e2d\u6b62\u7684\u95ee\u9898\uff0c\u662f\u4e00\u79cd\u5bf9\u95ee\u9898\u7684\u63cf\u8ff0\u540e\u7684\u5c01\u88c5\u5bf9\u8c61\u3002"),Object(i.b)("p",null,"\u5728\u8fc7\u53bb\u5f00\u53d1\u4e2d\uff0c\u901a\u5e38\u5f02\u5e38\u7531\u7cfb\u7edf\u8fd0\u884c\u65f6\u51fa\u9519\u629b\u51fa\uff0c\u4f46\u73b0\u5728\u7684\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u5e94\u5728\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u5408\u7406\u7684\u629b\u51fa\u5f02\u5e38\uff0c\u6bd4\u5982\u66f4\u65b0\u4e00\u6761\u4e0d\u5b58\u5728\u7684\u5b9e\u4f53\uff0c\u6216\u67e5\u8be2\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u6570\u636e\u7b49\u7b49\u3002"),Object(i.b)("h2",{id:"72-\u5904\u7406\u5f02\u5e38\u65b9\u5f0f"},"7.2 \u5904\u7406\u5f02\u5e38\u65b9\u5f0f"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u4e0d\u5904\u7406\uff0c\u76f4\u63a5\u4e2d\u65ad\u7a0b\u5e8f\u6267\u884c\uff08\u4e0d\u63a8\u8350\uff09"),Object(i.b)("li",{parentName:"ul"},"\u901a\u8fc7 ",Object(i.b)("inlineCode",{parentName:"li"},"try catch finally")," \u5904\u7406\uff08\u4e0d\u63a8\u8350\uff09"),Object(i.b)("li",{parentName:"ul"},"\u5168\u5c40\u7edf\u4e00\u5904\u7406\uff0c\u5e76\u8bb0\u5f55\u5f02\u5e38\u4fe1\u606f",Object(i.b)("strong",{parentName:"li"},"\uff08\u63a8\u8350\uff09")),Object(i.b)("li",{parentName:"ul"},"\u5f02\u5e38\u6ce8\u89e3\u65b9\u5f0f\u5904\u7406\uff0c\u652f\u6301",Object(i.b)("strong",{parentName:"li"},"\u672c\u5730\u5316")," ",Object(i.b)("strong",{parentName:"li"},"\uff08\u63a8\u8350\uff09"))),Object(i.b)("h2",{id:"73-\u4ec0\u4e48\u662f\u53cb\u597d\u5f02\u5e38\u5904\u7406"},"7.3 \u4ec0\u4e48\u662f\u53cb\u597d\u5f02\u5e38\u5904\u7406"),Object(i.b)("h3",{id:"731-\u975e\u53cb\u597d\u5f02\u5e38\u5904\u7406"},"7.3.1 \u975e\u53cb\u597d\u5f02\u5e38\u5904\u7406"),Object(i.b)("p",null,"\u5728\u4e86\u89e3\u53cb\u597d\u5f02\u5e38\u5904\u7406\u4e4b\u524d\u53ef\u4ee5\u770b\u770b\u975e\u53cb\u597d\u5f02\u5e38\u5904\u7406\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u5bf9\u7ec8\u7aef\u7528\u6237\u629b\u51fa ",Object(i.b)("inlineCode",{parentName:"li"},"500\u72b6\u6001\u7801")," \u5806\u6808\u4fe1\u606f"),Object(i.b)("li",{parentName:"ul"},"\u5927\u91cf\u7684 ",Object(i.b)("inlineCode",{parentName:"li"},"try catch")," \u4ee3\u7801\uff0c\u6c61\u67d3\u6b63\u5e38\u4e1a\u52a1\u903b\u8f91"),Object(i.b)("li",{parentName:"ul"},"\u6ca1\u6709\u89c4\u8303\u5316\u7684\u5f02\u5e38\u72b6\u6001\u7801\u548c\u5f02\u5e38\u6d88\u606f\u7ba1\u7406"),Object(i.b)("li",{parentName:"ul"},"\u6ca1\u6709\u5f02\u5e38\u65e5\u5fd7\u6536\u96c6\u8bb0\u5f55"),Object(i.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u5f02\u5e38\u6d88\u606f\u672c\u5730\u5316\u5904\u7406"),Object(i.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u5f02\u5e38\u7b56\u7565\uff0c\u5931\u8d25\u540e\u7a0b\u5e8f\u7acb\u5373\u7ec8\u6b62"),Object(i.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u5206\u5e03\u5f0f\u4e8b\u52a1 CAP"),Object(i.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u5f02\u5e38\u4f20\u64ad"),Object(i.b)("li",{parentName:"ul"},"\u8fd4\u56de\u7684\u5f02\u5e38\u683c\u5f0f\u6742\u4e71")),Object(i.b)("h3",{id:"732-\u53cb\u597d\u5f02\u5e38\u5904\u7406"},"7.3.2 \u53cb\u597d\u5f02\u5e38\u5904\u7406"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u5bf9\u7ec8\u7aef\u7528\u6237\u63d0\u793a\u53cb\u597d"),Object(i.b)("li",{parentName:"ul"},"\u5bf9\u540e\u7aef\u5f00\u53d1\u4eba\u5458\u63d0\u4f9b\u8be6\u7ec6\u7684\u5f02\u5e38\u5806\u6808"),Object(i.b)("li",{parentName:"ul"},"\u4e0d\u5e72\u6270\u6b63\u5e38\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801\uff0c\u5982 \u6ca1\u6709 ",Object(i.b)("inlineCode",{parentName:"li"},"try catch")," \u4ee3\u7801"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u5f02\u5e38\u72b6\u6001\u7801\u591a\u65b9\u8bbe\u7f6e"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u5f02\u5e38\u6d88\u606f\u672c\u5730\u5316"),Object(i.b)("li",{parentName:"ul"},"\u5f02\u5e38\u4fe1\u606f\u7edf\u4e00\u914d\u7f6e\u7ba1\u7406"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u5f02\u5e38\u7b56\u7565\uff0c\u5982\u91cd\u8bd5"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u5f02\u5e38\u65e5\u5fd7\u6536\u96c6\u8bb0\u5f55"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301 CAP \u5206\u5e03\u5f0f\u4e8b\u52a1\u5173\u8054"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u5185\u90e8\u5f02\u5e38\u5916\u90e8\u4f20\u64ad"),Object(i.b)("li",{parentName:"ul"},"\u652f\u6301\u8fd4\u56de\u7edf\u4e00\u7684\u5f02\u5e38\u683c\u5f0f\u6570\u636e")),Object(i.b)("h2",{id:"74-\u53cb\u597d\u5f02\u5e38\u5904\u7406\u4f7f\u7528\u793a\u4f8b"},"7.4 \u53cb\u597d\u5f02\u5e38\u5904\u7406\u4f7f\u7528\u793a\u4f8b"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u53cb\u597d\u5f02\u5e38\u5904\u7406\u65b9\u5f0f\u3002"),Object(i.b)("h3",{id:"741-\u6ce8\u518c\u53cb\u597d\u5f02\u5e38\u670d\u52a1"},"7.4.1 \u6ce8\u518c\u53cb\u597d\u5f02\u5e38\u670d\u52a1"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddControllers()\n .AddFriendlyException();\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},".AddFriendlyException()")," \u9700\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"services.AddControllers()")," \u4e4b\u540e\u6ce8\u518c\u3002"))),Object(i.b)("h3",{id:"742-\u4e24\u4e2a\u4f8b\u5b50"},"7.4.2 \u4e24\u4e2a\u4f8b\u5b50"),Object(i.b)("h4",{id:"\u7b80\u5355\u629b\u4e2a\u5f02\u5e38"},"\u7b80\u5355\u629b\u4e2a\u5f02\u5e38"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,12}","{2,12}":!0}),'using Fur.DynamicApiController;\nusing Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh($"{id} \u4e0d\u80fd\u5c0f\u4e8e3");\n }\n\n return id;\n }\n }\n}\n')),Object(i.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(c.a)("img/yhyc1.gif")}),Object(i.b)("h4",{id:"\u629b\u51fa\u7279\u5b9a\u7c7b\u578b\u5f02\u5e38"},"\u629b\u51fa\u7279\u5b9a\u7c7b\u578b\u5f02\u5e38"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,13}","{2,13}":!0}),'using Fur.DynamicApiController;\nusing Fur.FriendlyException;\nusing System;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh($"{id} \u4e0d\u80fd\u5c0f\u4e8e3\u3002", typeof(InvalidOperationException));\n }\n\n return id;\n }\n }\n}\n')),Object(i.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(c.a)("img/yhyc2.png")}),Object(i.b)("h2",{id:"75-\u5173\u4e8e-oopsoh"},"7.5 \u5173\u4e8e Oops.Oh"),Object(i.b)("p",null,"\u901a\u8fc7\u4e0a\u9762\u7684\u4f8b\u5b50\u53ef\u4ee5\u770b\u51fa\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"Oops.Oh(errorMessage)")," \u53ef\u4ee5\u7ed3\u5408 ",Object(i.b)("inlineCode",{parentName:"p"},"throw")," \u629b\u51fa\u5f02\u5e38\u3002\u5bf9\u4e8e\u719f\u6089",Object(i.b)("inlineCode",{parentName:"p"},"C#"),"\u7684\u4eba\u5458\u6765\u8bf4\uff0c",Object(i.b)("inlineCode",{parentName:"p"},"throw")," \u540e\u9762\u53ea\u80fd ",Object(i.b)("inlineCode",{parentName:"p"},"Exception")," \u5b9e\u4f8b\u3002",Object(i.b)("inlineCode",{parentName:"p"},"Oops.Oh(...)")," \u65b9\u6cd5\u8fd4\u56de\u6b63\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"Exception")," \u5b9e\u4f8b\u3002"),Object(i.b)("h3",{id:"761-\u4e3a\u4ec0\u4e48\u8d77\u8fd9\u4e2a\u540d\u5b57\uff1f"},"7.6.1 \u4e3a\u4ec0\u4e48\u8d77\u8fd9\u4e2a\u540d\u5b57\uff1f"),Object(i.b)("p",null,"\u8fd9\u4e2a\u540d\u5b57\u6765\u6e90\u4e8e\u4e00\u4e2a\u82f1\u8bed\u53e5\u5b50\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"Oh, Oops!"),"\uff0c\u610f\u601d\u662f ",Object(i.b)("strong",{parentName:"p"},"\u5662\uff08\u54ce\uff09\uff0c\u51fa\u9519\u4e86\uff01"),"\uff0c\u6240\u4ee5\u5c31\u6709\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"Oops.Oh"),"\u3002"),Object(i.b)("h3",{id:"762-oopsoh-\u91cd\u8f7d\u65b9\u6cd5"},"7.6.2 ",Object(i.b)("inlineCode",{parentName:"h3"},"Oops.Oh")," \u91cd\u8f7d\u65b9\u6cd5"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{13,22,30,39}","{13,22,30,39}":!0}),'using System;\n\nnamespace Fur.FriendlyException\n{\n public static class Oops\n {\n /// \n /// \u629b\u51fa\u5b57\u7b26\u4e32\u5f02\u5e38\n /// \n /// \u5f02\u5e38\u6d88\u606f\n /// String.Format \u53c2\u6570\n /// \u5f02\u5e38\u5b9e\u4f8b\n public static Exception Oh(string errorMessage, params object[] args);\n\n /// \n /// \u629b\u51fa\u5b57\u7b26\u4e32\u5f02\u5e38\n /// \n /// \u5f02\u5e38\u6d88\u606f\n /// \u5177\u4f53\u5f02\u5e38\u7c7b\u578b\n /// String.Format \u53c2\u6570\n /// \u5f02\u5e38\u5b9e\u4f8b\n public static Exception Oh(string errorMessage, Type exceptionType, params object[] args);\n\n /// \n /// \u629b\u51fa\u9519\u8bef\u7801\u5f02\u5e38\n /// \n /// \u9519\u8bef\u7801\n /// String.Format \u53c2\u6570\n /// \u5f02\u5e38\u5b9e\u4f8b\n public static Exception Oh(object errorCode, params object[] args);\n\n /// \n /// \u629b\u51fa\u9519\u8bef\u7801\u5f02\u5e38\n /// \n /// \u9519\u8bef\u7801\n /// \u5177\u4f53\u5f02\u5e38\u7c7b\u578b\n /// String.Format \u53c2\u6570\n /// \u5f02\u5e38\u5b9e\u4f8b\n public static Exception Oh(object errorCode, Type exceptionType, params object[] args);\n }\n}\n')),Object(i.b)("h2",{id:"76-\u6700\u4f73\u5b9e\u8df5-"},"7.6 \u6700\u4f73\u5b9e\u8df5 \ud83e\udd17"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u4e14\u89c4\u8303\u5316\u7684\u53cb\u597d\u5f02\u5e38\u5904\u7406\u65b9\u5f0f\uff0c\u901a\u8fc7\u8fd9\u4e2a\u65b9\u5f0f\u53ef\u4ee5\u65b9\u4fbf\u7ba1\u7406\u5f02\u5e38\u72b6\u6001\u7801\u3001\u5f02\u5e38\u4fe1\u606f\u53ca\u5f02\u5e38\u672c\u5730\u5316\u3002"),Object(i.b)("h3",{id:"761-\u521b\u5efa\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b"},"7.6.1 \u521b\u5efa\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b"),Object(i.b)("p",null,"\u5b9e\u73b0\u81ea\u5b9a\u4e49\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b\u5fc5\u987b\u9075\u5faa\u4ee5\u4e0b\u914d\u7f6e\uff1a"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u7c7b\u578b\u5fc5\u987b\u662f\u516c\u5f00\u4e14\u65f6 ",Object(i.b)("inlineCode",{parentName:"li"},"Enum")," \u679a\u4e3e\u7c7b\u578b"),Object(i.b)("li",{parentName:"ul"},"\u679a\u4e3e\u7c7b\u578b\u5fc5\u987b\u8d34\u6709 ",Object(i.b)("inlineCode",{parentName:"li"},"[ErrorCodeType]")," \u7279\u6027"),Object(i.b)("li",{parentName:"ul"},"\u679a\u4e3e\u4e2d\u6bcf\u4e00\u9879\u5fc5\u987b\u8d34\u6709 ",Object(i.b)("inlineCode",{parentName:"li"},"[ErrorCodeItemMetadata]")," \u7279\u6027")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,8,11,14,17}","{1,5,8,11,14,17}":!0}),'using Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n [ErrorCodeType]\n public enum ErrorCodes\n {\n [ErrorCodeItemMetadata("{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n z1000,\n\n [ErrorCodeItemMetadata("\u6570\u636e\u4e0d\u5b58\u5728")]\n x1000,\n\n [ErrorCodeItemMetadata("{0} \u53d1\u73b0 {1} \u4e2a\u5f02\u5e38", "\u767e\u5c0f\u50e7", 2)]\n x1001,\n\n [ErrorCodeItemMetadata("\u670d\u52a1\u5668\u8fd0\u884c\u5f02\u5e38", ErrorCode = "Error")]\n SERVER_ERROR\n }\n}\n')),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"important")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeType]")," \u7279\u6027\u548c ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u63d0\u4f9b\u5668\u63a5\u53e3\u6765\u63d0\u4f9b\u5f02\u5e38\u4fe1\u606f\u626b\u63cf\uff0c\u8fd9\u91cc\u7528\u7684\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeType]")," \u7279\u6027\u7c7b\u3002"))),Object(i.b)("h3",{id:"762-\u5173\u4e8e-errorcodeitemmetadata"},"7.6.2 \u5173\u4e8e ",Object(i.b)("inlineCode",{parentName:"h3"},"[ErrorCodeItemMetadata]")),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86",Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeItemMetadata]")," \u7279\u6027\u7528\u6765\u6807\u8bc6",Object(i.b)("strong",{parentName:"p"},"\u679a\u4e3e\u5b57\u6bb5"),"\u5f02\u5e38\u5143\u6570\u636e\uff0c\u8be5\u7279\u6027\u652f\u6301\u4f20\u5165 ",Object(i.b)("inlineCode",{parentName:"p"},"\u6d88\u606f\u5185\u5bb9")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u53c2\u6570"),"\u3002\u6700\u7ec8\u4f1a\u4f7f\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"String.Format(\u6d88\u606f\u5185\u5bb9\uff0c\u683c\u5f0f\u5316\u53c2\u6570)")," \u8fdb\u884c\u683c\u5f0f\u5316\u3002"),Object(i.b)("p",null,"\u5982\u679c\u6d88\u606f\u5185\u5bb9\u4e2d\u5305\u542b",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u5360\u4f4d\u7b26"),"\u4f46\u672a\u6307\u5b9a",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u53c2\u6570"),"\uff0c\u90a3\u4e48\u4f1a\u67e5\u627e\u5f02\u5e38\u6240\u5728\u65b9\u6cd5\u662f\u5426\u8d34\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"[IfException]")," \u7279\u6027\u4e14\u542b\u6709\u683c\u5f0f\u5316\u53c2\u6570\uff0c\u63a5\u7740\u5c31\u4f1a\u67e5\u627e ",Object(i.b)("inlineCode",{parentName:"p"},"Oops.Oh")," \u4e2d\u6307\u5b9a\u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u53c2\u6570"),"\u3002"),Object(i.b)("h3",{id:"763-\u9759\u6001\u5f02\u5e38\u7c7b\u4f7f\u7528"},"7.6.3 \u9759\u6001\u5f02\u5e38\u7c7b\u4f7f\u7528"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,12}","{2,12}":!0}),"using Fur.DynamicApiController;\nusing Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh(ErrorCodes.z1000, id, 3);\n }\n\n return id;\n }\n }\n}\n")),Object(i.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(c.a)("img/yhyc3.gif")}),Object(i.b)("h3",{id:"764-\u66f4\u591a\u4f8b\u5b50"},"7.6.4 \u66f4\u591a\u4f8b\u5b50"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'throw Oops.Oh(1000);\nthrow Oops.Oh(ErrorCodes.x1000);\nthrow Oops.Oh("\u54c8\u54c8\u54c8\u54c8");\nthrow Oops.Oh(errorCode: "x1001");\nthrow Oops.Oh(1000, typeof(Exception));\n')),Object(i.b)("h2",{id:"77-\u591a\u4e2a\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b"},"7.7 \u591a\u4e2a\u5f02\u5e38\u4fe1\u606f\u7c7b\u578b"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5-6,21-22}","{5-6,21-22}":!0}),'using Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n [ErrorCodeType]\n public enum ErrorCodes\n {\n [ErrorCodeItemMetadata("{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n z1000,\n\n [ErrorCodeItemMetadata("\u6570\u636e\u4e0d\u5b58\u5728")]\n x1000,\n\n [ErrorCodeItemMetadata("{0} \u53d1\u73b0 {1} \u4e2a\u5f02\u5e38", "\u767e\u5c0f\u50e7", 2)]\n x1001,\n\n [ErrorCodeItemMetadata("\u670d\u52a1\u5668\u8fd0\u884c\u5f02\u5e38", ErrorCode = "Error")]\n SERVER_ERROR\n }\n\n [ErrorCodeType]\n public enum UserErrorCodes\n {\n [ErrorCodeItemMetadata("\u7528\u6237\u6570\u636e\u4e0d\u5b58\u5728")]\n u1000,\n\n [ErrorCodeItemMetadata("\u5176\u4ed6\u5f02\u5e38")]\n u1001\n }\n}\n')),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u591a\u4e2a\u5f02\u5e38\u9759\u6001\u7c7b\u4e2d\u4e5f\u5fc5\u987b\u4fdd\u8bc1\u5e38\u91cf\u503c\u552f\u4e00\u6027\uff0c\u4e0d\u53ef\u91cd\u590d\u3002"))),Object(i.b)("h2",{id:"78-ierrorcodetypeprovider-\u63d0\u4f9b\u5668"},"7.8 ",Object(i.b)("inlineCode",{parentName:"h2"},"IErrorCodeTypeProvider")," \u63d0\u4f9b\u5668"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u8fd8\u63d0\u4f9b\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u5f02\u5e38\u6d88\u606f\u63d0\u4f9b\u5668\u63a5\u53e3\uff0c\u65b9\u4fbf\u5728\u4e0d\u80fd\u8d34 ",Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeType]")," \u7279\u6027\u60c5\u51b5\u4e0b\u4f7f\u7528\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,6,8-11}","{2,6,8-11}":!0}),"using Fur.FriendlyException;\nusing System;\n\nnamespace Fur.Application\n{\n public class CustomErrorCodeTypeProvider : IErrorCodeTypeProvider\n {\n public Type[] Definitions => new[] {\n typeof(ErrorCodes),\n typeof(ErrorCodes2)\n };\n }\n}\n")),Object(i.b)("p",null,"\u542f\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u63d0\u4f9b\u5668\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddControllers()\n .AddFriendlyException();\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u53ea\u6709\u4f7f\u7528 ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u65b9\u5f0f\u624d\u9700\u4f7f\u7528\u6cdb\u578b\u65b9\u5f0f\u6ce8\u518c\u3002\u901a\u8fc7\u4e0a\u9762\u7684\u65b9\u5f0f\u6ce8\u518c\u53ef\u4ee5\u540c\u65f6\u652f\u6301 ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeType]")," \u65b9\u5f0f\u3002"))),Object(i.b)("h2",{id:"79-appsettingjson-\u4e2d\u914d\u7f6e"},"7.9 ",Object(i.b)("inlineCode",{parentName:"h2"},"appsetting.json")," \u4e2d\u914d\u7f6e"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u8fd8\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u914d\u7f6e\u6587\u4ef6\u914d\u7f6e\u5f02\u5e38\uff0c\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u5b9e\u73b0\u5f02\u5e38\u4fe1\u606f\u540e\u671f\u914d\u7f6e\uff0c\u4e5f\u5c31\u662f\u65e0\u9700\u5728\u5f00\u53d1\u9636\u6bb5\u9884\u5148\u5b9a\u4e49\u3002"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-9} title="Fur.Web.Entry/appsettings.json"',"{2-9}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "ErrorCodeMessageSettings": {\n "Definitions": [\n [5000, "{0} \u4e0d\u80fd\u5c0f\u4e8e {1}"],\n [5001, "\u6211\u53eb {0} \u540d\u5b57", "\u767e\u5c0f\u50e7"],\n [5002, "Oops! \u51fa\u9519\u4e86"]\n ]\n }\n }\n}\n')),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Definitions")," \u7c7b\u578b\u4e3a\u4e8c\u7ef4\u6570\u7ec4\uff0c\u4e8c\u7ef4\u6570\u7ec4\u4e2d\u7684\u6bcf\u4e00\u4e2a\u6570\u7ec4\u7b2c\u4e00\u4e2a\u53c2\u6570\u4e3a ",Object(i.b)("inlineCode",{parentName:"p"},"ErrorCode")," \u4e5f\u5c31\u662f\u9519\u8bef\u7801\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e3a ",Object(i.b)("inlineCode",{parentName:"p"},"ErrorMessage")," \u6d88\u606f\u5185\u5bb9\uff0c\u5269\u4f59\u53c2\u6570\u4f5c\u4e3a ",Object(i.b)("inlineCode",{parentName:"p"},"ErrorMessage")," \u7684\u683c\u5f0f\u5316\u53c2\u6570\u3002"),Object(i.b)("h4",{id:"\u4f7f\u7528\u793a\u4f8b"},"\u4f7f\u7528\u793a\u4f8b"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,12}","{2,12}":!0}),"using Fur.DynamicApiController;\nusing Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh(5000, id, 3); // \u53ef\u4ee5\u5c06 5000\u4f5c\u4e3a\u5e38\u91cf\u914d\u7f6e\u8d77\u6765\n }\n\n return id;\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeType]")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"IErrorCodeTypeProvider")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u53ef\u4ee5\u540c\u65f6\u4f7f\u7528\u3002"))),Object(i.b)("h2",{id:"710-ifexception-\u4f7f\u7528"},"7.10 ",Object(i.b)("inlineCode",{parentName:"h2"},"[IfException]")," \u4f7f\u7528"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"[IfException]")," \u7279\u6027\u53ef\u4ee5",Object(i.b)("strong",{parentName:"p"},"\u8986\u76d6\u9ed8\u8ba4\u6d88\u606f\u914d\u7f6e"),"\u3002\u4e5f\u5c31\u662f\u8986\u76d6 ",Object(i.b)("inlineCode",{parentName:"p"},"\u5f02\u5e38\u6d88\u606f\u7c7b\u578b")," \u548c ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u7684\u914d\u7f6e\u3002"),Object(i.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"[IfException]")," \u53ea\u80fd\u8d34\u5728\u65b9\u6cd5\u4e0a\uff0c\u652f\u6301\u591a\u4e2a\uff0c\u800c\u4e14\u8be5\u65b9\u6cd5\u6240\u5728\u7684\u7c7b\u7c7b\u578b\u5fc5\u987b\u662f ",Object(i.b)("inlineCode",{parentName:"p"},"ControllerBase")," \u5b50\u7c7b \u6216 \u5b9e\u73b0 ",Object(i.b)("inlineCode",{parentName:"p"},"IDynamicApiController")," \u63a5\u53e3\u3002"))),Object(i.b)("h3",{id:"7101-\u4f7f\u7528\u793a\u4f8b"},"7.10.1 \u4f7f\u7528\u793a\u4f8b"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u5f02\u5e38\u6d88\u606f\u7c7b\u5b9a\u4e49")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,4}","{1,4}":!0}),'[ErrorCodeType]\npublic static class ErrorCodes\n{\n [ErrorCodeItemMetadata("{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n z1000\n}\n')),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u8986\u76d6\u9ed8\u8ba4\u914d\u7f6e")),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{8}","{8}":!0}),'using Fur.DynamicApiController;\nusing Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [IfException(ErrorCodes.z1000, ErrorMessage = "\u6211\u8986\u76d6\u4e86\u9ed8\u8ba4\u7684\uff1a{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh(ErrorCodes.z1000, id, 3);\n }\n\n return id;\n }\n }\n}\n')),Object(i.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(c.a)("img/yhyc4.png")}),Object(i.b)("h3",{id:"7102-\u66f4\u591a\u4f8b\u5b50"},"7.10.2 \u66f4\u591a\u4f8b\u5b50"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8-11}","{2,8-11}":!0}),'using Fur.DynamicApiController;\nusing Fur.FriendlyException;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [IfException(ErrorCodes.z1000, ErrorMessage = "\u6211\u8986\u76d6\u4e86\u9ed8\u8ba4\u7684\uff1a{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n [IfException(ErrorCodes.x1001, "\u683c\u5f0f\u5316\u53c2\u65701", "\u683c\u5f0f\u5316\u53c2\u65702", ErrorMessage = "\u6211\u8986\u76d6\u4e86\u9ed8\u8ba4\u7684\uff1a{0} \u4e0d\u80fd\u5c0f\u4e8e {1}")]\n [IfException(ErrorCodes.x1000, "\u683c\u5f0f\u5316\u53c2\u65701", "\u683c\u5f0f\u5316\u53c2\u65702")]\n [IfException(ErrorCodes.SERVER_ERROR, "\u683c\u5f0f\u5316\u53c2\u65701", "\u683c\u5f0f\u5316\u53c2\u65702")]\n public int Get(int id)\n {\n if (id < 3)\n {\n throw Oops.Oh(ErrorCodes.z1000, id, 3);\n }\n\n return id;\n }\n }\n}\n')),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u683c\u5f0f\u5316\u6d41\u7a0b")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u5982\u679c\u6d88\u606f\u5185\u5bb9\u4e2d\u5305\u542b",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u5360\u4f4d\u7b26"),"\u4f46\u672a\u6307\u5b9a",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u53c2\u6570"),"\uff0c\u90a3\u4e48\u4f1a\u67e5\u627e\u5f02\u5e38\u6240\u5728\u65b9\u6cd5\u662f\u5426\u8d34\u6709 ",Object(i.b)("inlineCode",{parentName:"p"},"[IfException]")," \u7279\u6027\u4e14\u542b\u6709\u683c\u5f0f\u5316\u53c2\u6570\uff0c\u63a5\u7740\u5c31\u4f1a\u67e5\u627e ",Object(i.b)("inlineCode",{parentName:"p"},"Oops.Oh")," \u4e2d\u6307\u5b9a\u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"\u683c\u5f0f\u5316\u53c2\u6570"),"\u3002"))),Object(i.b)("h2",{id:"711-\u5f02\u5e38\u6d88\u606f\u4f18\u5148\u7ea7"},"7.11 \u5f02\u5e38\u6d88\u606f\u4f18\u5148\u7ea7"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"[ErrorCodeItemMetadata]")," -> ",Object(i.b)("inlineCode",{parentName:"p"},"appsettings.json")," -> ",Object(i.b)("inlineCode",{parentName:"p"},"[IfException]"),"\u3002",Object(i.b)("strong",{parentName:"p"},"\uff08\u4f4e -> \u9ad8\uff09")),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"[IfException]")," \u4f1a\u8986\u76d6 ",Object(i.b)("inlineCode",{parentName:"li"},"appsettings.json")," \u5b9a\u4e49\u7684\u72b6\u6001\u7801\u6d88\u606f\u3002"),Object(i.b)("li",{parentName:"ul"},Object(i.b)("inlineCode",{parentName:"li"},"appsettings.json")," \u4f1a\u8986\u76d6 ",Object(i.b)("inlineCode",{parentName:"li"},"[ErrorCodeItemMetadata]")," \u5b9a\u4e49\u7684\u6d88\u606f\u3002")),Object(i.b)("h2",{id:"712-\u591a\u8bed\u8a00\u652f\u6301"},"7.12 \u591a\u8bed\u8a00\u652f\u6301"),Object(i.b)("p",null,"\u6587\u6863\u6574\u7406\u4e2d..."),Object(i.b)("h2",{id:"713-\u5f02\u5e38\u6a21\u578b\u63d0\u4f9b\u5668"},"7.13 \u5f02\u5e38\u6a21\u578b\u63d0\u4f9b\u5668"),Object(i.b)("p",null,Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b ",Object(i.b)("inlineCode",{parentName:"p"},"\u89c4\u8303\u5316\u7ed3\u679c")," \u529f\u80fd\uff0c\u53ef\u4ee5\u901a\u8fc7\u5b9e\u73b0 ",Object(i.b)("inlineCode",{parentName:"p"},"IUnifyResultProvider")," \u63d0\u4f9b\u5668\u5b9e\u73b0\u5f02\u5e38\u8fd4\u56de\u503c\u5b9a\u5236\uff0c\u5982\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"RESTfulResultProvider"),"\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'using Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.AspNetCore.Mvc.Filters;\nusing Microsoft.AspNetCore.Mvc.ModelBinding;\nusing System.Collections.Generic;\n\nnamespace Fur.UnifyResult\n{\n /// \n /// RESTful \u98ce\u683c\u8fd4\u56de\u503c\n /// \n public class RESTfulResultProvider : IUnifyResultProvider\n {\n /// \n /// \u5f02\u5e38\u8fd4\u56de\u503c\n /// \n /// \n /// \n public IActionResult OnException(ExceptionContext context)\n {\n return new JsonResult(new RESTfulResult\n {\n StatusCode = StatusCodes.Status500InternalServerError,\n Successed = false,\n Data = null,\n Errors = context.Exception.Message\n });\n }\n\n /// \n /// \u6210\u529f\u8fd4\u56de\u503c\n /// \n /// \n /// \n public IActionResult OnSuccessed(ActionExecutedContext context)\n {\n object data;\n // \u5904\u7406\u5185\u5bb9\u7ed3\u679c\n if (context.Result is ContentResult contentResult) data = contentResult.Content;\n // \u5904\u7406\u5bf9\u8c61\u7ed3\u679c\n else if (context.Result is ObjectResult objectResult) data = objectResult.Value;\n else return null;\n\n return new JsonResult(new RESTfulResult\n {\n StatusCode = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK,\n Successed = true,\n Data = data,\n Errors = null\n });\n }\n\n /// \n /// \u9a8c\u8bc1\u5931\u8d25\u8fd4\u56de\u503c\n /// \n /// \n /// \n /// \n /// \n /// \n public IActionResult OnValidateFailed(ActionExecutingContext context, ModelStateDictionary modelStates, Dictionary> validationResults, string validateFaildMessage)\n {\n return new JsonResult(new RESTfulResult\n {\n StatusCode = StatusCodes.Status400BadRequest,\n Successed = false,\n Data = null,\n Errors = validationResults\n });\n }\n }\n}\n')),Object(i.b)("p",null,"\u4e4b\u540e\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Startup.cs")," \u4e2d\u6ce8\u518c\u5373\u53ef\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"services.AddControllers().AddUnifyResult();\n")),Object(i.b)("h2",{id:"714-\u53cd\u9988\u4e0e\u5efa\u8bae"},"7.14 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(i.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(i.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(i.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/docs/654ac364.b869a9ae.js b/docs/654ac364.809adb42.js similarity index 98% rename from docs/654ac364.b869a9ae.js rename to docs/654ac364.809adb42.js index cd43a6db55b..c28de758de7 100644 --- a/docs/654ac364.b869a9ae.js +++ b/docs/654ac364.809adb42.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[36],{142:function(e,r,t){"use strict";t.d(r,"a",(function(){return l})),t.d(r,"b",(function(){return m}));var n=t(0),o=t.n(n);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function c(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=o.a.createContext({}),s=function(e){var r=o.a.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},l=function(e){var r=s(e.components);return o.a.createElement(p.Provider,{value:r},e.children)},f={inlineCode:"code",wrapper:function(e){var r=e.children;return o.a.createElement(o.a.Fragment,{},r)}},d=o.a.forwardRef((function(e,r){var t=e.components,n=e.mdxType,a=e.originalType,c=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),l=s(t),d=n,m=l["".concat(c,".").concat(d)]||l[d]||f[d]||a;return t?o.a.createElement(m,i(i({ref:r},p),{},{components:t})):o.a.createElement(m,i({ref:r},p))}));function m(e,r){var t=arguments,n=r&&r.mdxType;if("string"==typeof e||n){var a=t.length,c=new Array(a);c[0]=d;var i={};for(var u in r)hasOwnProperty.call(r,u)&&(i[u]=r[u]);i.originalType=e,i.mdxType="string"==typeof e?e:n,c[1]=i;for(var p=2;p=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=o.a.createContext({}),s=function(e){var r=o.a.useContext(p),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},l=function(e){var r=s(e.components);return o.a.createElement(p.Provider,{value:r},e.children)},f={inlineCode:"code",wrapper:function(e){var r=e.children;return o.a.createElement(o.a.Fragment,{},r)}},d=o.a.forwardRef((function(e,r){var t=e.components,n=e.mdxType,a=e.originalType,c=e.parentName,p=u(e,["components","mdxType","originalType","parentName"]),l=s(t),d=n,m=l["".concat(c,".").concat(d)]||l[d]||f[d]||a;return t?o.a.createElement(m,i(i({ref:r},p),{},{components:t})):o.a.createElement(m,i({ref:r},p))}));function m(e,r){var t=arguments,n=r&&r.mdxType;if("string"==typeof e||n){var a=t.length,c=new Array(a);c[0]=d;var i={};for(var u in r)hasOwnProperty.call(r,u)&&(i[u]=r[u]);i.originalType=e,i.mdxType="string"==typeof e?e:n,c[1]=i;for(var p=2;p0||f)&&n.a.createElement("footer",{className:"row margin-vert--lg"},k.length>0&&n.a.createElement("div",{className:"col"},n.a.createElement("strong",null,"Tags:"),k.map((function(e){var a=e.label,t=e.permalink;return n.a.createElement(o.a,{key:t,className:"margin-horiz--sm",to:t},a)}))),f&&n.a.createElement("div",{className:"col text--right"},n.a.createElement(o.a,{to:p.permalink,"aria-label":"Read more about "+M},n.a.createElement("strong",null,"Read More"))))))}},93:function(e,a,t){"use strict";t.r(a);var r=t(0),n=t.n(r),l=t(153),m=t(156),c=t(151);a.default=function(e){var a=e.metadata,t=e.items,r=a.allTagsPath,o=a.name,s=a.count;return n.a.createElement(l.a,{title:'Posts tagged "'+o+'"',description:'Blog | Tagged "'+o+'"'},n.a.createElement("div",{className:"container margin-vert--lg"},n.a.createElement("div",{className:"row"},n.a.createElement("main",{className:"col col--8 col--offset-2"},n.a.createElement("h1",null,s," ",function(e,a){return e>1?a+"s":a}(s,"post"),' tagged with "',o,'"'),n.a.createElement(c.a,{href:r},"View All Tags"),n.a.createElement("div",{className:"margin-vert--xl"},t.map((function(e){var a=e.content;return n.a.createElement(m.a,{key:a.metadata.permalink,frontMatter:a.frontMatter,metadata:a.metadata,truncated:!0},n.a.createElement(a,null))})))))))}}}]); \ No newline at end of file diff --git a/docs/6875c492.a75dca0e.js b/docs/6875c492.a75dca0e.js new file mode 100644 index 00000000000..2931b92f0d9 --- /dev/null +++ b/docs/6875c492.a75dca0e.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[37,11],{154:function(e,a,t){"use strict";var n=t(151);t.d(a,"a",(function(){return n.a}))},92:function(e,a,t){"use strict";t.r(a);var n=t(0),r=t.n(n),c=t(153),l=t(161),s=t(152);a.default=function(e){const{metadata:a,items:t}=e,{allTagsPath:n,name:m,count:o}=a;return r.a.createElement(c.a,{title:`Posts tagged "${m}"`,description:`Blog | Tagged "${m}"`},r.a.createElement("div",{className:"container margin-vert--lg"},r.a.createElement("div",{className:"row"},r.a.createElement("main",{className:"col col--8 col--offset-2"},r.a.createElement("h1",null,o," ",function(e,a){return e>1?a+"s":a}(o,"post"),' tagged with "',m,'"'),r.a.createElement(s.a,{href:n},"View All Tags"),r.a.createElement("div",{className:"margin-vert--xl"},t.map(({content:e})=>r.a.createElement(l.a,{key:e.metadata.permalink,frontMatter:e.frontMatter,metadata:e.metadata,truncated:!0},r.a.createElement(e,null))))))))}}}]); \ No newline at end of file diff --git a/docs/70699f3e.0d9dc710.js b/docs/70699f3e.e08b1731.js similarity index 100% rename from docs/70699f3e.0d9dc710.js rename to docs/70699f3e.e08b1731.js diff --git a/docs/7696a0ae.872ee861.js b/docs/7696a0ae.086cf378.js similarity index 100% rename from docs/7696a0ae.872ee861.js rename to docs/7696a0ae.086cf378.js diff --git a/docs/7b4b163f.4808d427.js b/docs/7b4b163f.15151a0b.js similarity index 100% rename from docs/7b4b163f.4808d427.js rename to docs/7b4b163f.15151a0b.js diff --git a/docs/7c7b3a8a.f2448b6a.js b/docs/7c7b3a8a.2ecfb225.js similarity index 100% rename from docs/7c7b3a8a.f2448b6a.js rename to docs/7c7b3a8a.2ecfb225.js diff --git a/docs/7d3779e7.ef765193.js b/docs/7d3779e7.1e9fe094.js similarity index 100% rename from docs/7d3779e7.ef765193.js rename to docs/7d3779e7.1e9fe094.js diff --git a/docs/8231c802.f5780f8f.js b/docs/8231c802.2ec6250f.js similarity index 100% rename from docs/8231c802.f5780f8f.js rename to docs/8231c802.2ec6250f.js diff --git a/docs/85.0018927c.js b/docs/85.0018927c.js deleted file mode 100644 index 65f4d2dd888..00000000000 --- a/docs/85.0018927c.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[85],{154:function(e,t,a){"use strict";var n=a(152);a.d(t,"a",(function(){return n.a}))},163:function(e,t,a){"use strict";a.r(t);var n=a(0),o=a.n(n),l=a(153);t.default=function(){return o.a.createElement(l.a,{title:"Page Not Found"},o.a.createElement("div",{className:"container margin-vert--xl"},o.a.createElement("div",{className:"row"},o.a.createElement("div",{className:"col col--6 col--offset-3"},o.a.createElement("h1",{className:"hero__title"},"Page Not Found"),o.a.createElement("p",null,"We could not find what you were looking for."),o.a.createElement("p",null,"Please contact the owner of the site that linked you to the original URL and let them know their link is broken.")))))}}}]); \ No newline at end of file diff --git a/docs/85.7e646109.js b/docs/85.7e646109.js new file mode 100644 index 00000000000..b888f8000c8 --- /dev/null +++ b/docs/85.7e646109.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[85],{139:function(e,t,n){"use strict";n.r(t);var a=n(0),r=n.n(a),o=n(142),l=n(143),c=n(22),s=n(153),i=n(2),u=n(146),p=n(148),m=n(168),d=n(169),y=n(170),h=n(167),f=n(152),b=n(145),g=n(65),v=n.n(g);const k=(e,t)=>"link"===e.type?((e,t)=>{const n=e=>e.endsWith("/")?e:e+"/";return n(e)===n(t)})(e.href,t):"category"===e.type&&e.items.some(e=>k(e,t));function j({item:e,onItemClick:t,collapsible:n,activePath:o,...l}){const{items:c,label:s}=e,p=k(e,o),m=function(e){const t=Object(a.useRef)(e);return Object(a.useEffect)(()=>{t.current=e},[e]),t.current}(p),[d,y]=Object(a.useState)(()=>!!n&&(!p&&e.collapsed));Object(a.useEffect)(()=>{p&&!m&&d&&y(!1)},[p,m,d]);const h=Object(a.useCallback)(e=>{e.preventDefault(),y(e=>!e)},[y]);return 0===c.length?null:r.a.createElement("li",{className:Object(u.a)("menu__list-item",{"menu__list-item--collapsed":d}),key:s},r.a.createElement("a",Object(i.a)({className:Object(u.a)("menu__link",{"menu__link--sublist":n,"menu__link--active":n&&p,[v.a.menuLinkText]:!n}),onClick:n?h:void 0,href:n?"#!":void 0},l),s),r.a.createElement("ul",{className:"menu__list"},c.map(e=>r.a.createElement(E,{tabIndex:d?"-1":"0",key:e.label,item:e,onItemClick:t,collapsible:n,activePath:o}))))}function O({item:e,onItemClick:t,activePath:n,collapsible:a,...o}){const{href:l,label:c}=e,s=k(e,n);return r.a.createElement("li",{className:"menu__list-item",key:c},r.a.createElement(f.a,Object(i.a)({className:Object(u.a)("menu__link",{"menu__link--active":s}),to:l},Object(b.a)(l)?{isNavLink:!0,exact:!0,onClick:t}:{target:"_blank",rel:"noreferrer noopener"},o),c))}function E(e){switch(e.item.type){case"category":return r.a.createElement(j,e);case"link":default:return r.a.createElement(O,e)}}var N=function({path:e,sidebar:t,sidebarCollapsible:n=!0}){const[o,c]=Object(a.useState)(!1),{siteConfig:{themeConfig:{navbar:{title:s="",hideOnScroll:b=!1}={}}={}}={},isClient:g}=Object(l.a)(),{logoLink:k,logoLinkProps:j,logoImageUrl:O,logoAlt:N}=Object(y.a)(),{isAnnouncementBarClosed:C}=Object(p.a)(),{scrollY:w}=Object(h.a)();Object(m.a)(o);const x=Object(d.a)();return Object(a.useEffect)(()=>{x===d.b.desktop&&c(!1)},[x]),r.a.createElement("div",{className:Object(u.a)(v.a.sidebar,{[v.a.sidebarWithHideableNavbar]:b})},b&&r.a.createElement(f.a,Object(i.a)({tabIndex:-1,className:v.a.sidebarLogo,to:k},j),null!=O&&r.a.createElement("img",{key:g,src:O,alt:N}),null!=s&&r.a.createElement("strong",null,s)),r.a.createElement("div",{className:Object(u.a)("menu","menu--responsive",v.a.menu,{"menu--show":o,[v.a.menuWithAnnouncementBar]:!C&&0===w})},r.a.createElement("button",{"aria-label":o?"Close Menu":"Open Menu","aria-haspopup":"true",className:"button button--secondary button--sm menu__button",type:"button",onClick:()=>{c(!o)}},o?r.a.createElement("span",{className:Object(u.a)(v.a.sidebarMenuIcon,v.a.sidebarMenuCloseIcon)},"\xd7"):r.a.createElement("svg",{"aria-label":"Menu",className:v.a.sidebarMenuIcon,xmlns:"http://www.w3.org/2000/svg",height:24,width:24,viewBox:"0 0 32 32",role:"img",focusable:"false"},r.a.createElement("title",null,"Menu"),r.a.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))),r.a.createElement("ul",{className:"menu__list"},t.map(t=>r.a.createElement(E,{key:t.label,item:t,onItemClick:e=>{e.target.blur(),c(!1)},collapsible:n,activePath:e})))))},C=n(162),w=n(165),x=n(157),P=n(155),_=n(66),T=n.n(_);function S({version:e,isLast:t}){const n=t?[e,"latest"]:[e];return r.a.createElement(P.a,null,r.a.createElement("meta",{name:"docsearch:version",content:n.join(",")}))}function L({currentDocRoute:e,versionMetadata:t,children:n}){var a,c;const{siteConfig:i,isClient:u}=Object(l.a)(),{permalinkToSidebar:p,docsSidebars:m,version:d,isLast:y}=t,h=p[e.path],f=m[h];return r.a.createElement(r.a.Fragment,null,r.a.createElement(S,{version:d,isLast:y}),r.a.createElement(s.a,{key:u},r.a.createElement("div",{className:T.a.docPage},f&&r.a.createElement("div",{className:T.a.docSidebarContainer,role:"complementary"},r.a.createElement(N,{key:h,sidebar:f,path:e.path,sidebarCollapsible:null===(a=null===(c=i.themeConfig)||void 0===c?void 0:c.sidebarCollapsible)||void 0===a||a})),r.a.createElement("main",{className:T.a.docMainContainer},r.a.createElement(o.a,{components:C.a},n)))))}t.default=function(e){const{route:{routes:t},versionMetadata:n,location:a}=e,o=t.find(e=>Object(x.matchPath)(a.pathname,e));return o?r.a.createElement(L,{currentDocRoute:o,versionMetadata:n},Object(c.a)(t)):r.a.createElement(w.default,e)}},142:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return y}));var a=n(0),r=n.n(a);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function c(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=r.a.createContext({}),u=function(e){var t=r.a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},p=function(e){var t=u(e.components);return r.a.createElement(i.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},d=r.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,i=s(e,["components","mdxType","originalType","parentName"]),p=u(n),d=a,y=p["".concat(l,".").concat(d)]||p[d]||m[d]||o;return n?r.a.createElement(y,c(c({ref:t},i),{},{components:n})):r.a.createElement(y,c({ref:t},i))}));function y(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,l[1]=c;for(var i=2;i{const n=document.createElement("textarea"),a=document.activeElement;n.value=e,n.setAttribute("readonly",""),n.style.contain="strict",n.style.position="absolute",n.style.left="-9999px",n.style.fontSize="12pt";const r=document.getSelection();let o=!1;r.rangeCount>0&&(o=r.getRangeAt(0)),t.append(n),n.select(),n.selectionStart=0,n.selectionEnd=e.length;let l=!1;try{l=document.execCommand("copy")}catch(c){}return n.remove(),o&&(r.removeAllRanges(),r.addRange(o)),a&&a.focus(),l};e.exports=a,e.exports.default=a},160:function(e,t){e.exports.parse=function(e){var t=e.split(",").map((function(e){return function(e){if(/^-?\d+$/.test(e))return parseInt(e,10);var t;if(t=e.match(/^(-?\d+)(-|\.\.\.?|\u2025|\u2026|\u22EF)(-?\d+)$/)){var n=t[1],a=t[2],r=t[3];if(n&&r){var o=[],l=(n=parseInt(n))<(r=parseInt(r))?1:-1;"-"!=a&&".."!=a&&"\u2025"!=a||(r+=l);for(var c=n;c!=r;c+=l)o.push(c);return o}}return[]}(e)}));return 0===t.length?[]:1===t.length?Array.isArray(t[0])?t[0]:t:t.reduce((function(e,t){return Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),e.concat(t)}))}},162:function(e,t,n){"use strict";var a=n(2),r=n(0),o=n.n(r),l=n(152),c=n(146),s={plain:{backgroundColor:"#2a2734",color:"#9a86fd"},styles:[{types:["comment","prolog","doctype","cdata","punctuation"],style:{color:"#6c6783"}},{types:["namespace"],style:{opacity:.7}},{types:["tag","operator","number"],style:{color:"#e09142"}},{types:["property","function"],style:{color:"#9a86fd"}},{types:["tag-id","selector","atrule-id"],style:{color:"#eeebff"}},{types:["attr-name"],style:{color:"#c4b9fe"}},{types:["boolean","string","entity","url","attr-value","keyword","control","directive","unit","statement","regex","at-rule","placeholder","variable"],style:{color:"#ffcc99"}},{types:["deleted"],style:{textDecorationLine:"line-through"}},{types:["inserted"],style:{textDecorationLine:"underline"}},{types:["italic"],style:{fontStyle:"italic"}},{types:["important","bold"],style:{fontWeight:"bold"}},{types:["important"],style:{color:"#c4b9fe"}}]},i={Prism:n(20).a,theme:s};function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(){return(p=Object.assign||function(e){for(var t=1;t0&&e[n-1]===t?e:e.concat(t)},h=function(e,t){var n=e.plain,a=Object.create(null),r=e.styles.reduce((function(e,n){var a=n.languages,r=n.style;return a&&!a.includes(t)||n.types.forEach((function(t){var n=p({},e[t],r);e[t]=n})),e}),a);return r.root=n,r.plain=p({},n,{backgroundColor:null}),r};function f(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&-1===t.indexOf(a)&&(n[a]=e[a]);return n}var b=function(e){function t(){for(var t=this,n=[],a=arguments.length;a--;)n[a]=arguments[a];e.apply(this,n),u(this,"getThemeDict",(function(e){if(void 0!==t.themeDict&&e.theme===t.prevTheme&&e.language===t.prevLanguage)return t.themeDict;t.prevTheme=e.theme,t.prevLanguage=e.language;var n=e.theme?h(e.theme,e.language):void 0;return t.themeDict=n})),u(this,"getLineProps",(function(e){var n=e.key,a=e.className,r=e.style,o=p({},f(e,["key","className","style","line"]),{className:"token-line",style:void 0,key:void 0}),l=t.getThemeDict(t.props);return void 0!==l&&(o.style=l.plain),void 0!==r&&(o.style=void 0!==o.style?p({},o.style,r):r),void 0!==n&&(o.key=n),a&&(o.className+=" "+a),o})),u(this,"getStyleForToken",(function(e){var n=e.types,a=e.empty,r=n.length,o=t.getThemeDict(t.props);if(void 0!==o){if(1===r&&"plain"===n[0])return a?{display:"inline-block"}:void 0;if(1===r&&!a)return o[n[0]];var l=a?{display:"inline-block"}:{},c=n.map((function(e){return o[e]}));return Object.assign.apply(Object,[l].concat(c))}})),u(this,"getTokenProps",(function(e){var n=e.key,a=e.className,r=e.style,o=e.token,l=p({},f(e,["key","className","style","token"]),{className:"token "+o.types.join(" "),children:o.content,style:t.getStyleForToken(o),key:void 0});return void 0!==r&&(l.style=void 0!==l.style?p({},l.style,r):r),void 0!==n&&(l.key=n),a&&(l.className+=" "+a),l}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(){var e=this.props,t=e.Prism,n=e.language,a=e.code,r=e.children,o=this.getThemeDict(this.props),l=t.languages[n];return r({tokens:function(e){for(var t=[[]],n=[e],a=[0],r=[e.length],o=0,l=0,c=[],s=[c];l>-1;){for(;(o=a[l]++)0?u:["plain"],i=p):(u=y(u,p.type),p.alias&&(u=y(u,p.alias)),i=p.content),"string"==typeof i){var h=i.split(m),f=h.length;c.push({types:u,content:h[0]});for(var b=1;b{const{siteConfig:{themeConfig:{prism:e={}}}}=Object(O.a)(),{isDarkTheme:t}=Object(N.a)(),n=e.theme||E,a=e.darkTheme||n;return t?a:n},w=n(49),x=n.n(w);const P=/{([\d,-]+)}/,_=(e=["js","jsBlock","jsx","python","html"])=>{const t={js:{start:"\\/\\/",end:""},jsBlock:{start:"\\/\\*",end:"\\*\\/"},jsx:{start:"\\{\\s*\\/\\*",end:"\\*\\/\\s*\\}"},python:{start:"#",end:""},html:{start:"\x3c!--",end:"--\x3e"}},n=["highlight-next-line","highlight-start","highlight-end"].join("|"),a=e.map(e=>`(?:${t[e].start}\\s*(${n})\\s*${t[e].end})`).join("|");return new RegExp(`^\\s*(?:${a})\\s*$`)},T=/title=".*"/;var S=({children:e,className:t,metastring:n})=>{const{siteConfig:{themeConfig:{prism:l={}}}}=Object(O.a)(),[s,u]=Object(r.useState)(!1),[p,m]=Object(r.useState)(!1);Object(r.useEffect)(()=>{m(!0)},[]);const d=Object(r.useRef)(null);let y=[],h="";const f=C();if(n&&P.test(n)){const e=n.match(P)[1];y=j.a.parse(e).filter(e=>e>0)}n&&T.test(n)&&(h=n.match(T)[0].split("title=")[1].replace(/"+/g,""));let g=t&&t.replace(/language-/,"");!g&&l.defaultLanguage&&(g=l.defaultLanguage);let k=e.replace(/\n$/,"");if(0===y.length&&void 0!==g){let t="";const n=(e=>{switch(e){case"js":case"javascript":case"ts":case"typescript":return _(["js","jsBlock"]);case"jsx":case"tsx":return _(["js","jsBlock","jsx"]);case"html":return _(["js","jsBlock","html"]);case"python":case"py":return _(["python"]);default:return _()}})(g),a=e.replace(/\n$/,"").split("\n");let r;for(let e=0;ee||t,void 0)){case"highlight-next-line":t+=o+",";break;case"highlight-start":r=o;break;case"highlight-end":t+=`${r}-${o-1},`}a.splice(e,1)}else e+=1}y=j.a.parse(t),k=a.join("\n")}const E=()=>{v()(k),u(!0),setTimeout(()=>u(!1),2e3)};return o.a.createElement(b,Object(a.a)({},i,{key:String(p),theme:f,code:k,language:g}),({className:e,style:t,tokens:n,getLineProps:r,getTokenProps:l})=>o.a.createElement(o.a.Fragment,null,h&&o.a.createElement("div",{style:t,className:x.a.codeBlockTitle},h),o.a.createElement("div",{className:x.a.codeBlockContent},o.a.createElement("button",{ref:d,type:"button","aria-label":"Copy code to clipboard",className:Object(c.a)(x.a.copyButton,{[x.a.copyButtonWithTitle]:h}),onClick:E},s?"Copied":"Copy"),o.a.createElement("div",{tabIndex:0,className:Object(c.a)(e,x.a.codeBlock,{[x.a.codeBlockWithTitle]:h})},o.a.createElement("div",{className:x.a.codeBlockLines,style:t},n.map((e,t)=>{1===e.length&&""===e[0].content&&(e[0].content="\n");const n=r({line:e,key:t});return y.includes(t+1)&&(n.className=n.className+" docusaurus-highlight-code-line"),o.a.createElement("div",Object(a.a)({key:t},n),e.map((e,t)=>o.a.createElement("span",Object(a.a)({key:t},l({token:e,key:t})))))}))))))},L=(n(50),n(51)),D=n.n(L);var I=e=>function({id:t,...n}){const{siteConfig:{themeConfig:{navbar:{hideOnScroll:a=!1}={}}={}}={}}=Object(O.a)();return t?o.a.createElement(e,n,o.a.createElement("a",{"aria-hidden":"true",tabIndex:-1,className:Object(c.a)("anchor",{[D.a.enhancedAnchor]:!a}),id:t}),n.children,o.a.createElement("a",{"aria-hidden":"true",tabIndex:-1,className:"hash-link",href:"#"+t,title:"Direct link to heading"},"#")):o.a.createElement(e,n)},B=n(52),M=n.n(B);const A={code:e=>{const{children:t}=e;return"string"==typeof t?t.includes("\n")?o.a.createElement(S,e):o.a.createElement("code",e):t},a:e=>o.a.createElement(l.a,e),pre:e=>o.a.createElement("div",Object(a.a)({className:M.a.mdxCodeBlock},e)),h1:I("h1"),h2:I("h2"),h3:I("h3"),h4:I("h4"),h5:I("h5"),h6:I("h6")};t.a=A},165:function(e,t,n){"use strict";n.r(t);var a=n(0),r=n.n(a),o=n(153);t.default=function(){return r.a.createElement(o.a,{title:"Page Not Found"},r.a.createElement("div",{className:"container margin-vert--xl"},r.a.createElement("div",{className:"row"},r.a.createElement("div",{className:"col col--6 col--offset-3"},r.a.createElement("h1",{className:"hero__title"},"Page Not Found"),r.a.createElement("p",null,"We could not find what you were looking for."),r.a.createElement("p",null,"Please contact the owner of the site that linked you to the original URL and let them know their link is broken.")))))}}}]); \ No newline at end of file diff --git a/docs/86.763e07e0.js b/docs/86.763e07e0.js new file mode 100644 index 00000000000..9c6e2153f26 --- /dev/null +++ b/docs/86.763e07e0.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[86,11],{154:function(e,t,a){"use strict";var n=a(151);a.d(t,"a",(function(){return n.a}))},165:function(e,t,a){"use strict";a.r(t);var n=a(0),o=a.n(n),l=a(153);t.default=function(){return o.a.createElement(l.a,{title:"Page Not Found"},o.a.createElement("div",{className:"container margin-vert--xl"},o.a.createElement("div",{className:"row"},o.a.createElement("div",{className:"col col--6 col--offset-3"},o.a.createElement("h1",{className:"hero__title"},"Page Not Found"),o.a.createElement("p",null,"We could not find what you were looking for."),o.a.createElement("p",null,"Please contact the owner of the site that linked you to the original URL and let them know their link is broken.")))))}}}]); \ No newline at end of file diff --git a/docs/8bbf9761.f64cda87.js b/docs/8bbf9761.498ce4f9.js similarity index 100% rename from docs/8bbf9761.f64cda87.js rename to docs/8bbf9761.498ce4f9.js diff --git a/docs/8e2b7b33.016f2f3a.js b/docs/8e2b7b33.b2e4bfed.js similarity index 100% rename from docs/8e2b7b33.016f2f3a.js rename to docs/8e2b7b33.b2e4bfed.js diff --git a/docs/902d8112.665063e4.js b/docs/902d8112.7316b98d.js similarity index 95% rename from docs/902d8112.665063e4.js rename to docs/902d8112.7316b98d.js index e3dccc0ec5f..b362035f609 100644 --- a/docs/902d8112.665063e4.js +++ b/docs/902d8112.7316b98d.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[46],{102:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return b})),n.d(t,"metadata",(function(){return c})),n.d(t,"rightToc",(function(){return l})),n.d(t,"default",(function(){return p}));var a=n(2),i=n(6),r=(n(0),n(142)),o=n(144),b={id:"dbcontext-db-first",title:"9.19 \u6570\u636e\u5e93\u751f\u6210\u6a21\u578b",sidebar_label:"9.19 \u6570\u636e\u5e93\u751f\u6210\u6a21\u578b"},c={unversionedId:"dbcontext-db-first",id:"dbcontext-db-first",isDocsHomePage:!1,title:"9.19 \u6570\u636e\u5e93\u751f\u6210\u6a21\u578b",description:"9.19.1 \u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f",source:"@site/docs\\dbcontext-db-first.mdx",slug:"/dbcontext-db-first",permalink:"/docs/dbcontext-db-first",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/dbcontext-db-first.mdx",version:"current",sidebar_label:"9.19 \u6570\u636e\u5e93\u751f\u6210\u6a21\u578b",sidebar:"docs",previous:{title:"9.18 \u591a\u6570\u636e\u5e93\u64cd\u4f5c",permalink:"/docs/dbcontext-multi-database"},next:{title:"9.20 \u6a21\u578b\u751f\u6210\u6570\u636e\u5e93",permalink:"/docs/dbcontext-code-first"}},l=[{value:"9.19.1 \u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f",id:"9191-\u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f",children:[]},{value:"9.19.2 \u64cd\u4f5c\u6307\u5357",id:"9192-\u64cd\u4f5c\u6307\u5357",children:[{value:"9.19.2.1 \u6253\u5f00 \u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0",id:"91921-\u6253\u5f00-\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0",children:[]},{value:"9.19.2.2 \u5207\u6362\u9ed8\u8ba4\u9879\u76ee",id:"91922-\u5207\u6362\u9ed8\u8ba4\u9879\u76ee",children:[]},{value:"9.19.2.3 \u8f93\u5165 cli.ps1 \u547d\u4ee4",id:"91923-\u8f93\u5165-clips1-\u547d\u4ee4",children:[]}]},{value:"9.19.3 \u754c\u9762\u64cd\u4f5c\u6a21\u5f0f",id:"9193-\u754c\u9762\u64cd\u4f5c\u6a21\u5f0f",children:[{value:"9.19.3.1 \u542f\u52a8\u754c\u9762\u64cd\u4f5c",id:"91931-\u542f\u52a8\u754c\u9762\u64cd\u4f5c",children:[]},{value:"9.13.3.2 \u52a0\u8f7d\u6570\u636e\u5e93\u8868",id:"91332-\u52a0\u8f7d\u6570\u636e\u5e93\u8868",children:[]},{value:"9.13.3.3 \u9009\u62e9\u8868\u6216\u89c6\u56fe\u751f\u6210",id:"91333-\u9009\u62e9\u8868\u6216\u89c6\u56fe\u751f\u6210",children:[]},{value:"9.13.3.4 \u9009\u62e9\u4fdd\u5b58\u76ee\u5f55",id:"91334-\u9009\u62e9\u4fdd\u5b58\u76ee\u5f55",children:[]},{value:"9.13.3.5 \u751f\u6210\u6700\u7ec8\u5b9e\u4f53\u4ee3\u7801",id:"91335-\u751f\u6210\u6700\u7ec8\u5b9e\u4f53\u4ee3\u7801",children:[]}]},{value:"9.13.4 \u547d\u4ee4\u53c2\u6570\u914d\u7f6e",id:"9134-\u547d\u4ee4\u53c2\u6570\u914d\u7f6e",children:[]},{value:"9.13.5 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9135-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],s={rightToc:l};function p(e){var t=e.components,n=Object(i.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},s,n,{components:t,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"9191-\u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f"},"9.19.1 \u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e24\u79cd\u4e3b\u8981\u65b9\u6cd5\u6765 ",Object(r.b)("strong",{parentName:"p"},"\u4fdd\u6301\u5b9e\u4f53\u6a21\u578b\u548c\u6570\u636e\u5e93\u67b6\u6784\u540c\u6b65"),"\u3002"),Object(r.b)("p",null,"\u81f3\u4e8e\u6211\u4eec\u5e94\u8be5\u9009\u7528\u54ea\u4e2a\u65b9\u6cd5\uff0c\u8bf7\u786e\u5b9a\u4f60\u662f\u5e0c\u671b\u4ee5\u5b9e\u4f53\u6a21\u578b\u4e3a\u51c6\u8fd8\u662f\u4ee5\u6570\u636e\u5e93\u4e3a\u51c6\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u5982\u679c\u5e0c\u671b ",Object(r.b)("strong",{parentName:"p"},"\u4ee5\u5b9e\u4f53\u6a21\u578b\u4e3a\u51c6"),"\uff0c\u8bf7\u4f7f\u7528\u6b63\u5411\u5de5\u7a0b\uff08Code First\uff09\u3002 \u5bf9\u5b9e\u4f53\u6a21\u578b\u8fdb\u884c\u66f4\u6539\u65f6\uff0c\u6b64\u65b9\u6cd5\u4f1a\u4ee5\u589e\u91cf\u65b9\u5f0f\u5c06\u76f8\u5e94\u67b6\u6784\u66f4\u6539\u5e94\u7528\u5230\u6570\u636e\u5e93\uff0c\u4ee5\u4f7f\u6570\u636e\u5e93\u4fdd\u6301\u4e0e\u5b9e\u4f53\u6a21\u578b\u517c\u5bb9\u3002")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u5982\u679c\u5e0c\u671b ",Object(r.b)("strong",{parentName:"p"},"\u4ee5\u6570\u636e\u5e93\u67b6\u6784\u4e3a\u51c6"),"\uff0c\u8bf7\u4f7f\u7528\u53cd\u5411\u5de5\u7a0b\uff08Database First\uff09\u3002 \u4f7f\u7528\u6b64\u65b9\u6cd5\uff0c\u53ef\u901a\u8fc7\u5c06\u6570\u636e\u5e93\u67b6\u6784\u53cd\u5411\u5de5\u7a0b\u5230\u5b9e\u4f53\u6a21\u578b\u6765\u751f\u6210\u76f8\u5e94\u7684\u5b9e\u4f53\u7c7b\u578b\u3002"))),Object(r.b)("p",null,"\u672c\u7ae0\u8282\u662f ",Object(r.b)("strong",{parentName:"p"},"\u53cd\u5411\u5de5\u7a0b\uff08Database First\uff09")," \u7684\u76f8\u5173\u5185\u5bb9\u3002"),Object(r.b)("h2",{id:"9192-\u64cd\u4f5c\u6307\u5357"},"9.19.2 \u64cd\u4f5c\u6307\u5357"),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u64cd\u4f5c\u4e4b\u524d\u6ce8\u610f\u4e8b\u9879")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u76ee\u524d ",Object(r.b)("inlineCode",{parentName:"p"},"Fur Tools")," \u751f\u6210\u5de5\u5177",Object(r.b)("strong",{parentName:"p"},"\u9ed8\u8ba4\u4e0d\u652f\u6301\u4efb\u4f55\u6570\u636e\u5e93"),"\u751f\u6210\uff0c\u6240\u4ee5\u5982\u9700\u751f\u6210\u7279\u5b9a\u6570\u636e\u5e93\u7684\u4ee3\u7801\uff0c\u53ea\u9700\u8981\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur.EntityFrameworkCore.Core")," \u5b89\u88c5\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u5305\u5373\u53ef\uff1a"),Object(r.b)("p",{parentName:"div"},"\u5404\u4e2a\u6570\u636e\u5e93\u7684\u5305\u53ef\u67e5\u9605\uff1a",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"dbcontext-multi-database#91811-%E6%95%B0%E6%8D%AE%E5%BA%93%E6%8F%90%E4%BE%9B%E5%99%A8%E5%AF%B9%E5%BA%94%E5%8C%85"}),"\u591a\u6570\u636e\u5e93\u64cd\u4f5c-\u6570\u636e\u5e93\u63d0\u4f9b\u5668\u5bf9\u5e94\u5305")),Object(r.b)("p",{parentName:"div"},"\u53e6\u5916\uff0c\u53ea\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"SqlServer")," \u6570\u636e\u5e93\u652f\u6301\u53ef\u89c6\u5316 ",Object(r.b)("inlineCode",{parentName:"p"},"GUI")," \u64cd\u4f5c\uff0c\u5176\u4ed6\u7684\u53ea\u80fd\u547d\u4ee4\u884c\u64cd\u4f5c\u3002"))),Object(r.b)("h3",{id:"91921-\u6253\u5f00-\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0"},"9.19.2.1 \u6253\u5f00 ",Object(r.b)("inlineCode",{parentName:"h3"},"\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0")),Object(r.b)("img",{src:Object(o.a)("img/dbfirst1.png")}),Object(r.b)("h3",{id:"91922-\u5207\u6362\u9ed8\u8ba4\u9879\u76ee"},"9.19.2.2 \u5207\u6362\u9ed8\u8ba4\u9879\u76ee"),Object(r.b)("p",null,"\u5c06 ",Object(r.b)("inlineCode",{parentName:"p"},"\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0")," \u9ed8\u8ba4\u9879\u76ee\u8bbe\u7f6e\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"Fur.Core"),"\uff0c\u5982\u679c\u60a8\u662f\u5176\u4ed6\u540d\u5b57\uff0c\u5219\u5207\u6362\u5bf9\u5e94\u5373\u53ef\u3002"),Object(r.b)("img",{src:Object(o.a)("img/dbfirst2.png")}),Object(r.b)("h3",{id:"91923-\u8f93\u5165-clips1-\u547d\u4ee4"},"9.19.2.3 \u8f93\u5165 ",Object(r.b)("inlineCode",{parentName:"h3"},"cli.ps1")," \u547d\u4ee4"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),' &"../tools/cli.ps1"\n')),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u5173\u4e8e\u6570\u636e\u5e93\u547d\u540d")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c\u9700\u8981\u4fdd\u6301\u548c\u6570\u636e\u5e93\u4e00\u6a21\u4e00\u6837\u7684\u547d\u540d\uff0c\u5219\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"-UseDatabaseNames")," \u53c2\u6570\u6307\u5b9a\uff0c\u5982\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),' &"../tools/cli.ps1" -UseDatabaseNames\n')))),Object(r.b)("img",{src:Object(o.a)("img/dbfirst3.png")}),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7b49\u5f85\u8f93\u5165")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u6267\u884c\u4e0a\u9762\u547d\u4ee4\u540e\uff0c\u6b64\u65f6\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Cli")," \u6709\u4e00\u4e2a\u7b49\u5f85\u8f93\u5165\u63d0\u793a\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Fur Tools v1.0.0 \u8bf7\u952e\u5165\u64cd\u4f5c\u7c7b\u578b\uff1a[G] \u754c\u9762\u64cd\u4f5c\uff0c[\u4efb\u610f\u5b57\u7b26] \u547d\u4ee4\u884c\u64cd\u4f5c\nFur Tools v1.0.0 \u60a8\u7684\u8f93\u5165\u662f:\n")),Object(r.b)("p",{parentName:"div"},Object(r.b)("strong",{parentName:"p"},"\u8f93\u5165\u5927\u5199 ",Object(r.b)("inlineCode",{parentName:"strong"},"G")," \u8fdb\u5165\u754c\u9762\u64cd\u4f5c\u6a21\u5f0f\uff0c\u5176\u4ed6\u4efb\u610f\u5b57\u7b26\u8fdb\u5165\u547d\u4ee4\u884c\u64cd\u4f5c\u6a21\u5f0f\u3002")))),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u6ce8\u610f\u4e8b\u9879")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u76ee\u524d\u53ea\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"Sql Server")," \u6570\u636e\u5e93\u624d\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},"GUI \u754c\u9762\u64cd\u4f5c\u6a21\u5f0f"),"\uff0c\u5176\u4ed6\u6570\u636e\u5e93\u8bf7\u4f7f\u7528\u547d\u4ee4\u884c\u6a21\u5f0f\u3002"))),Object(r.b)("h2",{id:"9193-\u754c\u9762\u64cd\u4f5c\u6a21\u5f0f"},"9.19.3 \u754c\u9762\u64cd\u4f5c\u6a21\u5f0f"),Object(r.b)("h3",{id:"91931-\u542f\u52a8\u754c\u9762\u64cd\u4f5c"},"9.19.3.1 \u542f\u52a8\u754c\u9762\u64cd\u4f5c"),Object(r.b)("p",null,"\u5f53\u6211\u4eec\u8f93\u5165 ",Object(r.b)("inlineCode",{parentName:"p"},"G")," \u65f6\uff0c\u5c06\u6253\u5f00 ",Object(r.b)("inlineCode",{parentName:"p"},"GUI")," \u754c\u9762\u64cd\u4f5c\u6a21\u5f0f\uff0c\u5982\uff1a"),Object(r.b)("img",{src:Object(o.a)("img/dbfirst4.png")}),Object(r.b)("p",null,"\u8fd9\u65f6\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur Tools")," \u4f1a\u81ea\u52a8\u67e5\u627e\u6240\u6709\u6570\u636e\u5e93\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},".json")," \u6587\u4ef6\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:"{12-13}","{12-13}":!0}),'{\n "Logging": {\n "LogLevel": {\n "Default": "Information",\n "Microsoft": "Warning",\n "Microsoft.Hosting.Lifetime": "Information",\n "Microsoft.EntityFrameworkCore": "Information"\n }\n },\n "AllowedHosts": "*",\n "ConnectionStrings": {\n "DbConnectionString": "Server=localhost;Database=Fur;User=sa;Password=000000;MultipleActiveResultSets=True;",\n "Sqlite3ConnectionString": "Data Source=./Fur.db"\n }\n}\n')),Object(r.b)("h3",{id:"91332-\u52a0\u8f7d\u6570\u636e\u5e93\u8868"},"9.13.3.2 \u52a0\u8f7d\u6570\u636e\u5e93\u8868"),Object(r.b)("p",null,"\u9009\u62e9\u8fde\u63a5\u5b57\u7b26\u4e32\u4e4b\u540e\uff0c\u70b9\u51fb ",Object(r.b)("inlineCode",{parentName:"p"},"\u52a0\u8f7d\u6570\u636e\u5e93\u8868\u548c\u89c6\u56fe")," \u6309\u94ae\u52a0\u8f7d\u3002"),Object(r.b)("img",{src:Object(o.a)("img/dbfirst5.png")}),Object(r.b)("h3",{id:"91333-\u9009\u62e9\u8868\u6216\u89c6\u56fe\u751f\u6210"},"9.13.3.3 \u9009\u62e9\u8868\u6216\u89c6\u56fe\u751f\u6210"),Object(r.b)("p",null,"\u52a0\u8f7d\u8868\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u9009\u62e9\u60a8\u8981\u751f\u6210\u7684\u8868\u6216\u89c6\u56fe\uff0c",Object(r.b)("strong",{parentName:"p"},"\u652f\u6301\u591a\u9009")),Object(r.b)("img",{src:Object(o.a)("img/dbfirst6.png")}),Object(r.b)("p",null,"\u70b9\u51fb\u5e95\u90e8\u6309\u94ae ",Object(r.b)("inlineCode",{parentName:"p"},"\u7acb\u5373\u751f\u6210")),Object(r.b)("h3",{id:"91334-\u9009\u62e9\u4fdd\u5b58\u76ee\u5f55"},"9.13.3.4 \u9009\u62e9\u4fdd\u5b58\u76ee\u5f55"),Object(r.b)("p",null,"\u70b9\u51fb ",Object(r.b)("inlineCode",{parentName:"p"},"\u7acb\u5373\u751f\u6210")," \u6309\u94ae\u540e\uff0c\u4f1a\u5f39\u51fa\u5b9e\u4f53\u4fdd\u5b58\u9009\u62e9\u76ee\u5f55\u8d44\u6e90\u7ba1\u7406\u5668\uff0c\u9ed8\u8ba4\u5b9e\u4f53\u53ea\u80fd\u4fdd\u5b58\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur.Core")," \u5c42\uff1a"),Object(r.b)("img",{src:Object(o.a)("img/dbfirst7.png")}),Object(r.b)("p",null,"\u70b9\u51fb\u786e\u5b9a\u540e\u5c31\u53ef\u5b8c\u6210\u6240\u6709\u751f\u6210\u64cd\u4f5c\u3002"),Object(r.b)("h3",{id:"91335-\u751f\u6210\u6700\u7ec8\u5b9e\u4f53\u4ee3\u7801"},"9.13.3.5 \u751f\u6210\u6700\u7ec8\u5b9e\u4f53\u4ee3\u7801"),Object(r.b)("img",{src:Object(o.a)("img/dbfirst8.png")}),Object(r.b)("p",null,"\u6700\u7ec8\u811a\u672c\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),'PM> &"../tools/cli.ps1"\n// -----------------------------------------------------------------------------\n// ______ _______ _ \n// | ____| |__ __| | | \n// | |__ _ _ _ __ | | ___ ___ | |___ \n// | __| | | | \'__| | |/ _ \\ / _ \\| / __|\n// | | | |_| | | | | (_) | (_) | \\__ \\\n// |_| \\__,_|_| |_|\\___/ \\___/|_|___/\n// \n// -----------------------------------------------------------------------------\n// Fur \u662f .NET 5 \u5e73\u53f0\u4e0b\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u7684 Web \u5e94\u7528\u6846\u67b6\u3002\n// Copyright \xa9 2020 Fur, Baiqian Co.,Ltd.\n//\n// \u6846\u67b6\u540d\u79f0\uff1aFur\n// \u6846\u67b6\u4f5c\u8005\uff1a\u767e\u5c0f\u50e7\n// \u6846\u67b6\u7248\u672c\uff1a1.0.0\n// \u6e90\u7801\u5730\u5740\uff1ahttps://gitee.com/monksoul/Fur\n// \u5f00\u6e90\u534f\u8bae\uff1aApache-2.0\uff08http://www.apache.org/licenses/LICENSE-2.0\uff09\n// -----------------------------------------------------------------------------\nFur Tools v1.0.0 \u542f\u52a8\u4e2d......\nFur Tools v1.0.0 \u542f\u52a8\u6210\u529f\uff01\nFur Tools v1.0.0 \u8bf7\u952e\u5165\u64cd\u4f5c\u7c7b\u578b\uff1a[G] \u754c\u9762\u64cd\u4f5c\uff0c[\u4efb\u610f\u5b57\u7b26] \u547d\u4ee4\u884c\u64cd\u4f5c\nFur Tools v1.0.0 \u60a8\u7684\u8f93\u5165\u662f: G\nFur Tools v1.0.0 \u6b63\u5728\u52a0\u8f7d\u6570\u636e\u5e93\u8868\u548c\u89c6\u56fe......\nFur Tools v1.0.0 \u52a0\u8f7d\u6210\u529f\uff01\nFur Tools v1.0.0 \u6b63\u5728\u7f16\u8bd1\u89e3\u51b3\u65b9\u6848\u4ee3\u7801......\nBuild started...\nBuild succeeded.\nFor foreign key FK_PersonDetail_Person_PersonId on table dbo.PersonDetail, unable to model the end of the foreign key on principal table dbo.Person. This is usually because the principal table was not included in the selection set.\nFur Tools v1.0.0 \u7f16\u8bd1\u6210\u529f\uff01\nFur Tools v1.0.0 \u5f00\u59cb\u751f\u6210\u5b9e\u4f53\u6587\u4ef6......\nFur Tools v1.0.0 \u6b63\u5728\u751f\u6210 City.cs \u5b9e\u4f53\u4ee3\u7801......\nFur Tools v1.0.0 \u6210\u529f\u751f\u6210 City.cs \u5b9e\u4f53\u4ee3\u7801\n// -----------------------------------------------------------------------------\n// \u4ee5\u4e0b\u4ee3\u7801\u7531 Fur Tools v1.0.0 \u751f\u6210 \n// -----------------------------------------------------------------------------\n\nusing Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\n#nullable disable\n\nnamespace Fur.Core\n{\n public partial class City : IEntity, IEntityTypeBuilder\n {\n\n public City()\n {\n InverseParent = new HashSet();\n }\n\n public int Id { get; set; }\n public string Name { get; set; }\n public int? ParentId { get; set; }\n public DateTime CreatedTime { get; set; }\n public DateTime? UpdatedTime { get; set; }\n public bool IsDeleted { get; set; }\n\n public virtual City Parent { get; set; }\n public virtual ICollection InverseParent { get; set; }\n \n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasIndex(e => e.ParentId, "IX_City_ParentId");\n\n entityBuilder.HasOne(d => d.Parent)\n .WithMany(p => p.InverseParent)\n .HasForeignKey(d => d.ParentId);\n \n }\n\n }\n}\n\nFur Tools v1.0.0 \u6b63\u5728\u751f\u6210 PersonDetail.cs \u5b9e\u4f53\u4ee3\u7801......\nFur Tools v1.0.0 \u6210\u529f\u751f\u6210 PersonDetail.cs \u5b9e\u4f53\u4ee3\u7801\n// -----------------------------------------------------------------------------\n// \u4ee5\u4e0b\u4ee3\u7801\u7531 Fur Tools v1.0.0 \u751f\u6210 \n// -----------------------------------------------------------------------------\n\nusing Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\n#nullable disable\n\nnamespace Fur.Core\n{\n public partial class PersonDetail : IEntity, IEntityTypeBuilder\n {\n\n public int Id { get; set; }\n public string PhoneNumber { get; set; }\n public string Qq { get; set; }\n public int PersonId { get; set; }\n \n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasIndex(e => e.PersonId, "IX_PersonDetail_PersonId")\n .IsUnique();\n\n entityBuilder.Property(e => e.Qq).HasColumnName("QQ");\n \n }\n\n }\n}\n\nFur Tools v1.0.0 \u6b63\u5728\u751f\u6210 Post.cs \u5b9e\u4f53\u4ee3\u7801......\nFur Tools v1.0.0 \u6210\u529f\u751f\u6210 Post.cs \u5b9e\u4f53\u4ee3\u7801\n// -----------------------------------------------------------------------------\n// \u4ee5\u4e0b\u4ee3\u7801\u7531 Fur Tools v1.0.0 \u751f\u6210 \n// -----------------------------------------------------------------------------\n\nusing Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\n#nullable disable\n\nnamespace Fur.Core\n{\n public partial class Post : IEntity\n {\n\n public int Id { get; set; }\n public string Name { get; set; }\n public DateTime CreatedTime { get; set; }\n public DateTime? UpdatedTime { get; set; }\n public bool IsDeleted { get; set; }\n \n }\n}\n\nFur Tools v1.0.0 \u6b63\u5728\u751f\u6210 VPerson.cs \u5b9e\u4f53\u4ee3\u7801......\nFur Tools v1.0.0 \u6210\u529f\u751f\u6210 VPerson.cs \u5b9e\u4f53\u4ee3\u7801\n// -----------------------------------------------------------------------------\n// \u4ee5\u4e0b\u4ee3\u7801\u7531 Fur Tools v1.0.0 \u751f\u6210 \n// -----------------------------------------------------------------------------\n\nusing Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\n#nullable disable\n\nnamespace Fur.Core\n{\n public partial class VPerson : IEntity, IEntityTypeBuilder\n {\n\n public int Id { get; set; }\n public string Name { get; set; }\n public int Age { get; set; }\n public string Address { get; set; }\n \n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasNoKey();\n\n entityBuilder.ToView("V_Person");\n\n entityBuilder.Property(e => e.Id).ValueGeneratedOnAdd();\n\n entityBuilder.Property(e => e.Name).HasMaxLength(32);\n \n }\n\n }\n}\n\nFur Tools v1.0.0 \u5168\u90e8\u5b9e\u4f53\u751f\u6210\u6210\u529f\uff01\nPM> \n')),Object(r.b)("h2",{id:"9134-\u547d\u4ee4\u53c2\u6570\u914d\u7f6e"},"9.13.4 \u547d\u4ee4\u53c2\u6570\u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur Tools Cli")," \u652f\u6301\u591a\u4e2a\u53c2\u6570\u914d\u7f6e\uff0c\u4f7f\u7528\u65b9\u6cd5\u53ea\u9700\u8981\u5728\u547d\u4ee4\u540e\u9762\u6dfb\u52a0\u5373\u53ef\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),' &"../tools/cli.ps1" -Context \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u540d -ConnectionName \u8fde\u63a5\u5b57\u7b26\u4e32Key\n')),Object(r.b)("p",null,"\u652f\u6301\u53c2\u6570\u5982\u4e0b\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-Tables"),"\uff1a\u914d\u7f6e\u8981\u751f\u6210\u7684\u6570\u636e\u5e93\u8868\uff0c\u6570\u7ec4\u7c7b\u578b\uff0c\u5982\u679c\u4e3a\u7a7a\uff0c\u5219\u751f\u6210\u6570\u636e\u5e93\u6240\u6709\u8868\u548c\u89c6\u56fe\u3002\u5982\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"-Tables Person,PersonDetails")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-Context"),"\uff1a\u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"FurDbContext"),"\uff0c\u5982\u679c\u6709\u591a\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u5219\u6b64\u53c2\u6570\u5fc5\u987b\u914d\u7f6e"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-ConnectionName"),"\uff1a\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u5bf9\u4e8e ",Object(r.b)("inlineCode",{parentName:"li"},"appsetting.json")," \u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"Key")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-OutputDir"),"\uff1a\u751f\u6210\u5b9e\u4f53\u4ee3\u7801\u8f93\u51fa\u76ee\u5f55\uff0c\u9ed8\u8ba4\u4e3a\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"./Fur.Core/Entities/")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-DbProvider"),"\uff1a\u6570\u636e\u5e93\u63d0\u4f9b\u5668\uff0c\u9ed8\u8ba4\u662f ",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.SqlServer"),"\uff0c\u5176\u4ed6\u6570\u636e\u5e93\u8bf7\u6307\u5b9a\u5bf9\u5e94\u7a0b\u5e8f\u96c6",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"SqlServer"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.SqlServer")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Sqlite"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Sqlite")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Cosmos"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Cosmos")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"InMemoryDatabase"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.InMemory")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"MySql"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Pomelo.EntityFrameworkCore.MySql")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"PostgreSQL"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Npgsql.EntityFrameworkCore.PostgreSQL")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Oracle"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Citms.EntityFrameworkCore.Oracle")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Dm"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Dm")))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-EntryProject"),"\uff1aWeb \u542f\u7528\u9879\u76ee\u5c42\u540d\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"Fur.Web.Entry")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-CoreProject"),"\uff1a\u5b9e\u4f53\u9879\u76ee\u5c42\u540d\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"Fur.Core")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-DbContextLocators"),"\uff1a\u591a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"MasterDbContextLocator"),"\uff0c\u652f\u6301\u591a\u4e2a\uff0c\u5982\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"MasterDbContextLocator,MySqlDbContextLocator")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-Product"),"\uff1a\u89e3\u51b3\u65b9\u6848\u9ed8\u8ba4\u524d\u7f00\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"li"},"Fur")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-UseDatabaseNames"),"\uff1a\u662f\u5426\u4fdd\u6301\u751f\u6210\u548c\u6570\u636e\u5e93\u3001\u8868\u4e00\u81f4\u7684\u540d\u79f0")),Object(r.b)("h2",{id:"9135-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.13.5 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}p.isMDXComponent=!0},142:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return m}));var a=n(0),i=n.n(a);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function b(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=i.a.createContext({}),s=function(e){var t=i.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):b(b({},t),e)),n},p=function(e){var t=s(e.components);return i.a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.a.createElement(i.a.Fragment,{},t)}},u=i.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,o=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),p=s(n),u=a,m=p["".concat(o,".").concat(u)]||p[u]||d[u]||r;return n?i.a.createElement(m,b(b({ref:t},l),{},{components:n})):i.a.createElement(m,b({ref:t},l))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,o=new Array(r);o[0]=u;var b={};for(var c in t)hasOwnProperty.call(t,c)&&(b[c]=t[c]);b.originalType=e,b.mdxType="string"==typeof e?e:a,o[1]=b;for(var l=2;l\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0",id:"91921-\u6253\u5f00-\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0",children:[]},{value:"9.19.2.2 \u5207\u6362\u9ed8\u8ba4\u9879\u76ee",id:"91922-\u5207\u6362\u9ed8\u8ba4\u9879\u76ee",children:[]},{value:"9.19.2.3 \u8f93\u5165 cli.ps1 \u547d\u4ee4",id:"91923-\u8f93\u5165-clips1-\u547d\u4ee4",children:[]}]},{value:"9.19.3 \u754c\u9762\u64cd\u4f5c\u6a21\u5f0f",id:"9193-\u754c\u9762\u64cd\u4f5c\u6a21\u5f0f",children:[{value:"9.19.3.1 \u542f\u52a8\u754c\u9762\u64cd\u4f5c",id:"91931-\u542f\u52a8\u754c\u9762\u64cd\u4f5c",children:[]},{value:"9.13.3.2 \u52a0\u8f7d\u6570\u636e\u5e93\u8868",id:"91332-\u52a0\u8f7d\u6570\u636e\u5e93\u8868",children:[]},{value:"9.13.3.3 \u9009\u62e9\u8868\u6216\u89c6\u56fe\u751f\u6210",id:"91333-\u9009\u62e9\u8868\u6216\u89c6\u56fe\u751f\u6210",children:[]},{value:"9.13.3.4 \u9009\u62e9\u4fdd\u5b58\u76ee\u5f55",id:"91334-\u9009\u62e9\u4fdd\u5b58\u76ee\u5f55",children:[]},{value:"9.13.3.5 \u751f\u6210\u6700\u7ec8\u5b9e\u4f53\u4ee3\u7801",id:"91335-\u751f\u6210\u6700\u7ec8\u5b9e\u4f53\u4ee3\u7801",children:[]}]},{value:"9.13.4 \u547d\u4ee4\u53c2\u6570\u914d\u7f6e",id:"9134-\u547d\u4ee4\u53c2\u6570\u914d\u7f6e",children:[]},{value:"9.13.5 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9135-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],s={rightToc:l};function p(e){var t=e.components,n=Object(i.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},s,n,{components:t,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"9191-\u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f"},"9.19.1 \u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e24\u79cd\u4e3b\u8981\u65b9\u6cd5\u6765 ",Object(r.b)("strong",{parentName:"p"},"\u4fdd\u6301\u5b9e\u4f53\u6a21\u578b\u548c\u6570\u636e\u5e93\u67b6\u6784\u540c\u6b65"),"\u3002"),Object(r.b)("p",null,"\u81f3\u4e8e\u6211\u4eec\u5e94\u8be5\u9009\u7528\u54ea\u4e2a\u65b9\u6cd5\uff0c\u8bf7\u786e\u5b9a\u4f60\u662f\u5e0c\u671b\u4ee5\u5b9e\u4f53\u6a21\u578b\u4e3a\u51c6\u8fd8\u662f\u4ee5\u6570\u636e\u5e93\u4e3a\u51c6\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u5982\u679c\u5e0c\u671b ",Object(r.b)("strong",{parentName:"p"},"\u4ee5\u5b9e\u4f53\u6a21\u578b\u4e3a\u51c6"),"\uff0c\u8bf7\u4f7f\u7528\u6b63\u5411\u5de5\u7a0b\uff08Code First\uff09\u3002 \u5bf9\u5b9e\u4f53\u6a21\u578b\u8fdb\u884c\u66f4\u6539\u65f6\uff0c\u6b64\u65b9\u6cd5\u4f1a\u4ee5\u589e\u91cf\u65b9\u5f0f\u5c06\u76f8\u5e94\u67b6\u6784\u66f4\u6539\u5e94\u7528\u5230\u6570\u636e\u5e93\uff0c\u4ee5\u4f7f\u6570\u636e\u5e93\u4fdd\u6301\u4e0e\u5b9e\u4f53\u6a21\u578b\u517c\u5bb9\u3002")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u5982\u679c\u5e0c\u671b ",Object(r.b)("strong",{parentName:"p"},"\u4ee5\u6570\u636e\u5e93\u67b6\u6784\u4e3a\u51c6"),"\uff0c\u8bf7\u4f7f\u7528\u53cd\u5411\u5de5\u7a0b\uff08Database First\uff09\u3002 \u4f7f\u7528\u6b64\u65b9\u6cd5\uff0c\u53ef\u901a\u8fc7\u5c06\u6570\u636e\u5e93\u67b6\u6784\u53cd\u5411\u5de5\u7a0b\u5230\u5b9e\u4f53\u6a21\u578b\u6765\u751f\u6210\u76f8\u5e94\u7684\u5b9e\u4f53\u7c7b\u578b\u3002"))),Object(r.b)("p",null,"\u672c\u7ae0\u8282\u662f ",Object(r.b)("strong",{parentName:"p"},"\u53cd\u5411\u5de5\u7a0b\uff08Database First\uff09")," \u7684\u76f8\u5173\u5185\u5bb9\u3002"),Object(r.b)("h2",{id:"9192-\u64cd\u4f5c\u6307\u5357"},"9.19.2 \u64cd\u4f5c\u6307\u5357"),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u64cd\u4f5c\u4e4b\u524d\u6ce8\u610f\u4e8b\u9879")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u76ee\u524d ",Object(r.b)("inlineCode",{parentName:"p"},"Fur Tools")," \u751f\u6210\u5de5\u5177",Object(r.b)("strong",{parentName:"p"},"\u9ed8\u8ba4\u4e0d\u652f\u6301\u4efb\u4f55\u6570\u636e\u5e93"),"\u751f\u6210\uff0c\u6240\u4ee5\u5982\u9700\u751f\u6210\u7279\u5b9a\u6570\u636e\u5e93\u7684\u4ee3\u7801\uff0c\u53ea\u9700\u8981\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur.EntityFrameworkCore.Core")," \u5b89\u88c5\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u5305\u5373\u53ef\uff1a"),Object(r.b)("p",{parentName:"div"},"\u5404\u4e2a\u6570\u636e\u5e93\u7684\u5305\u53ef\u67e5\u9605\uff1a",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"dbcontext-multi-database#91811-%E6%95%B0%E6%8D%AE%E5%BA%93%E6%8F%90%E4%BE%9B%E5%99%A8%E5%AF%B9%E5%BA%94%E5%8C%85"}),"\u591a\u6570\u636e\u5e93\u64cd\u4f5c-\u6570\u636e\u5e93\u63d0\u4f9b\u5668\u5bf9\u5e94\u5305")),Object(r.b)("p",{parentName:"div"},"\u53e6\u5916\uff0c\u53ea\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"SqlServer")," \u6570\u636e\u5e93\u652f\u6301\u53ef\u89c6\u5316 ",Object(r.b)("inlineCode",{parentName:"p"},"GUI")," \u64cd\u4f5c\uff0c\u5176\u4ed6\u7684\u53ea\u80fd\u547d\u4ee4\u884c\u64cd\u4f5c\u3002"))),Object(r.b)("h3",{id:"91921-\u6253\u5f00-\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0"},"9.19.2.1 \u6253\u5f00 ",Object(r.b)("inlineCode",{parentName:"h3"},"\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0")),Object(r.b)("img",{src:Object(o.a)("img/dbfirst1.png")}),Object(r.b)("h3",{id:"91922-\u5207\u6362\u9ed8\u8ba4\u9879\u76ee"},"9.19.2.2 \u5207\u6362\u9ed8\u8ba4\u9879\u76ee"),Object(r.b)("p",null,"\u5c06 ",Object(r.b)("inlineCode",{parentName:"p"},"\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0")," \u9ed8\u8ba4\u9879\u76ee\u8bbe\u7f6e\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"Fur.Core"),"\uff0c\u5982\u679c\u60a8\u662f\u5176\u4ed6\u540d\u5b57\uff0c\u5219\u5207\u6362\u5bf9\u5e94\u5373\u53ef\u3002"),Object(r.b)("img",{src:Object(o.a)("img/dbfirst2.png")}),Object(r.b)("h3",{id:"91923-\u8f93\u5165-clips1-\u547d\u4ee4"},"9.19.2.3 \u8f93\u5165 ",Object(r.b)("inlineCode",{parentName:"h3"},"cli.ps1")," \u547d\u4ee4"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),' &"../tools/cli.ps1"\n')),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u5173\u4e8e\u6570\u636e\u5e93\u547d\u540d")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c\u9700\u8981\u4fdd\u6301\u548c\u6570\u636e\u5e93\u4e00\u6a21\u4e00\u6837\u7684\u547d\u540d\uff0c\u5219\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"-UseDatabaseNames")," \u53c2\u6570\u6307\u5b9a\uff0c\u5982\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),' &"../tools/cli.ps1" -UseDatabaseNames\n')))),Object(r.b)("img",{src:Object(o.a)("img/dbfirst3.png")}),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7b49\u5f85\u8f93\u5165")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u6267\u884c\u4e0a\u9762\u547d\u4ee4\u540e\uff0c\u6b64\u65f6\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Cli")," \u6709\u4e00\u4e2a\u7b49\u5f85\u8f93\u5165\u63d0\u793a\uff1a"),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Fur Tools v1.0.0 \u8bf7\u952e\u5165\u64cd\u4f5c\u7c7b\u578b\uff1a[G] \u754c\u9762\u64cd\u4f5c\uff0c[\u4efb\u610f\u5b57\u7b26] \u547d\u4ee4\u884c\u64cd\u4f5c\nFur Tools v1.0.0 \u60a8\u7684\u8f93\u5165\u662f:\n")),Object(r.b)("p",{parentName:"div"},Object(r.b)("strong",{parentName:"p"},"\u8f93\u5165\u5927\u5199 ",Object(r.b)("inlineCode",{parentName:"strong"},"G")," \u8fdb\u5165\u754c\u9762\u64cd\u4f5c\u6a21\u5f0f\uff0c\u5176\u4ed6\u4efb\u610f\u5b57\u7b26\u8fdb\u5165\u547d\u4ee4\u884c\u64cd\u4f5c\u6a21\u5f0f\u3002")))),Object(r.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u6ce8\u610f\u4e8b\u9879")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u76ee\u524d\u53ea\u6709 ",Object(r.b)("inlineCode",{parentName:"p"},"Sql Server")," \u6570\u636e\u5e93\u624d\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},"GUI \u754c\u9762\u64cd\u4f5c\u6a21\u5f0f"),"\uff0c\u5176\u4ed6\u6570\u636e\u5e93\u8bf7\u4f7f\u7528\u547d\u4ee4\u884c\u6a21\u5f0f\u3002"))),Object(r.b)("h2",{id:"9193-\u754c\u9762\u64cd\u4f5c\u6a21\u5f0f"},"9.19.3 \u754c\u9762\u64cd\u4f5c\u6a21\u5f0f"),Object(r.b)("h3",{id:"91931-\u542f\u52a8\u754c\u9762\u64cd\u4f5c"},"9.19.3.1 \u542f\u52a8\u754c\u9762\u64cd\u4f5c"),Object(r.b)("p",null,"\u5f53\u6211\u4eec\u8f93\u5165 ",Object(r.b)("inlineCode",{parentName:"p"},"G")," \u65f6\uff0c\u5c06\u6253\u5f00 ",Object(r.b)("inlineCode",{parentName:"p"},"GUI")," \u754c\u9762\u64cd\u4f5c\u6a21\u5f0f\uff0c\u5982\uff1a"),Object(r.b)("img",{src:Object(o.a)("img/dbfirst4.png")}),Object(r.b)("p",null,"\u8fd9\u65f6\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur Tools")," \u4f1a\u81ea\u52a8\u67e5\u627e\u6240\u6709\u6570\u636e\u5e93\u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},".json")," \u6587\u4ef6\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:"{12-13}","{12-13}":!0}),'{\n "Logging": {\n "LogLevel": {\n "Default": "Information",\n "Microsoft": "Warning",\n "Microsoft.Hosting.Lifetime": "Information",\n "Microsoft.EntityFrameworkCore": "Information"\n }\n },\n "AllowedHosts": "*",\n "ConnectionStrings": {\n "DbConnectionString": "Server=localhost;Database=Fur;User=sa;Password=000000;MultipleActiveResultSets=True;",\n "Sqlite3ConnectionString": "Data Source=./Fur.db"\n }\n}\n')),Object(r.b)("h3",{id:"91332-\u52a0\u8f7d\u6570\u636e\u5e93\u8868"},"9.13.3.2 \u52a0\u8f7d\u6570\u636e\u5e93\u8868"),Object(r.b)("p",null,"\u9009\u62e9\u8fde\u63a5\u5b57\u7b26\u4e32\u4e4b\u540e\uff0c\u70b9\u51fb ",Object(r.b)("inlineCode",{parentName:"p"},"\u52a0\u8f7d\u6570\u636e\u5e93\u8868\u548c\u89c6\u56fe")," \u6309\u94ae\u52a0\u8f7d\u3002"),Object(r.b)("img",{src:Object(o.a)("img/dbfirst5.png")}),Object(r.b)("h3",{id:"91333-\u9009\u62e9\u8868\u6216\u89c6\u56fe\u751f\u6210"},"9.13.3.3 \u9009\u62e9\u8868\u6216\u89c6\u56fe\u751f\u6210"),Object(r.b)("p",null,"\u52a0\u8f7d\u8868\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u9009\u62e9\u60a8\u8981\u751f\u6210\u7684\u8868\u6216\u89c6\u56fe\uff0c",Object(r.b)("strong",{parentName:"p"},"\u652f\u6301\u591a\u9009")),Object(r.b)("img",{src:Object(o.a)("img/dbfirst6.png")}),Object(r.b)("p",null,"\u70b9\u51fb\u5e95\u90e8\u6309\u94ae ",Object(r.b)("inlineCode",{parentName:"p"},"\u7acb\u5373\u751f\u6210")),Object(r.b)("h3",{id:"91334-\u9009\u62e9\u4fdd\u5b58\u76ee\u5f55"},"9.13.3.4 \u9009\u62e9\u4fdd\u5b58\u76ee\u5f55"),Object(r.b)("p",null,"\u70b9\u51fb ",Object(r.b)("inlineCode",{parentName:"p"},"\u7acb\u5373\u751f\u6210")," \u6309\u94ae\u540e\uff0c\u4f1a\u5f39\u51fa\u5b9e\u4f53\u4fdd\u5b58\u9009\u62e9\u76ee\u5f55\u8d44\u6e90\u7ba1\u7406\u5668\uff0c\u9ed8\u8ba4\u5b9e\u4f53\u53ea\u80fd\u4fdd\u5b58\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur.Core")," \u5c42\uff1a"),Object(r.b)("img",{src:Object(o.a)("img/dbfirst7.png")}),Object(r.b)("p",null,"\u70b9\u51fb\u786e\u5b9a\u540e\u5c31\u53ef\u5b8c\u6210\u6240\u6709\u751f\u6210\u64cd\u4f5c\u3002"),Object(r.b)("h3",{id:"91335-\u751f\u6210\u6700\u7ec8\u5b9e\u4f53\u4ee3\u7801"},"9.13.3.5 \u751f\u6210\u6700\u7ec8\u5b9e\u4f53\u4ee3\u7801"),Object(r.b)("img",{src:Object(o.a)("img/dbfirst8.png")}),Object(r.b)("p",null,"\u6700\u7ec8\u811a\u672c\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),'PM> &"../tools/cli.ps1"\n// -----------------------------------------------------------------------------\n// ______ _______ _ \n// | ____| |__ __| | | \n// | |__ _ _ _ __ | | ___ ___ | |___ \n// | __| | | | \'__| | |/ _ \\ / _ \\| / __|\n// | | | |_| | | | | (_) | (_) | \\__ \\\n// |_| \\__,_|_| |_|\\___/ \\___/|_|___/\n// \n// -----------------------------------------------------------------------------\n// Fur \u662f .NET 5 \u5e73\u53f0\u4e0b\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u7684 Web \u5e94\u7528\u6846\u67b6\u3002\n// Copyright \xa9 2020 Fur, Baiqian Co.,Ltd.\n//\n// \u6846\u67b6\u540d\u79f0\uff1aFur\n// \u6846\u67b6\u4f5c\u8005\uff1a\u767e\u5c0f\u50e7\n// \u6846\u67b6\u7248\u672c\uff1a1.0.0\n// \u6e90\u7801\u5730\u5740\uff1ahttps://gitee.com/monksoul/Fur\n// \u5f00\u6e90\u534f\u8bae\uff1aApache-2.0\uff08http://www.apache.org/licenses/LICENSE-2.0\uff09\n// -----------------------------------------------------------------------------\nFur Tools v1.0.0 \u542f\u52a8\u4e2d......\nFur Tools v1.0.0 \u542f\u52a8\u6210\u529f\uff01\nFur Tools v1.0.0 \u8bf7\u952e\u5165\u64cd\u4f5c\u7c7b\u578b\uff1a[G] \u754c\u9762\u64cd\u4f5c\uff0c[\u4efb\u610f\u5b57\u7b26] \u547d\u4ee4\u884c\u64cd\u4f5c\nFur Tools v1.0.0 \u60a8\u7684\u8f93\u5165\u662f: G\nFur Tools v1.0.0 \u6b63\u5728\u52a0\u8f7d\u6570\u636e\u5e93\u8868\u548c\u89c6\u56fe......\nFur Tools v1.0.0 \u52a0\u8f7d\u6210\u529f\uff01\nFur Tools v1.0.0 \u6b63\u5728\u7f16\u8bd1\u89e3\u51b3\u65b9\u6848\u4ee3\u7801......\nBuild started...\nBuild succeeded.\nFor foreign key FK_PersonDetail_Person_PersonId on table dbo.PersonDetail, unable to model the end of the foreign key on principal table dbo.Person. This is usually because the principal table was not included in the selection set.\nFur Tools v1.0.0 \u7f16\u8bd1\u6210\u529f\uff01\nFur Tools v1.0.0 \u5f00\u59cb\u751f\u6210\u5b9e\u4f53\u6587\u4ef6......\nFur Tools v1.0.0 \u6b63\u5728\u751f\u6210 City.cs \u5b9e\u4f53\u4ee3\u7801......\nFur Tools v1.0.0 \u6210\u529f\u751f\u6210 City.cs \u5b9e\u4f53\u4ee3\u7801\n// -----------------------------------------------------------------------------\n// \u4ee5\u4e0b\u4ee3\u7801\u7531 Fur Tools v1.0.0 \u751f\u6210 \n// -----------------------------------------------------------------------------\n\nusing Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\n#nullable disable\n\nnamespace Fur.Core\n{\n public partial class City : IEntity, IEntityTypeBuilder\n {\n\n public City()\n {\n InverseParent = new HashSet();\n }\n\n public int Id { get; set; }\n public string Name { get; set; }\n public int? ParentId { get; set; }\n public DateTime CreatedTime { get; set; }\n public DateTime? UpdatedTime { get; set; }\n public bool IsDeleted { get; set; }\n\n public virtual City Parent { get; set; }\n public virtual ICollection InverseParent { get; set; }\n \n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasIndex(e => e.ParentId, "IX_City_ParentId");\n\n entityBuilder.HasOne(d => d.Parent)\n .WithMany(p => p.InverseParent)\n .HasForeignKey(d => d.ParentId);\n \n }\n\n }\n}\n\nFur Tools v1.0.0 \u6b63\u5728\u751f\u6210 PersonDetail.cs \u5b9e\u4f53\u4ee3\u7801......\nFur Tools v1.0.0 \u6210\u529f\u751f\u6210 PersonDetail.cs \u5b9e\u4f53\u4ee3\u7801\n// -----------------------------------------------------------------------------\n// \u4ee5\u4e0b\u4ee3\u7801\u7531 Fur Tools v1.0.0 \u751f\u6210 \n// -----------------------------------------------------------------------------\n\nusing Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\n#nullable disable\n\nnamespace Fur.Core\n{\n public partial class PersonDetail : IEntity, IEntityTypeBuilder\n {\n\n public int Id { get; set; }\n public string PhoneNumber { get; set; }\n public string Qq { get; set; }\n public int PersonId { get; set; }\n \n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasIndex(e => e.PersonId, "IX_PersonDetail_PersonId")\n .IsUnique();\n\n entityBuilder.Property(e => e.Qq).HasColumnName("QQ");\n \n }\n\n }\n}\n\nFur Tools v1.0.0 \u6b63\u5728\u751f\u6210 Post.cs \u5b9e\u4f53\u4ee3\u7801......\nFur Tools v1.0.0 \u6210\u529f\u751f\u6210 Post.cs \u5b9e\u4f53\u4ee3\u7801\n// -----------------------------------------------------------------------------\n// \u4ee5\u4e0b\u4ee3\u7801\u7531 Fur Tools v1.0.0 \u751f\u6210 \n// -----------------------------------------------------------------------------\n\nusing Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\n#nullable disable\n\nnamespace Fur.Core\n{\n public partial class Post : IEntity\n {\n\n public int Id { get; set; }\n public string Name { get; set; }\n public DateTime CreatedTime { get; set; }\n public DateTime? UpdatedTime { get; set; }\n public bool IsDeleted { get; set; }\n \n }\n}\n\nFur Tools v1.0.0 \u6b63\u5728\u751f\u6210 VPerson.cs \u5b9e\u4f53\u4ee3\u7801......\nFur Tools v1.0.0 \u6210\u529f\u751f\u6210 VPerson.cs \u5b9e\u4f53\u4ee3\u7801\n// -----------------------------------------------------------------------------\n// \u4ee5\u4e0b\u4ee3\u7801\u7531 Fur Tools v1.0.0 \u751f\u6210 \n// -----------------------------------------------------------------------------\n\nusing Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore.Metadata.Builders;\nusing System;\nusing System.Collections.Generic;\n\n#nullable disable\n\nnamespace Fur.Core\n{\n public partial class VPerson : IEntity, IEntityTypeBuilder\n {\n\n public int Id { get; set; }\n public string Name { get; set; }\n public int Age { get; set; }\n public string Address { get; set; }\n \n public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)\n {\n entityBuilder.HasNoKey();\n\n entityBuilder.ToView("V_Person");\n\n entityBuilder.Property(e => e.Id).ValueGeneratedOnAdd();\n\n entityBuilder.Property(e => e.Name).HasMaxLength(32);\n \n }\n\n }\n}\n\nFur Tools v1.0.0 \u5168\u90e8\u5b9e\u4f53\u751f\u6210\u6210\u529f\uff01\nPM> \n')),Object(r.b)("h2",{id:"9134-\u547d\u4ee4\u53c2\u6570\u914d\u7f6e"},"9.13.4 \u547d\u4ee4\u53c2\u6570\u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur Tools Cli")," \u652f\u6301\u591a\u4e2a\u53c2\u6570\u914d\u7f6e\uff0c\u4f7f\u7528\u65b9\u6cd5\u53ea\u9700\u8981\u5728\u547d\u4ee4\u540e\u9762\u6dfb\u52a0\u5373\u53ef\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),' &"../tools/cli.ps1" -Context \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u540d -ConnectionName \u8fde\u63a5\u5b57\u7b26\u4e32Key\n')),Object(r.b)("p",null,"\u652f\u6301\u53c2\u6570\u5982\u4e0b\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-Tables"),"\uff1a\u914d\u7f6e\u8981\u751f\u6210\u7684\u6570\u636e\u5e93\u8868\uff0c\u6570\u7ec4\u7c7b\u578b\uff0c\u5982\u679c\u4e3a\u7a7a\uff0c\u5219\u751f\u6210\u6570\u636e\u5e93\u6240\u6709\u8868\u548c\u89c6\u56fe\u3002\u5982\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"-Tables Person,PersonDetails")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-Context"),"\uff1a\u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"FurDbContext"),"\uff0c\u5982\u679c\u6709\u591a\u4e2a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u5219\u6b64\u53c2\u6570\u5fc5\u987b\u914d\u7f6e"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-ConnectionName"),"\uff1a\u914d\u7f6e\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u5bf9\u4e8e ",Object(r.b)("inlineCode",{parentName:"li"},"appsetting.json")," \u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"li"},"Key")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-OutputDir"),"\uff1a\u751f\u6210\u5b9e\u4f53\u4ee3\u7801\u8f93\u51fa\u76ee\u5f55\uff0c\u9ed8\u8ba4\u4e3a\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"./Fur.Core/Entities/")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-DbProvider"),"\uff1a\u6570\u636e\u5e93\u63d0\u4f9b\u5668\uff0c\u9ed8\u8ba4\u662f ",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.SqlServer"),"\uff0c\u5176\u4ed6\u6570\u636e\u5e93\u8bf7\u6307\u5b9a\u5bf9\u5e94\u7a0b\u5e8f\u96c6",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"SqlServer"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.SqlServer")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Sqlite"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Sqlite")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Cosmos"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Cosmos")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"InMemoryDatabase"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.InMemory")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"MySql"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Pomelo.EntityFrameworkCore.MySql")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"PostgreSQL"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Npgsql.EntityFrameworkCore.PostgreSQL")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Oracle"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Citms.EntityFrameworkCore.Oracle")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Dm"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Microsoft.EntityFrameworkCore.Dm")))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-EntryProject"),"\uff1aWeb \u542f\u7528\u9879\u76ee\u5c42\u540d\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"Fur.Web.Entry")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-CoreProject"),"\uff1a\u5b9e\u4f53\u9879\u76ee\u5c42\u540d\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"Fur.Core")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-DbContextLocators"),"\uff1a\u591a\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\u5b9a\u4f4d\u5668\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"MasterDbContextLocator"),"\uff0c\u652f\u6301\u591a\u4e2a\uff0c\u5982\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"MasterDbContextLocator,MySqlDbContextLocator")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-Product"),"\uff1a\u89e3\u51b3\u65b9\u6848\u9ed8\u8ba4\u524d\u7f00\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"li"},"Fur")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"-UseDatabaseNames"),"\uff1a\u662f\u5426\u4fdd\u6301\u751f\u6210\u548c\u6570\u636e\u5e93\u3001\u8868\u4e00\u81f4\u7684\u540d\u79f0")),Object(r.b)("h2",{id:"9135-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.13.5 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}p.isMDXComponent=!0},142:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return u}));var a=n(0),i=n.n(a);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function b(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=i.a.createContext({}),s=function(e){var t=i.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):b(b({},t),e)),n},p=function(e){var t=s(e.components);return i.a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.a.createElement(i.a.Fragment,{},t)}},m=i.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,o=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),p=s(n),m=a,u=p["".concat(o,".").concat(m)]||p[m]||d[m]||r;return n?i.a.createElement(u,b(b({ref:t},l),{},{components:n})):i.a.createElement(u,b({ref:t},l))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,o=new Array(r);o[0]=m;var b={};for(var c in t)hasOwnProperty.call(t,c)&&(b[c]=t[c]);b.originalType=e,b.mdxType="string"==typeof e?e:a,o[1]=b;for(var l=2;lfunction(e,t,n,{forcePrependBaseUrl:a=!1,absolute:r=!1}={}){if(!n)return n;if(n.startsWith("#"))return n;if(Object(i.b)(n))return n;if(a)return t+n;const o=n.startsWith(t)?n:t+n.replace(/^\//,"");return r?e+o:o}(t,e,n,a)}}function o(e,t={}){const{withBaseUrl:n}=r();return n(e,t)}},145:function(e,t,n){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function i(e){return void 0!==e&&!a(e)}n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return i}))}}]); \ No newline at end of file diff --git a/docs/904cf40b.09e071c4.js b/docs/904cf40b.8359e8f3.js similarity index 100% rename from docs/904cf40b.09e071c4.js rename to docs/904cf40b.8359e8f3.js diff --git a/docs/97c3ef29.22942c40.js b/docs/97c3ef29.dc2fde2b.js similarity index 100% rename from docs/97c3ef29.22942c40.js rename to docs/97c3ef29.dc2fde2b.js diff --git a/docs/9bdac8f0.b38ef64e.js b/docs/9bdac8f0.63c881d2.js similarity index 100% rename from docs/9bdac8f0.b38ef64e.js rename to docs/9bdac8f0.63c881d2.js diff --git a/docs/a133dc31.7638bbc5.js b/docs/a133dc31.c0b1f43b.js similarity index 95% rename from docs/a133dc31.7638bbc5.js rename to docs/a133dc31.c0b1f43b.js index 46ea43460ac..2bf67d2ffe8 100644 --- a/docs/a133dc31.7638bbc5.js +++ b/docs/a133dc31.c0b1f43b.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[51],{107:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return i})),n.d(t,"metadata",(function(){return l})),n.d(t,"rightToc",(function(){return o})),n.d(t,"default",(function(){return u}));var a=n(2),c=n(6),r=(n(0),n(142)),b=n(144),i={id:"dbcontext-function",title:"9.14 \u51fd\u6570\u64cd\u4f5c",sidebar_label:"9.14 \u51fd\u6570\u64cd\u4f5c"},l={unversionedId:"dbcontext-function",id:"dbcontext-function",isDocsHomePage:!1,title:"9.14 \u51fd\u6570\u64cd\u4f5c",description:"\u63a8\u8350\u4f7f\u7528 \u300a9.15 Sql \u9ad8\u7ea7\u4ee3\u7406\u300b\u4ee3\u66ff\u672c\u7ae0\u8282\u529f\u80fd\u3002Sql \u9ad8\u7ea7\u4ee3\u7406 \u80fd\u591f\u63d0\u4f9b\u66f4\u5bb9\u6613\u4e14\u66f4\u6613\u7ef4\u62a4\u7684\u65b9\u5f0f\u3002",source:"@site/docs\\dbcontext-function.mdx",slug:"/dbcontext-function",permalink:"/docs/dbcontext-function",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/dbcontext-function.mdx",version:"current",sidebar_label:"9.14 \u51fd\u6570\u64cd\u4f5c",sidebar:"docs",previous:{title:"9.13 \u5b58\u50a8\u8fc7\u7a0b\u64cd\u4f5c",permalink:"/docs/dbcontext-proc"},next:{title:"9.15 Sql \u64cd\u4f5c",permalink:"/docs/dbcontext-sql"}},o=[{value:"9.14.1 \u6570\u636e\u5e93\u51fd\u6570",id:"9141-\u6570\u636e\u5e93\u51fd\u6570",children:[{value:"9.14.1.1 \u652f\u6301\u6807\u91cf\u51fd\u6570\u7684\u6570\u636e\u5e93",id:"91411-\u652f\u6301\u6807\u91cf\u51fd\u6570\u7684\u6570\u636e\u5e93",children:[]},{value:"9.14.1.2 \u652f\u6301\u8868\u503c\u51fd\u6570\u7684\u6570\u636e\u5e93",id:"91412-\u652f\u6301\u8868\u503c\u51fd\u6570\u7684\u6570\u636e\u5e93",children:[]}]},{value:"9.14.2 \u6570\u636e\u5e93\u51fd\u6570\u7c7b\u578b",id:"9142-\u6570\u636e\u5e93\u51fd\u6570\u7c7b\u578b",children:[]},{value:"9.14.3 \u51fd\u6570\u7684\u4f7f\u7528",id:"9143-\u51fd\u6570\u7684\u4f7f\u7528",children:[{value:"9.14.3.1 \u6807\u91cf\u51fd\u6570\u8fd4\u56de object",id:"91431-\u6807\u91cf\u51fd\u6570\u8fd4\u56de-object",children:[]},{value:"9.14.3.2 \u6807\u91cf\u51fd\u6570\u8fd4\u56de T",id:"91432-\u6807\u91cf\u51fd\u6570\u8fd4\u56de-t",children:[]},{value:"9.14.3.3 \u8868\u503c\u51fd\u6570\u8fd4\u56de DataTable",id:"91433-\u8868\u503c\u51fd\u6570\u8fd4\u56de-datatable",children:[]},{value:"9.14.3.4 \u8868\u503c\u51fd\u6570\u8fd4\u56de List<T>",id:"91434-\u8868\u503c\u51fd\u6570\u8fd4\u56de-listt",children:[]}]},{value:"9.14.4 \u5728 Linq \u4e2d\u4f7f\u7528 \u6807\u91cf\u51fd\u6570",id:"9144-\u5728-linq-\u4e2d\u4f7f\u7528-\u6807\u91cf\u51fd\u6570",children:[{value:"9.14.4.1 \u521b\u5efa\u6807\u91cf\u51fd\u6570",id:"91441-\u521b\u5efa\u6807\u91cf\u51fd\u6570",children:[]},{value:"9.14.4.2 \u521b\u5efa\u9759\u6001\u7c7b\u548c\u9759\u6001\u65b9\u6cd5",id:"91442-\u521b\u5efa\u9759\u6001\u7c7b\u548c\u9759\u6001\u65b9\u6cd5",children:[]},{value:"9.14.4.3 \u5728 Linq \u4e2d\u4f7f\u7528",id:"91443-\u5728-linq-\u4e2d\u4f7f\u7528",children:[]}]},{value:"9.14.5 \u5728 Linq \u4e2d\u4f7f\u7528 \u8868\u503c\u51fd\u6570",id:"9145-\u5728-linq-\u4e2d\u4f7f\u7528-\u8868\u503c\u51fd\u6570",children:[{value:"9.14.5.1 \u521b\u5efa\u8868\u503c\u51fd\u6570",id:"91451-\u521b\u5efa\u8868\u503c\u51fd\u6570",children:[]},{value:"9.14.5.2 \u521b\u5efa\u8868\u503c\u51fd\u6570\u6a21\u578b",id:"91452-\u521b\u5efa\u8868\u503c\u51fd\u6570\u6a21\u578b",children:[]},{value:"9.14.5.3 \u8868\u503c\u51fd\u6570\u914d\u7f6e",id:"91453-\u8868\u503c\u51fd\u6570\u914d\u7f6e",children:[]},{value:"9.14.5.4 \u5728 Linq \u4e2d\u4f7f\u7528",id:"91454-\u5728-linq-\u4e2d\u4f7f\u7528",children:[]}]},{value:"9.14.6 \u5728 EF Core \u5185\u7f6e\u51fd\u6570",id:"9146-\u5728-ef-core-\u5185\u7f6e\u51fd\u6570",children:[]},{value:"9.14.7 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9147-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],d={rightToc:o};function u(e){var t=e.components,n=Object(c.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},d,n,{components:t,mdxType:"MDXLayout"}),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u6e29\u99a8\u63d0\u793a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u63a8\u8350\u4f7f\u7528 \u300a",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"/docs/dbcontext-sql-proxy"}),"9.15 Sql \u9ad8\u7ea7\u4ee3\u7406"),"\u300b\u4ee3\u66ff\u672c\u7ae0\u8282\u529f\u80fd\u3002",Object(r.b)("inlineCode",{parentName:"p"},"Sql \u9ad8\u7ea7\u4ee3\u7406")," \u80fd\u591f\u63d0\u4f9b\u66f4\u5bb9\u6613\u4e14\u66f4\u6613\u7ef4\u62a4\u7684\u65b9\u5f0f\u3002"))),Object(r.b)("h2",{id:"9141-\u6570\u636e\u5e93\u51fd\u6570"},"9.14.1 \u6570\u636e\u5e93\u51fd\u6570"),Object(r.b)("p",null,"\u5f15\u7528\u767e\u5ea6\u767e\u79d1\uff1a"),Object(r.b)("blockquote",null,Object(r.b)("p",{parentName:"blockquote"},"\u6570\u636e\u5e93\u51fd\u6570\u662f\u6307\u5f53\u9700\u8981\u5206\u6790\u6570\u636e\u6e05\u5355\u4e2d\u7684\u6570\u503c\u662f\u5426\u7b26\u5408\u7279\u5b9a\u6761\u4ef6\u65f6\uff0c\u4f7f\u7528\u6570\u636e\u5e93\u5de5\u4f5c\u8868\u51fd\u6570\u3002")),Object(r.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u6570\u636e\u5e93\u51fd\u6570\u5c31\u662f\u7528\u4e8e\u5b50\u8ba1\u7b97\u7684\u51fd\u6570\u3002\u5176\u8ba1\u7b97\u7684\u7ed3\u679c\u53ef\u4ee5\u7528\u4e8e\u6784\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"sql")," \u8bed\u53e5\u3002"),Object(r.b)("h3",{id:"91411-\u652f\u6301\u6807\u91cf\u51fd\u6570\u7684\u6570\u636e\u5e93"},"9.14.1.1 \u652f\u6301\u6807\u91cf\u51fd\u6570\u7684\u6570\u636e\u5e93"),Object(r.b)("table",null,Object(r.b)("thead",{parentName:"table"},Object(r.b)("tr",{parentName:"thead"},Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"SqlServer"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Sqlite"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Cosmos"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"InMemoryDatabase"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"MySql"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"PostgreSQL"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Oracle"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Firebird"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Dm"))),Object(r.b)("tbody",{parentName:"table"},Object(r.b)("tr",{parentName:"tbody"},Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}))))),Object(r.b)("h3",{id:"91412-\u652f\u6301\u8868\u503c\u51fd\u6570\u7684\u6570\u636e\u5e93"},"9.14.1.2 \u652f\u6301\u8868\u503c\u51fd\u6570\u7684\u6570\u636e\u5e93"),Object(r.b)("table",null,Object(r.b)("thead",{parentName:"table"},Object(r.b)("tr",{parentName:"thead"},Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"SqlServer"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Sqlite"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Cosmos"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"InMemoryDatabase"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"MySql"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"PostgreSQL"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Oracle"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Firebird"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Dm"))),Object(r.b)("tbody",{parentName:"table"},Object(r.b)("tr",{parentName:"tbody"},Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}))))),Object(r.b)("h2",{id:"9142-\u6570\u636e\u5e93\u51fd\u6570\u7c7b\u578b"},"9.14.2 \u6570\u636e\u5e93\u51fd\u6570\u7c7b\u578b"),Object(r.b)("p",null,"\u5728\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4e2d\uff0c\u6570\u636e\u5e93\u51fd\u6570\u6709\u8fd9\u4e24\u79cd\u7c7b\u578b\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u6807\u91cf\u51fd\u6570"),"\uff1a\u53ea\u80fd\u8fd4\u56de\u5355\u4e2a\u503c"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u8868\u503c\u51fd\u6570"),"\uff1a\u53ea\u80fd\u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6")),Object(r.b)("h2",{id:"9143-\u51fd\u6570\u7684\u4f7f\u7528"},"9.14.3 \u51fd\u6570\u7684\u4f7f\u7528"),Object(r.b)("h3",{id:"91431-\u6807\u91cf\u51fd\u6570\u8fd4\u56de-object"},"9.14.3.1 \u6807\u91cf\u51fd\u6570\u8fd4\u56de ",Object(r.b)("inlineCode",{parentName:"h3"},"object")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlFunctionScalar("func_GetValue");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetValue(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlFunctionScalar("func_GetValue");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlFunctionScalar("func_GetValue");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u51fd\u6570\u540d\u6267\u884c\nvar value = "func_GetValue".SqlFunctionScalar();\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(r.b)("h3",{id:"91432-\u6807\u91cf\u51fd\u6570\u8fd4\u56de-t"},"9.14.3.2 \u6807\u91cf\u51fd\u6570\u8fd4\u56de ",Object(r.b)("inlineCode",{parentName:"h3"},"T")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlFunctionScalar("func_GetValue");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetValue(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlFunctionScalar("func_GetValue");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlFunctionScalar("func_GetValue");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u51fd\u6570\u540d\u6267\u884c\nvar value = "func_GetValue".SqlFunctionScalar();\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(r.b)("h3",{id:"91433-\u8868\u503c\u51fd\u6570\u8fd4\u56de-datatable"},"9.14.3.3 \u8868\u503c\u51fd\u6570\u8fd4\u56de ",Object(r.b)("inlineCode",{parentName:"h3"},"DataTable")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlFunctionQuery("func_GetTable");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetTable(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlFunctionQuery("func_GetTable");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlFunctionQuery("func_GetTable");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u51fd\u6570\u540d\u6267\u884c\nvar value = "func_GetTable".SqlFunctionQuery();\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(r.b)("h3",{id:"91434-\u8868\u503c\u51fd\u6570\u8fd4\u56de-listt"},"9.14.3.4 \u8868\u503c\u51fd\u6570\u8fd4\u56de ",Object(r.b)("inlineCode",{parentName:"h3"},"List")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlFunctionQuery("func_GetTable");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetTable(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlFunctionQuery("func_GetTable");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlFunctionQuery("func_GetTable");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u51fd\u6570\u540d\u6267\u884c\nvar value = "func_GetTable".SqlFunctionQuery();\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(r.b)("h2",{id:"9144-\u5728-linq-\u4e2d\u4f7f\u7528-\u6807\u91cf\u51fd\u6570"},"9.14.4 \u5728 ",Object(r.b)("inlineCode",{parentName:"h2"},"Linq")," \u4e2d\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"h2"},"\u6807\u91cf\u51fd\u6570")),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u975e\u5e38\u7075\u6d3b\u7684\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Linq")," \u4e2d\u4f7f\u7528\u6807\u91cf\u51fd\u6570\u7684\u65b9\u6cd5\u3002\u5982\u679c\u50cf\u4f7f\u7528\u8fd9\u6837\u7684\u65b9\u5f0f\uff0c\u9700\u8981\u6ee1\u8db3\u4ee5\u4e0b\u4e24\u4e2a\u6761\u4ef6\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u6807\u91cf\u51fd\u6570\u5fc5\u987b\u5b9a\u4e49\u5728",Object(r.b)("strong",{parentName:"li"},"\u516c\u5f00\u9759\u6001\u7c7b"),"\u4e2d\uff0c\u4e14\u81ea\u5df1\u4e5f\u662f",Object(r.b)("strong",{parentName:"li"},"\u516c\u5f00\u9759\u6001\u65b9\u6cd5")),Object(r.b)("li",{parentName:"ul"},"\u8be5",Object(r.b)("strong",{parentName:"li"},"\u516c\u5f00\u9759\u6001\u65b9\u6cd5"),"\u5fc5\u987b\u8d34\u6709 ",Object(r.b)("inlineCode",{parentName:"li"},"[QueryableFunction]")," \u7279\u6027")),Object(r.b)("p",null,"\u793a\u4f8b\u5982\u4e0b\uff1a"),Object(r.b)("h3",{id:"91441-\u521b\u5efa\u6807\u91cf\u51fd\u6570"},"9.14.4.1 \u521b\u5efa\u6807\u91cf\u51fd\u6570"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"CREATE FUNCTION FN_GetId\n(\n @id INT\n)\nRETURNS INT\nAS\nBEGIN\n RETURN @id + 1;\nEND;\n")),Object(r.b)("h3",{id:"91442-\u521b\u5efa\u9759\u6001\u7c7b\u548c\u9759\u6001\u65b9\u6cd5"},"9.14.4.2 \u521b\u5efa\u9759\u6001\u7c7b\u548c\u9759\u6001\u65b9\u6cd5"),Object(r.b)("p",null,"\u521b\u5efa\u9759\u6001\u7c7b\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"p"},"QueryFunctions"),"\uff0c\u5c06\u8be5 ",Object(r.b)("inlineCode",{parentName:"p"},"\u6807\u91cf\u51fd\u6570")," \u653e\u5728\u9759\u6001\u7c7b\u4e2d\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1, 7, 10-11}","{1,":!0,"7,":!0,"10-11}":!0}),'using Fur.DatabaseAccessor;\nusing System;\n\nnamespace Fur.Application\n{\n // \u5fc5\u987b\u662f\u516c\u5f00\u9759\u6001\u7684\n public static class QueryFunctions\n {\n // \u5fc5\u987b\u662f\u9759\u6001\u65b9\u6cd5\n [QueryableFunction("FN_GetId", "dbo")] // \u914d\u7f6e\u6807\u91cf\u51fd\u6570\n public static int GetId(int id) => throw new NotSupportedException();\n }\n}\n')),Object(r.b)("h3",{id:"91443-\u5728-linq-\u4e2d\u4f7f\u7528"},"9.14.4.3 \u5728 ",Object(r.b)("inlineCode",{parentName:"h3"},"Linq")," \u4e2d\u4f7f\u7528"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"_personRepository.Where(u => u.Id > QueryFunctions.GetId(1)).ToList();\n")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"SELECT [p].[Id], [p].[Address], [p].[Age], [p].[CreatedTime], [p].[IsDeleted], [p].[Name], [p].[UpdatedTime]\nFROM [Person] AS [p]\nWHERE [p].[Id] > [dbo].[FN_GetId](1) // \ud83d\udca5 \u6ce8\u610f\u8fd9\u91cc\n")),Object(r.b)("img",{src:Object(b.a)("img/fn1.png")}),Object(r.b)("h2",{id:"9145-\u5728-linq-\u4e2d\u4f7f\u7528-\u8868\u503c\u51fd\u6570"},"9.14.5 \u5728 ",Object(r.b)("inlineCode",{parentName:"h2"},"Linq")," \u4e2d\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"h2"},"\u8868\u503c\u51fd\u6570")),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"EF Core 5.0")," \u7248\u672c\u652f\u6301\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Linq")," \u4e2d\u64cd\u4f5c ",Object(r.b)("inlineCode",{parentName:"p"},"\u8868\u503c\u51fd\u6570"),"\uff0c\u64cd\u4f5c\u6709\u70b9\u7c7b\u4f3c ",Object(r.b)("inlineCode",{parentName:"p"},"\u89c6\u56fe\u64cd\u4f5c")),Object(r.b)("p",null,"\u793a\u4f8b\u5982\u4e0b\uff1a"),Object(r.b)("h3",{id:"91451-\u521b\u5efa\u8868\u503c\u51fd\u6570"},"9.14.5.1 \u521b\u5efa\u8868\u503c\u51fd\u6570"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"CREATE FUNCTION dbo.GetPersons\n(\n @id INT\n)\nRETURNS TABLE\nAS\nRETURN\n(\n SELECT Id,\n Name,\n Age,\n Address\n FROM dbo.Person\n WHERE Id > @id\n);\n")),Object(r.b)("h3",{id:"91452-\u521b\u5efa\u8868\u503c\u51fd\u6570\u6a21\u578b"},"9.14.5.2 \u521b\u5efa\u8868\u503c\u51fd\u6570\u6a21\u578b"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"namespace Fur.Core\n{\n public class F_Person\n {\n /// \n /// \u4e3b\u952eId\n /// \n public int Id { get; set; }\n\n /// \n /// \u59d3\u540d\n /// \n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n\n /// \n /// \u4f4f\u5740\n /// \n public string Address { get; set; }\n }\n}\n")),Object(r.b)("h3",{id:"91453-\u8868\u503c\u51fd\u6570\u914d\u7f6e"},"9.14.5.3 \u8868\u503c\u51fd\u6570\u914d\u7f6e"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"DbContext")," \u7c7b\u4e2d\u5b9a\u4e49\u65b9\u6cd5\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{3,10,20-21}","{3,10,20-21}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing System.Linq;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext\n {\n public IQueryable GetPersons(int id) => FromExpression(() => GetPersons(id));\n\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n protected override void OnModelCreating(ModelBuilder modelBuilder)\n {\n base.OnModelCreating(modelBuilder);\n\n modelBuilder.Entity(typeof(F_Person)).HasNoKey();\n modelBuilder.HasDbFunction(() => GetPersons(default));\n }\n }\n}\n')),Object(r.b)("h3",{id:"91454-\u5728-linq-\u4e2d\u4f7f\u7528"},"9.14.5.4 \u5728 ",Object(r.b)("inlineCode",{parentName:"h3"},"Linq")," \u4e2d\u4f7f\u7528"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'IQueryable query = _repository.DynamicDbContext.GetPersons(1);\nvar result = query.Where(u => u.Name.Equals("Fur")).ToList();\n')),Object(r.b)("p",null,"\u6700\u7ec8\u751f\u6210 ",Object(r.b)("inlineCode",{parentName:"p"},"Sql")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"SELECT [g].Id, [g].Name, [g].Age, [g].Address\nFROM dbo.GetPersons(1) AS [g]\nWHERE [g].Name == N'Fur';\n")),Object(r.b)("h2",{id:"9146-\u5728-ef-core-\u5185\u7f6e\u51fd\u6570"},"9.14.6 \u5728 ",Object(r.b)("inlineCode",{parentName:"h2"},"EF Core")," \u5185\u7f6e\u51fd\u6570"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"EF Core")," \u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u5f88\u591a\u5e38\u7528\u7684\u5185\u7f6e\u51fd\u6570\uff0c\u53ef\u4ee5\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Lambda")," \u6761\u4ef6\u4e2d\u4f7f\u7528\uff0c\u4e3b\u8981\u662f\u901a\u8fc7 EF.Functions \u8c03\u7528\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"_repository.Where(u => EF.Functions.DateDiffHour(u.CreatedDt, DateTime.Now) > 8).FirstOrDefault();\n")),Object(r.b)("p",null,"\u8fd9\u4e2a\u8bed\u53e5\u4f7f\u7528\u4e86 EF.Functions.DateDiffHour \u6700\u7ec8\u751f\u6210\u7684 Sql \u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"SELECT TOP(1) [a].*\nFROM [dbo].[TEST] AS [a]\nWHERE DATEDIFF(HOUR, [a].[CREATED_DT], GETDATE()) > 8\n")),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"EF Core")," \u5185\u7f6e\u51fd\u6570\u5c31\u4e0d\u4e00\u4e00\u5217\u51fa\u4e86\uff0c\u53ef\u4ee5\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"EF.Functions")," \u67e5\u770b\u66f4\u591a\uff0c\u5982\u679c\u4e0d\u80fd\u6ee1\u8db3\u81ea\u5df1\u7684\u9700\u6c42\uff0c\u90a3\u4e48\u53ef\u4ee5\u81ea\u5b9a\u4e49 ",Object(r.b)("inlineCode",{parentName:"p"},"Linq")," \u6807\u91cf\u51fd\u6570"),Object(r.b)("h2",{id:"9147-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.14.7 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}u.isMDXComponent=!0},142:function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"b",(function(){return O}));var a=n(0),c=n.n(a);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}var o=c.a.createContext({}),d=function(e){var t=c.a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=d(e.components);return c.a.createElement(o.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return c.a.createElement(c.a.Fragment,{},t)}},p=c.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,b=e.parentName,o=l(e,["components","mdxType","originalType","parentName"]),u=d(n),p=a,O=u["".concat(b,".").concat(p)]||u[p]||s[p]||r;return n?c.a.createElement(O,i(i({ref:t},o),{},{components:n})):c.a.createElement(O,i({ref:t},o))}));function O(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,b=new Array(r);b[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,b[1]=i;for(var o=2;oobject",id:"91431-\u6807\u91cf\u51fd\u6570\u8fd4\u56de-object",children:[]},{value:"9.14.3.2 \u6807\u91cf\u51fd\u6570\u8fd4\u56de T",id:"91432-\u6807\u91cf\u51fd\u6570\u8fd4\u56de-t",children:[]},{value:"9.14.3.3 \u8868\u503c\u51fd\u6570\u8fd4\u56de DataTable",id:"91433-\u8868\u503c\u51fd\u6570\u8fd4\u56de-datatable",children:[]},{value:"9.14.3.4 \u8868\u503c\u51fd\u6570\u8fd4\u56de List<T>",id:"91434-\u8868\u503c\u51fd\u6570\u8fd4\u56de-listt",children:[]}]},{value:"9.14.4 \u5728 Linq \u4e2d\u4f7f\u7528 \u6807\u91cf\u51fd\u6570",id:"9144-\u5728-linq-\u4e2d\u4f7f\u7528-\u6807\u91cf\u51fd\u6570",children:[{value:"9.14.4.1 \u521b\u5efa\u6807\u91cf\u51fd\u6570",id:"91441-\u521b\u5efa\u6807\u91cf\u51fd\u6570",children:[]},{value:"9.14.4.2 \u521b\u5efa\u9759\u6001\u7c7b\u548c\u9759\u6001\u65b9\u6cd5",id:"91442-\u521b\u5efa\u9759\u6001\u7c7b\u548c\u9759\u6001\u65b9\u6cd5",children:[]},{value:"9.14.4.3 \u5728 Linq \u4e2d\u4f7f\u7528",id:"91443-\u5728-linq-\u4e2d\u4f7f\u7528",children:[]}]},{value:"9.14.5 \u5728 Linq \u4e2d\u4f7f\u7528 \u8868\u503c\u51fd\u6570",id:"9145-\u5728-linq-\u4e2d\u4f7f\u7528-\u8868\u503c\u51fd\u6570",children:[{value:"9.14.5.1 \u521b\u5efa\u8868\u503c\u51fd\u6570",id:"91451-\u521b\u5efa\u8868\u503c\u51fd\u6570",children:[]},{value:"9.14.5.2 \u521b\u5efa\u8868\u503c\u51fd\u6570\u6a21\u578b",id:"91452-\u521b\u5efa\u8868\u503c\u51fd\u6570\u6a21\u578b",children:[]},{value:"9.14.5.3 \u8868\u503c\u51fd\u6570\u914d\u7f6e",id:"91453-\u8868\u503c\u51fd\u6570\u914d\u7f6e",children:[]},{value:"9.14.5.4 \u5728 Linq \u4e2d\u4f7f\u7528",id:"91454-\u5728-linq-\u4e2d\u4f7f\u7528",children:[]}]},{value:"9.14.6 \u5728 EF Core \u5185\u7f6e\u51fd\u6570",id:"9146-\u5728-ef-core-\u5185\u7f6e\u51fd\u6570",children:[]},{value:"9.14.7 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9147-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],s={rightToc:o};function d(e){var t=e.components,n=Object(c.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},s,n,{components:t,mdxType:"MDXLayout"}),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u6e29\u99a8\u63d0\u793a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u63a8\u8350\u4f7f\u7528 \u300a",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"/docs/dbcontext-sql-proxy"}),"9.15 Sql \u9ad8\u7ea7\u4ee3\u7406"),"\u300b\u4ee3\u66ff\u672c\u7ae0\u8282\u529f\u80fd\u3002",Object(r.b)("inlineCode",{parentName:"p"},"Sql \u9ad8\u7ea7\u4ee3\u7406")," \u80fd\u591f\u63d0\u4f9b\u66f4\u5bb9\u6613\u4e14\u66f4\u6613\u7ef4\u62a4\u7684\u65b9\u5f0f\u3002"))),Object(r.b)("h2",{id:"9141-\u6570\u636e\u5e93\u51fd\u6570"},"9.14.1 \u6570\u636e\u5e93\u51fd\u6570"),Object(r.b)("p",null,"\u5f15\u7528\u767e\u5ea6\u767e\u79d1\uff1a"),Object(r.b)("blockquote",null,Object(r.b)("p",{parentName:"blockquote"},"\u6570\u636e\u5e93\u51fd\u6570\u662f\u6307\u5f53\u9700\u8981\u5206\u6790\u6570\u636e\u6e05\u5355\u4e2d\u7684\u6570\u503c\u662f\u5426\u7b26\u5408\u7279\u5b9a\u6761\u4ef6\u65f6\uff0c\u4f7f\u7528\u6570\u636e\u5e93\u5de5\u4f5c\u8868\u51fd\u6570\u3002")),Object(r.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u6570\u636e\u5e93\u51fd\u6570\u5c31\u662f\u7528\u4e8e\u5b50\u8ba1\u7b97\u7684\u51fd\u6570\u3002\u5176\u8ba1\u7b97\u7684\u7ed3\u679c\u53ef\u4ee5\u7528\u4e8e\u6784\u5efa ",Object(r.b)("inlineCode",{parentName:"p"},"sql")," \u8bed\u53e5\u3002"),Object(r.b)("h3",{id:"91411-\u652f\u6301\u6807\u91cf\u51fd\u6570\u7684\u6570\u636e\u5e93"},"9.14.1.1 \u652f\u6301\u6807\u91cf\u51fd\u6570\u7684\u6570\u636e\u5e93"),Object(r.b)("table",null,Object(r.b)("thead",{parentName:"table"},Object(r.b)("tr",{parentName:"thead"},Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"SqlServer"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Sqlite"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Cosmos"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"InMemoryDatabase"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"MySql"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"PostgreSQL"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Oracle"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Firebird"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Dm"))),Object(r.b)("tbody",{parentName:"table"},Object(r.b)("tr",{parentName:"tbody"},Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}))))),Object(r.b)("h3",{id:"91412-\u652f\u6301\u8868\u503c\u51fd\u6570\u7684\u6570\u636e\u5e93"},"9.14.1.2 \u652f\u6301\u8868\u503c\u51fd\u6570\u7684\u6570\u636e\u5e93"),Object(r.b)("table",null,Object(r.b)("thead",{parentName:"table"},Object(r.b)("tr",{parentName:"thead"},Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"SqlServer"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Sqlite"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Cosmos"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"InMemoryDatabase"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"MySql"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"PostgreSQL"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Oracle"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Firebird"),Object(r.b)("th",Object(a.a)({parentName:"tr"},{align:null}),"Dm"))),Object(r.b)("tbody",{parentName:"table"},Object(r.b)("tr",{parentName:"tbody"},Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}),"\u2714"),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null})),Object(r.b)("td",Object(a.a)({parentName:"tr"},{align:null}))))),Object(r.b)("h2",{id:"9142-\u6570\u636e\u5e93\u51fd\u6570\u7c7b\u578b"},"9.14.2 \u6570\u636e\u5e93\u51fd\u6570\u7c7b\u578b"),Object(r.b)("p",null,"\u5728\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4e2d\uff0c\u6570\u636e\u5e93\u51fd\u6570\u6709\u8fd9\u4e24\u79cd\u7c7b\u578b\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u6807\u91cf\u51fd\u6570"),"\uff1a\u53ea\u80fd\u8fd4\u56de\u5355\u4e2a\u503c"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u8868\u503c\u51fd\u6570"),"\uff1a\u53ea\u80fd\u8fd4\u56de\u4e00\u4e2a\u7ed3\u679c\u96c6")),Object(r.b)("h2",{id:"9143-\u51fd\u6570\u7684\u4f7f\u7528"},"9.14.3 \u51fd\u6570\u7684\u4f7f\u7528"),Object(r.b)("h3",{id:"91431-\u6807\u91cf\u51fd\u6570\u8fd4\u56de-object"},"9.14.3.1 \u6807\u91cf\u51fd\u6570\u8fd4\u56de ",Object(r.b)("inlineCode",{parentName:"h3"},"object")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlFunctionScalar("func_GetValue");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetValue(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlFunctionScalar("func_GetValue");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlFunctionScalar("func_GetValue");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u51fd\u6570\u540d\u6267\u884c\nvar value = "func_GetValue".SqlFunctionScalar();\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(r.b)("h3",{id:"91432-\u6807\u91cf\u51fd\u6570\u8fd4\u56de-t"},"9.14.3.2 \u6807\u91cf\u51fd\u6570\u8fd4\u56de ",Object(r.b)("inlineCode",{parentName:"h3"},"T")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlFunctionScalar("func_GetValue");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetValue(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlFunctionScalar("func_GetValue");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlFunctionScalar("func_GetValue");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u51fd\u6570\u540d\u6267\u884c\nvar value = "func_GetValue".SqlFunctionScalar();\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(r.b)("h3",{id:"91433-\u8868\u503c\u51fd\u6570\u8fd4\u56de-datatable"},"9.14.3.3 \u8868\u503c\u51fd\u6570\u8fd4\u56de ",Object(r.b)("inlineCode",{parentName:"h3"},"DataTable")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlFunctionQuery("func_GetTable");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetTable(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlFunctionQuery("func_GetTable");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlFunctionQuery("func_GetTable");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u51fd\u6570\u540d\u6267\u884c\nvar value = "func_GetTable".SqlFunctionQuery();\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(r.b)("h3",{id:"91434-\u8868\u503c\u51fd\u6570\u8fd4\u56de-listt"},"9.14.3.4 \u8868\u503c\u51fd\u6570\u8fd4\u56de ",Object(r.b)("inlineCode",{parentName:"h3"},"List")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// ISqlRepository \u65b9\u6cd5\nvar value = _sqlRepository.SqlFunctionQuery("func_GetTable");\n\n// ISqlDispatchProxy \u65b9\u5f0f\nvar value = _sqlExecuteProxy.GetTable(); // \u63a8\u8350\u65b9\u5f0f\n\n// \u5b9e\u4f53\u4ed3\u50a8\u65b9\u5f0f\nvar value = _personRepository.SqlFunctionQuery("func_GetTable");\n\n// IRepository \u975e\u6cdb\u578b\u65b9\u5f0f\nvar value = _repository.Sql().SqlFunctionQuery("func_GetTable");\n\n// \u53d8\u6001\u61d2\u4eba\u65b9\u5f0f\uff0c\u76f4\u63a5\u901a\u8fc7\u51fd\u6570\u540d\u6267\u884c\nvar value = "func_GetTable".SqlFunctionQuery();\n')),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5173\u4e8e\u5f02\u6b65")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u64cd\u4f5c\u90fd\u652f\u6301\u5f02\u6b65\u65b9\u5f0f\uff0c\u7531\u4e8e\u7bc7\u5e45\u6709\u9650\uff0c\u5c31\u4e0d\u5217\u4e3e\u5f02\u6b65\u65b9\u5f0f\u4e86\u3002"))),Object(r.b)("h2",{id:"9144-\u5728-linq-\u4e2d\u4f7f\u7528-\u6807\u91cf\u51fd\u6570"},"9.14.4 \u5728 ",Object(r.b)("inlineCode",{parentName:"h2"},"Linq")," \u4e2d\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"h2"},"\u6807\u91cf\u51fd\u6570")),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u975e\u5e38\u7075\u6d3b\u7684\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Linq")," \u4e2d\u4f7f\u7528\u6807\u91cf\u51fd\u6570\u7684\u65b9\u6cd5\u3002\u5982\u679c\u50cf\u4f7f\u7528\u8fd9\u6837\u7684\u65b9\u5f0f\uff0c\u9700\u8981\u6ee1\u8db3\u4ee5\u4e0b\u4e24\u4e2a\u6761\u4ef6\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u6807\u91cf\u51fd\u6570\u5fc5\u987b\u5b9a\u4e49\u5728",Object(r.b)("strong",{parentName:"li"},"\u516c\u5f00\u9759\u6001\u7c7b"),"\u4e2d\uff0c\u4e14\u81ea\u5df1\u4e5f\u662f",Object(r.b)("strong",{parentName:"li"},"\u516c\u5f00\u9759\u6001\u65b9\u6cd5")),Object(r.b)("li",{parentName:"ul"},"\u8be5",Object(r.b)("strong",{parentName:"li"},"\u516c\u5f00\u9759\u6001\u65b9\u6cd5"),"\u5fc5\u987b\u8d34\u6709 ",Object(r.b)("inlineCode",{parentName:"li"},"[QueryableFunction]")," \u7279\u6027")),Object(r.b)("p",null,"\u793a\u4f8b\u5982\u4e0b\uff1a"),Object(r.b)("h3",{id:"91441-\u521b\u5efa\u6807\u91cf\u51fd\u6570"},"9.14.4.1 \u521b\u5efa\u6807\u91cf\u51fd\u6570"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"CREATE FUNCTION FN_GetId\n(\n @id INT\n)\nRETURNS INT\nAS\nBEGIN\n RETURN @id + 1;\nEND;\n")),Object(r.b)("h3",{id:"91442-\u521b\u5efa\u9759\u6001\u7c7b\u548c\u9759\u6001\u65b9\u6cd5"},"9.14.4.2 \u521b\u5efa\u9759\u6001\u7c7b\u548c\u9759\u6001\u65b9\u6cd5"),Object(r.b)("p",null,"\u521b\u5efa\u9759\u6001\u7c7b\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"p"},"QueryFunctions"),"\uff0c\u5c06\u8be5 ",Object(r.b)("inlineCode",{parentName:"p"},"\u6807\u91cf\u51fd\u6570")," \u653e\u5728\u9759\u6001\u7c7b\u4e2d\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1, 7, 10-11}","{1,":!0,"7,":!0,"10-11}":!0}),'using Fur.DatabaseAccessor;\nusing System;\n\nnamespace Fur.Application\n{\n // \u5fc5\u987b\u662f\u516c\u5f00\u9759\u6001\u7684\n public static class QueryFunctions\n {\n // \u5fc5\u987b\u662f\u9759\u6001\u65b9\u6cd5\n [QueryableFunction("FN_GetId", "dbo")] // \u914d\u7f6e\u6807\u91cf\u51fd\u6570\n public static int GetId(int id) => throw new NotSupportedException();\n }\n}\n')),Object(r.b)("h3",{id:"91443-\u5728-linq-\u4e2d\u4f7f\u7528"},"9.14.4.3 \u5728 ",Object(r.b)("inlineCode",{parentName:"h3"},"Linq")," \u4e2d\u4f7f\u7528"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"_personRepository.Where(u => u.Id > QueryFunctions.GetId(1)).ToList();\n")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"SELECT [p].[Id], [p].[Address], [p].[Age], [p].[CreatedTime], [p].[IsDeleted], [p].[Name], [p].[UpdatedTime]\nFROM [Person] AS [p]\nWHERE [p].[Id] > [dbo].[FN_GetId](1) // \ud83d\udca5 \u6ce8\u610f\u8fd9\u91cc\n")),Object(r.b)("img",{src:Object(b.a)("img/fn1.png")}),Object(r.b)("h2",{id:"9145-\u5728-linq-\u4e2d\u4f7f\u7528-\u8868\u503c\u51fd\u6570"},"9.14.5 \u5728 ",Object(r.b)("inlineCode",{parentName:"h2"},"Linq")," \u4e2d\u4f7f\u7528 ",Object(r.b)("inlineCode",{parentName:"h2"},"\u8868\u503c\u51fd\u6570")),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"EF Core 5.0")," \u7248\u672c\u652f\u6301\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Linq")," \u4e2d\u64cd\u4f5c ",Object(r.b)("inlineCode",{parentName:"p"},"\u8868\u503c\u51fd\u6570"),"\uff0c\u64cd\u4f5c\u6709\u70b9\u7c7b\u4f3c ",Object(r.b)("inlineCode",{parentName:"p"},"\u89c6\u56fe\u64cd\u4f5c")),Object(r.b)("p",null,"\u793a\u4f8b\u5982\u4e0b\uff1a"),Object(r.b)("h3",{id:"91451-\u521b\u5efa\u8868\u503c\u51fd\u6570"},"9.14.5.1 \u521b\u5efa\u8868\u503c\u51fd\u6570"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"CREATE FUNCTION dbo.GetPersons\n(\n @id INT\n)\nRETURNS TABLE\nAS\nRETURN\n(\n SELECT Id,\n Name,\n Age,\n Address\n FROM dbo.Person\n WHERE Id > @id\n);\n")),Object(r.b)("h3",{id:"91452-\u521b\u5efa\u8868\u503c\u51fd\u6570\u6a21\u578b"},"9.14.5.2 \u521b\u5efa\u8868\u503c\u51fd\u6570\u6a21\u578b"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"namespace Fur.Core\n{\n public class F_Person\n {\n /// \n /// \u4e3b\u952eId\n /// \n public int Id { get; set; }\n\n /// \n /// \u59d3\u540d\n /// \n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n\n /// \n /// \u4f4f\u5740\n /// \n public string Address { get; set; }\n }\n}\n")),Object(r.b)("h3",{id:"91453-\u8868\u503c\u51fd\u6570\u914d\u7f6e"},"9.14.5.3 \u8868\u503c\u51fd\u6570\u914d\u7f6e"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"DbContext")," \u7c7b\u4e2d\u5b9a\u4e49\u65b9\u6cd5\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{3,10,20-21}","{3,10,20-21}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\nusing System.Linq;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Sqlite3ConnectionString")]\n public class FurDbContext : AppDbContext\n {\n public IQueryable GetPersons(int id) => FromExpression(() => GetPersons(id));\n\n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n\n protected override void OnModelCreating(ModelBuilder modelBuilder)\n {\n base.OnModelCreating(modelBuilder);\n\n modelBuilder.Entity(typeof(F_Person)).HasNoKey();\n modelBuilder.HasDbFunction(() => GetPersons(default));\n }\n }\n}\n')),Object(r.b)("h3",{id:"91454-\u5728-linq-\u4e2d\u4f7f\u7528"},"9.14.5.4 \u5728 ",Object(r.b)("inlineCode",{parentName:"h3"},"Linq")," \u4e2d\u4f7f\u7528"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'IQueryable query = _repository.DynamicDbContext.GetPersons(1);\nvar result = query.Where(u => u.Name.Equals("Fur")).ToList();\n')),Object(r.b)("p",null,"\u6700\u7ec8\u751f\u6210 ",Object(r.b)("inlineCode",{parentName:"p"},"Sql")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"SELECT [g].Id, [g].Name, [g].Age, [g].Address\nFROM dbo.GetPersons(1) AS [g]\nWHERE [g].Name == N'Fur';\n")),Object(r.b)("h2",{id:"9146-\u5728-ef-core-\u5185\u7f6e\u51fd\u6570"},"9.14.6 \u5728 ",Object(r.b)("inlineCode",{parentName:"h2"},"EF Core")," \u5185\u7f6e\u51fd\u6570"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"EF Core")," \u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u5f88\u591a\u5e38\u7528\u7684\u5185\u7f6e\u51fd\u6570\uff0c\u53ef\u4ee5\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Lambda")," \u6761\u4ef6\u4e2d\u4f7f\u7528\uff0c\u4e3b\u8981\u662f\u901a\u8fc7 EF.Functions \u8c03\u7528\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"_repository.Where(u => EF.Functions.DateDiffHour(u.CreatedDt, DateTime.Now) > 8).FirstOrDefault();\n")),Object(r.b)("p",null,"\u8fd9\u4e2a\u8bed\u53e5\u4f7f\u7528\u4e86 EF.Functions.DateDiffHour \u6700\u7ec8\u751f\u6210\u7684 Sql \u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-sql"}),"SELECT TOP(1) [a].*\nFROM [dbo].[TEST] AS [a]\nWHERE DATEDIFF(HOUR, [a].[CREATED_DT], GETDATE()) > 8\n")),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"EF Core")," \u5185\u7f6e\u51fd\u6570\u5c31\u4e0d\u4e00\u4e00\u5217\u51fa\u4e86\uff0c\u53ef\u4ee5\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"EF.Functions")," \u67e5\u770b\u66f4\u591a\uff0c\u5982\u679c\u4e0d\u80fd\u6ee1\u8db3\u81ea\u5df1\u7684\u9700\u6c42\uff0c\u90a3\u4e48\u53ef\u4ee5\u81ea\u5b9a\u4e49 ",Object(r.b)("inlineCode",{parentName:"p"},"Linq")," \u6807\u91cf\u51fd\u6570"),Object(r.b)("h2",{id:"9147-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.14.7 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}d.isMDXComponent=!0},142:function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return O}));var a=n(0),c=n.n(a);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}var o=c.a.createContext({}),s=function(e){var t=c.a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=s(e.components);return c.a.createElement(o.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return c.a.createElement(c.a.Fragment,{},t)}},p=c.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,b=e.parentName,o=l(e,["components","mdxType","originalType","parentName"]),d=s(n),p=a,O=d["".concat(b,".").concat(p)]||d[p]||u[p]||r;return n?c.a.createElement(O,i(i({ref:t},o),{},{components:n})):c.a.createElement(O,i({ref:t},o))}));function O(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,b=new Array(r);b[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,b[1]=i;for(var o=2;ofunction(e,t,n,{forcePrependBaseUrl:a=!1,absolute:r=!1}={}){if(!n)return n;if(n.startsWith("#"))return n;if(Object(c.b)(n))return n;if(a)return t+n;const b=n.startsWith(t)?n:t+n.replace(/^\//,"");return r?e+b:b}(t,e,n,a)}}function b(e,t={}){const{withBaseUrl:n}=r();return n(e,t)}},145:function(e,t,n){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function c(e){return void 0!==e&&!a(e)}n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return c}))}}]); \ No newline at end of file diff --git a/docs/a688d5cc.44b37d46.js b/docs/a688d5cc.cb046acd.js similarity index 100% rename from docs/a688d5cc.44b37d46.js rename to docs/a688d5cc.cb046acd.js diff --git a/docs/a6aa9e1f.005e050b.js b/docs/a6aa9e1f.005e050b.js new file mode 100644 index 00000000000..3857228ac7b --- /dev/null +++ b/docs/a6aa9e1f.005e050b.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[53,11],{140:function(a,e,t){"use strict";t.r(e);var n=t(0),i=t.n(n),l=t(143),r=t(153),c=t(161),m=t(152);var o=function(a){const{metadata:e}=a,{previousPage:t,nextPage:n}=e;return i.a.createElement("nav",{className:"pagination-nav","aria-label":"Blog list page navigation"},i.a.createElement("div",{className:"pagination-nav__item"},t&&i.a.createElement(m.a,{className:"pagination-nav__link",to:t},i.a.createElement("h4",{className:"pagination-nav__label"},"\xab Newer Entries"))),i.a.createElement("div",{className:"pagination-nav__item pagination-nav__item--next"},n&&i.a.createElement(m.a,{className:"pagination-nav__link",to:n},i.a.createElement("h4",{className:"pagination-nav__label"},"Older Entries \xbb"))))};e.default=function(a){const{metadata:e,items:t}=a,{siteConfig:{title:n}}=Object(l.a)(),m="/"===e.permalink?n:"Blog",{blogDescription:s}=e;return i.a.createElement(r.a,{title:m,description:s},i.a.createElement("div",{className:"container margin-vert--lg"},i.a.createElement("div",{className:"row"},i.a.createElement("main",{className:"col col--8 col--offset-2"},t.map(({content:a})=>i.a.createElement(c.a,{key:a.metadata.permalink,frontMatter:a.frontMatter,metadata:a.metadata,truncated:a.metadata.truncated},i.a.createElement(a,null))),i.a.createElement(o,{metadata:e})))))}},154:function(a,e,t){"use strict";var n=t(151);t.d(e,"a",(function(){return n.a}))}}]); \ No newline at end of file diff --git a/docs/a6aa9e1f.dad92990.js b/docs/a6aa9e1f.dad92990.js deleted file mode 100644 index 7b36fbc8a7c..00000000000 --- a/docs/a6aa9e1f.dad92990.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[53],{140:function(e,a,t){"use strict";t.r(a);var n=t(0),r=t.n(n),l=t(143),m=t(153),c=t(156),i=t(151);var o=function(e){var a=e.metadata,t=a.previousPage,n=a.nextPage;return r.a.createElement("nav",{className:"pagination-nav","aria-label":"Blog list page navigation"},r.a.createElement("div",{className:"pagination-nav__item"},t&&r.a.createElement(i.a,{className:"pagination-nav__link",to:t},r.a.createElement("h4",{className:"pagination-nav__label"},"\xab Newer Entries"))),r.a.createElement("div",{className:"pagination-nav__item pagination-nav__item--next"},n&&r.a.createElement(i.a,{className:"pagination-nav__link",to:n},r.a.createElement("h4",{className:"pagination-nav__label"},"Older Entries \xbb"))))};a.default=function(e){var a=e.metadata,t=e.items,n=Object(l.a)().siteConfig.title,i="/"===a.permalink?n:"Blog",s=a.blogDescription;return r.a.createElement(m.a,{title:i,description:s},r.a.createElement("div",{className:"container margin-vert--lg"},r.a.createElement("div",{className:"row"},r.a.createElement("main",{className:"col col--8 col--offset-2"},t.map((function(e){var a=e.content;return r.a.createElement(c.a,{key:a.metadata.permalink,frontMatter:a.frontMatter,metadata:a.metadata,truncated:a.metadata.truncated},r.a.createElement(a,null))})),r.a.createElement(o,{metadata:a})))))}},154:function(e,a,t){"use strict";var n=t(152);t.d(a,"a",(function(){return n.a}))},156:function(e,a,t){"use strict";var n=t(0),r=t.n(n),l=t(146),m=t(142),c=t(155),i=t(151),o=t(159),s=t(144),g=t(48),u=t.n(g),E=["January","February","March","April","May","June","July","August","September","October","November","December"];a.a=function(e){var a,t,n,g,v,d=e.children,p=e.frontMatter,_=e.metadata,b=e.truncated,h=e.isBlogPostPage,N=void 0!==h&&h,f=_.date,k=_.permalink,w=_.tags,y=_.readingTime,M=p.author,P=p.title,J=p.image,O=p.keywords,T=p.author_url||p.authorURL,j=p.author_title||p.authorTitle,x=p.author_image_url||p.authorImageURL,F=Object(s.a)(J,{absolute:!0});return r.a.createElement(r.a.Fragment,null,r.a.createElement(c.a,null,O&&O.length&&r.a.createElement("meta",{name:"keywords",content:O.join(",")}),J&&r.a.createElement("meta",{property:"og:image",content:F}),J&&r.a.createElement("meta",{property:"twitter:image",content:F}),J&&r.a.createElement("meta",{name:"twitter:image:alt",content:"Image for "+P})),r.a.createElement("article",{className:N?void 0:"margin-bottom--xl"},(a=N?"h1":"h2",t=f.substring(0,10).split("-"),n=t[0],g=E[parseInt(t[1],10)-1],v=parseInt(t[2],10),r.a.createElement("header",null,r.a.createElement(a,{className:Object(l.a)("margin-bottom--sm",u.a.blogPostTitle)},N?P:r.a.createElement(i.a,{to:k},P)),r.a.createElement("div",{className:"margin-vert--md"},r.a.createElement("time",{dateTime:f,className:u.a.blogPostDate},g," ",v,", ",n," ",y&&r.a.createElement(r.a.Fragment,null," \xb7 ",Math.ceil(y)," min read"))),r.a.createElement("div",{className:"avatar margin-vert--md"},x&&r.a.createElement("a",{className:"avatar__photo-link avatar__photo",href:T,target:"_blank",rel:"noreferrer noopener"},r.a.createElement("img",{src:x,alt:M})),r.a.createElement("div",{className:"avatar__intro"},M&&r.a.createElement(r.a.Fragment,null,r.a.createElement("h4",{className:"avatar__name"},r.a.createElement("a",{href:T,target:"_blank",rel:"noreferrer noopener"},M)),r.a.createElement("small",{className:"avatar__subtitle"},j)))))),r.a.createElement("section",{className:"markdown"},r.a.createElement(m.a,{components:o.a},d)),(w.length>0||b)&&r.a.createElement("footer",{className:"row margin-vert--lg"},w.length>0&&r.a.createElement("div",{className:"col"},r.a.createElement("strong",null,"Tags:"),w.map((function(e){var a=e.label,t=e.permalink;return r.a.createElement(i.a,{key:t,className:"margin-horiz--sm",to:t},a)}))),b&&r.a.createElement("div",{className:"col text--right"},r.a.createElement(i.a,{to:_.permalink,"aria-label":"Read more about "+P},r.a.createElement("strong",null,"Read More"))))))}}}]); \ No newline at end of file diff --git a/docs/a74774ac.19465b58.js b/docs/a74774ac.c040e8b1.js similarity index 100% rename from docs/a74774ac.19465b58.js rename to docs/a74774ac.c040e8b1.js diff --git a/docs/af3e9b99.0b631e94.js b/docs/af3e9b99.5cd3f05b.js similarity index 95% rename from docs/af3e9b99.0b631e94.js rename to docs/af3e9b99.5cd3f05b.js index dcbea87bc83..beaa0de8fc9 100644 --- a/docs/af3e9b99.0b631e94.js +++ b/docs/af3e9b99.5cd3f05b.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[55],{110:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return o})),n.d(t,"metadata",(function(){return b})),n.d(t,"rightToc",(function(){return s})),n.d(t,"default",(function(){return l}));var a=n(2),r=n(6),c=(n(0),n(142)),i=n(144),o={id:"dbcontext-code-first",title:"9.20 \u6a21\u578b\u751f\u6210\u6570\u636e\u5e93",sidebar_label:"9.20 \u6a21\u578b\u751f\u6210\u6570\u636e\u5e93"},b={unversionedId:"dbcontext-code-first",id:"dbcontext-code-first",isDocsHomePage:!1,title:"9.20 \u6a21\u578b\u751f\u6210\u6570\u636e\u5e93",description:"9.20.1 \u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f",source:"@site/docs\\dbcontext-code-first.mdx",slug:"/dbcontext-code-first",permalink:"/docs/dbcontext-code-first",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/dbcontext-code-first.mdx",version:"current",sidebar_label:"9.20 \u6a21\u578b\u751f\u6210\u6570\u636e\u5e93",sidebar:"docs",previous:{title:"9.19 \u6570\u636e\u5e93\u751f\u6210\u6a21\u578b",permalink:"/docs/dbcontext-db-first"},next:{title:"9.21 \u5b9e\u4f53\u79cd\u5b50\u6570\u636e",permalink:"/docs/dbcontext-seed-data"}},s=[{value:"9.20.1 \u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f",id:"9201-\u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f",children:[]},{value:"9.20.2 \u64cd\u4f5c\u6307\u5357",id:"9202-\u64cd\u4f5c\u6307\u5357",children:[{value:"9.20.2.1 \u521b\u5efa\u5b9e\u4f53\u6a21\u578b Person",id:"92021-\u521b\u5efa\u5b9e\u4f53\u6a21\u578b-person",children:[]},{value:"9.20.2.2 \u6253\u5f00 \u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0",id:"92022-\u6253\u5f00-\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0",children:[]},{value:"9.20.2.3 \u5207\u6362\u9ed8\u8ba4\u9879\u76ee",id:"92023-\u5207\u6362\u9ed8\u8ba4\u9879\u76ee",children:[]},{value:"9.20.2.4 \u521b\u5efa\u6a21\u578b\u7248\u672c",id:"92024-\u521b\u5efa\u6a21\u578b\u7248\u672c",children:[]},{value:"9.20.2.5 \u66f4\u65b0\u5230\u6570\u636e\u5e93",id:"92025-\u66f4\u65b0\u5230\u6570\u636e\u5e93",children:[]}]},{value:"9.20.3 \u66f4\u65b0\u6a21\u578b",id:"9203-\u66f4\u65b0\u6a21\u578b",children:[]},{value:"9.20.4 \u5bfc\u51fa Sql",id:"9204-\u5bfc\u51fa-sql",children:[]},{value:"9.20.5 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9205-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],d={rightToc:s};function l(e){var t=e.components,n=Object(r.a)(e,["components"]);return Object(c.b)("wrapper",Object(a.a)({},d,n,{components:t,mdxType:"MDXLayout"}),Object(c.b)("h2",{id:"9201-\u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f"},"9.20.1 \u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f"),Object(c.b)("p",null,Object(c.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e24\u79cd\u4e3b\u8981\u65b9\u6cd5\u6765 ",Object(c.b)("strong",{parentName:"p"},"\u4fdd\u6301\u5b9e\u4f53\u6a21\u578b\u548c\u6570\u636e\u5e93\u67b6\u6784\u540c\u6b65"),"\u3002"),Object(c.b)("p",null,"\u81f3\u4e8e\u6211\u4eec\u5e94\u8be5\u9009\u7528\u54ea\u4e2a\u65b9\u6cd5\uff0c\u8bf7\u786e\u5b9a\u4f60\u662f\u5e0c\u671b\u4ee5\u5b9e\u4f53\u6a21\u578b\u4e3a\u51c6\u8fd8\u662f\u4ee5\u6570\u636e\u5e93\u4e3a\u51c6\uff1a"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u5982\u679c\u5e0c\u671b ",Object(c.b)("strong",{parentName:"p"},"\u4ee5\u5b9e\u4f53\u6a21\u578b\u4e3a\u51c6"),"\uff0c\u8bf7\u4f7f\u7528\u6b63\u5411\u5de5\u7a0b\uff08Code First\uff09\u3002 \u5bf9\u5b9e\u4f53\u6a21\u578b\u8fdb\u884c\u66f4\u6539\u65f6\uff0c\u6b64\u65b9\u6cd5\u4f1a\u4ee5\u589e\u91cf\u65b9\u5f0f\u5c06\u76f8\u5e94\u67b6\u6784\u66f4\u6539\u5e94\u7528\u5230\u6570\u636e\u5e93\uff0c\u4ee5\u4f7f\u6570\u636e\u5e93\u4fdd\u6301\u4e0e\u5b9e\u4f53\u6a21\u578b\u517c\u5bb9\u3002")),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u5982\u679c\u5e0c\u671b ",Object(c.b)("strong",{parentName:"p"},"\u4ee5\u6570\u636e\u5e93\u67b6\u6784\u4e3a\u51c6"),"\uff0c\u8bf7\u4f7f\u7528\u53cd\u5411\u5de5\u7a0b\uff08Database First\uff09\u3002 \u4f7f\u7528\u6b64\u65b9\u6cd5\uff0c\u53ef\u901a\u8fc7\u5c06\u6570\u636e\u5e93\u67b6\u6784\u53cd\u5411\u5de5\u7a0b\u5230\u5b9e\u4f53\u6a21\u578b\u6765\u751f\u6210\u76f8\u5e94\u7684\u5b9e\u4f53\u7c7b\u578b\u3002"))),Object(c.b)("p",null,"\u672c\u7ae0\u8282\u662f ",Object(c.b)("strong",{parentName:"p"},"\u6b63\u5411\u5de5\u7a0b\uff08Code First\uff09")," \u7684\u76f8\u5173\u5185\u5bb9\u3002"),Object(c.b)("h2",{id:"9202-\u64cd\u4f5c\u6307\u5357"},"9.20.2 \u64cd\u4f5c\u6307\u5357"),Object(c.b)("h3",{id:"92021-\u521b\u5efa\u5b9e\u4f53\u6a21\u578b-person"},"9.20.2.1 \u521b\u5efa\u5b9e\u4f53\u6a21\u578b ",Object(c.b)("inlineCode",{parentName:"h3"},"Person")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,8}","{1,6,8}":!0}),"using Fur.DatabaseAccessor;\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Core\n{\n public class Person : Entity\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public Person()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u59d3\u540d\n /// \n [MaxLength(32)]\n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n\n /// \n /// \u4f4f\u5740\n /// \n public string Address { get; set; }\n }\n}\n")),Object(c.b)("div",{className:"admonition admonition-important alert alert--info"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u5b9e\u4f53\u7ea6\u5b9a")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u6240\u6709\u6570\u636e\u5e93\u5b9e\u4f53\u5fc5\u987b\u76f4\u63a5\u6216\u95f4\u63a5\u7ee7\u627f ",Object(c.b)("inlineCode",{parentName:"p"},"IEntity")," \u63a5\u53e3\u3002"))),Object(c.b)("h3",{id:"92022-\u6253\u5f00-\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0"},"9.20.2.2 \u6253\u5f00 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0")),Object(c.b)("img",{src:Object(i.a)("img/dbfirst1.png")}),Object(c.b)("h3",{id:"92023-\u5207\u6362\u9ed8\u8ba4\u9879\u76ee"},"9.20.2.3 \u5207\u6362\u9ed8\u8ba4\u9879\u76ee"),Object(c.b)("p",null,"\u5c06 ",Object(c.b)("inlineCode",{parentName:"p"},"\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0")," \u9ed8\u8ba4\u9879\u76ee\u8bbe\u7f6e\u4e3a ",Object(c.b)("inlineCode",{parentName:"p"},"Fur.Database.Migrations")),Object(c.b)("img",{src:Object(i.a)("img/codefirst1.png")}),Object(c.b)("h3",{id:"92024-\u521b\u5efa\u6a21\u578b\u7248\u672c"},"9.20.2.4 \u521b\u5efa\u6a21\u578b\u7248\u672c"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration v1.0.0\n")),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},Object(c.b)("strong",{parentName:"p"},"v1.0.0")," \u662f\u6b64\u5904\u6570\u636e\u5e93\u66f4\u6539\u7684\u7248\u672c\u53f7\uff0c\u53ef\u4ee5\u5199\u4efb\u4f55\u5b57\u7b26\u4e32\uff0c\u4f46\u63a8\u8350\u5199\u7248\u672c\u53f7\uff0c\u6bcf\u6b21 ",Object(c.b)("strong",{parentName:"p"},"+1"),"\u3002"))),Object(c.b)("p",null,"\u6700\u7ec8\u547d\u4ee4\u5982\u4e0b\uff1a"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"PM> Add-Migration v1.0.0\nBuild started...\nBuild succeeded.\nMicrosoft.EntityFrameworkCore.Model.Validation[10400]\n Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data, this mode should only be enabled during development.\nMicrosoft.EntityFrameworkCore.Infrastructure[10403]\n Entity Framework Core 5.0.0-rc.1.20451.13 initialized 'FurDbContext' using provider 'Microsoft.EntityFrameworkCore.Sqlite' with options: SensitiveDataLoggingEnabled DetailedErrorsEnabled MaxPoolSize=100 MigrationsAssembly=Fur.Database.Migrations\nTo undo this action, use Remove-Migration.\nPM>\n")),Object(c.b)("p",null,"\u751f\u6210\u6210\u529f\u540e\uff0c",Object(c.b)("inlineCode",{parentName:"p"},"Fur.Database.Migrations")," \u9879\u76ee\u4e0b\u4f1a\u65b0\u589e ",Object(c.b)("inlineCode",{parentName:"p"},"Migrations")," \u6587\u4ef6\u5939\uff08\u5982\u679c\u6ca1\u6709\uff09\uff0c\u540c\u65f6\u672c\u6b21\u7684\u67b6\u6784\u751f\u6210\u6587\u4ef6\uff0c\u5982\uff1a"),Object(c.b)("img",{src:Object(i.a)("img/codefirst3.png")}),Object(c.b)("h3",{id:"92025-\u66f4\u65b0\u5230\u6570\u636e\u5e93"},"9.20.2.5 \u66f4\u65b0\u5230\u6570\u636e\u5e93"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database\n")),Object(c.b)("p",null,"\u6267\u884c\u8be5\u547d\u4ee4\u540e\uff0c\u6570\u636e\u5e93\u5c31\u4f1a\u81ea\u52a8\u6839\u636e\u6a21\u578b\u751f\u6210\u5bf9\u4e8e\u7684\u8868\u3002"),Object(c.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u5982\u679c ",Object(c.b)("inlineCode",{parentName:"p"},"Update-Database")," \u540e\u9762\u5e26\u5b57\u7b26\u4e32\u53c2\u6570\uff0c\u5219\u4f1a\u81ea\u52a8\u8fd8\u539f\u6570\u636e\u5e93\u5230\u6307\u5b9a\u7248\u672c\uff0c\u5982\uff1a"),Object(c.b)("pre",{parentName:"div"},Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database v0.0.3\n")),Object(c.b)("p",{parentName:"div"},"\u5c06\u6570\u636e\u5e93\u8fd8\u539f\u5230 ",Object(c.b)("inlineCode",{parentName:"p"},"v0.0.3")," \u7248\u672c"))),Object(c.b)("h2",{id:"9203-\u66f4\u65b0\u6a21\u578b"},"9.20.3 \u66f4\u65b0\u6a21\u578b"),Object(c.b)("p",null,"\u5982\u679c\u6a21\u578b\u6539\u53d8\u4e86\uff0c\u91cd\u590d\u4e0a\u9762\u64cd\u4f5c\u5373\u53ef\uff0c\u5982\uff1a"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration v1.0.1\n")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database\n")),Object(c.b)("h2",{id:"9204-\u5bfc\u51fa-sql"},"9.20.4 \u5bfc\u51fa ",Object(c.b)("inlineCode",{parentName:"h2"},"Sql")),Object(c.b)("p",null,"\u6709\u4e9b\u65f6\u5019\uff0c\u6211\u4eec\u6ca1\u6709\u76f4\u63a5\u66f4\u65b0\u6570\u636e\u5e93\u7684\u6743\u9650\uff0c\u6216\u8005\u6015\u51fa\u95ee\u9898\uff0c\u6211\u4eec\u90fd\u4f1a\u5148\u751f\u6210 ",Object(c.b)("inlineCode",{parentName:"p"},"Sql")," \u770b\u770b\uff0c\u8fd9\u65f6\u5019\u53ea\u9700\u8981\u901a\u8fc7 ",Object(c.b)("inlineCode",{parentName:"p"},"Script-Migration")," \u5bfc\u51fa\u5373\u53ef\uff0c\u5982\uff1a"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Script-Migration\n")),Object(c.b)("img",{src:Object(i.a)("img/codefirst2.png")}),Object(c.b)("h2",{id:"9205-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.20.5 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(c.b)("hr",null),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(c.b)("inlineCode",{parentName:"p"},"\u6b63\u5411\u5de5\u5382")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli"}),"EF Core - \u7ba1\u7406\u6570\u636e\u5e93\u67b6\u6784")," \u7ae0\u8282\u3002"))))}l.isMDXComponent=!0},142:function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return u}));var a=n(0),r=n.n(a);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=r.a.createContext({}),d=function(e){var t=r.a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=d(e.components);return r.a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},m=r.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,s=b(e,["components","mdxType","originalType","parentName"]),l=d(n),m=a,u=l["".concat(i,".").concat(m)]||l[m]||p[m]||c;return n?r.a.createElement(u,o(o({ref:t},s),{},{components:n})):r.a.createElement(u,o({ref:t},s))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,i=new Array(c);i[0]=m;var o={};for(var b in t)hasOwnProperty.call(t,b)&&(o[b]=t[b]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var s=2;sPerson",id:"92021-\u521b\u5efa\u5b9e\u4f53\u6a21\u578b-person",children:[]},{value:"9.20.2.2 \u6253\u5f00 \u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0",id:"92022-\u6253\u5f00-\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0",children:[]},{value:"9.20.2.3 \u5207\u6362\u9ed8\u8ba4\u9879\u76ee",id:"92023-\u5207\u6362\u9ed8\u8ba4\u9879\u76ee",children:[]},{value:"9.20.2.4 \u521b\u5efa\u6a21\u578b\u7248\u672c",id:"92024-\u521b\u5efa\u6a21\u578b\u7248\u672c",children:[]},{value:"9.20.2.5 \u66f4\u65b0\u5230\u6570\u636e\u5e93",id:"92025-\u66f4\u65b0\u5230\u6570\u636e\u5e93",children:[]}]},{value:"9.20.3 \u66f4\u65b0\u6a21\u578b",id:"9203-\u66f4\u65b0\u6a21\u578b",children:[]},{value:"9.20.4 \u5bfc\u51fa Sql",id:"9204-\u5bfc\u51fa-sql",children:[]},{value:"9.20.5 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9205-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],d={rightToc:s};function l(e){var t=e.components,n=Object(r.a)(e,["components"]);return Object(c.b)("wrapper",Object(a.a)({},d,n,{components:t,mdxType:"MDXLayout"}),Object(c.b)("h2",{id:"9201-\u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f"},"9.20.1 \u6570\u636e\u5e93\u5f00\u53d1\u65b9\u5f0f"),Object(c.b)("p",null,Object(c.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e24\u79cd\u4e3b\u8981\u65b9\u6cd5\u6765 ",Object(c.b)("strong",{parentName:"p"},"\u4fdd\u6301\u5b9e\u4f53\u6a21\u578b\u548c\u6570\u636e\u5e93\u67b6\u6784\u540c\u6b65"),"\u3002"),Object(c.b)("p",null,"\u81f3\u4e8e\u6211\u4eec\u5e94\u8be5\u9009\u7528\u54ea\u4e2a\u65b9\u6cd5\uff0c\u8bf7\u786e\u5b9a\u4f60\u662f\u5e0c\u671b\u4ee5\u5b9e\u4f53\u6a21\u578b\u4e3a\u51c6\u8fd8\u662f\u4ee5\u6570\u636e\u5e93\u4e3a\u51c6\uff1a"),Object(c.b)("ul",null,Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u5982\u679c\u5e0c\u671b ",Object(c.b)("strong",{parentName:"p"},"\u4ee5\u5b9e\u4f53\u6a21\u578b\u4e3a\u51c6"),"\uff0c\u8bf7\u4f7f\u7528\u6b63\u5411\u5de5\u7a0b\uff08Code First\uff09\u3002 \u5bf9\u5b9e\u4f53\u6a21\u578b\u8fdb\u884c\u66f4\u6539\u65f6\uff0c\u6b64\u65b9\u6cd5\u4f1a\u4ee5\u589e\u91cf\u65b9\u5f0f\u5c06\u76f8\u5e94\u67b6\u6784\u66f4\u6539\u5e94\u7528\u5230\u6570\u636e\u5e93\uff0c\u4ee5\u4f7f\u6570\u636e\u5e93\u4fdd\u6301\u4e0e\u5b9e\u4f53\u6a21\u578b\u517c\u5bb9\u3002")),Object(c.b)("li",{parentName:"ul"},Object(c.b)("p",{parentName:"li"},"\u5982\u679c\u5e0c\u671b ",Object(c.b)("strong",{parentName:"p"},"\u4ee5\u6570\u636e\u5e93\u67b6\u6784\u4e3a\u51c6"),"\uff0c\u8bf7\u4f7f\u7528\u53cd\u5411\u5de5\u7a0b\uff08Database First\uff09\u3002 \u4f7f\u7528\u6b64\u65b9\u6cd5\uff0c\u53ef\u901a\u8fc7\u5c06\u6570\u636e\u5e93\u67b6\u6784\u53cd\u5411\u5de5\u7a0b\u5230\u5b9e\u4f53\u6a21\u578b\u6765\u751f\u6210\u76f8\u5e94\u7684\u5b9e\u4f53\u7c7b\u578b\u3002"))),Object(c.b)("p",null,"\u672c\u7ae0\u8282\u662f ",Object(c.b)("strong",{parentName:"p"},"\u6b63\u5411\u5de5\u7a0b\uff08Code First\uff09")," \u7684\u76f8\u5173\u5185\u5bb9\u3002"),Object(c.b)("h2",{id:"9202-\u64cd\u4f5c\u6307\u5357"},"9.20.2 \u64cd\u4f5c\u6307\u5357"),Object(c.b)("h3",{id:"92021-\u521b\u5efa\u5b9e\u4f53\u6a21\u578b-person"},"9.20.2.1 \u521b\u5efa\u5b9e\u4f53\u6a21\u578b ",Object(c.b)("inlineCode",{parentName:"h3"},"Person")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,8}","{1,6,8}":!0}),"using Fur.DatabaseAccessor;\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Core\n{\n public class Person : Entity\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public Person()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u59d3\u540d\n /// \n [MaxLength(32)]\n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n\n /// \n /// \u4f4f\u5740\n /// \n public string Address { get; set; }\n }\n}\n")),Object(c.b)("div",{className:"admonition admonition-important alert alert--info"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u5b9e\u4f53\u7ea6\u5b9a")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u6240\u6709\u6570\u636e\u5e93\u5b9e\u4f53\u5fc5\u987b\u76f4\u63a5\u6216\u95f4\u63a5\u7ee7\u627f ",Object(c.b)("inlineCode",{parentName:"p"},"IEntity")," \u63a5\u53e3\u3002"))),Object(c.b)("h3",{id:"92022-\u6253\u5f00-\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0"},"9.20.2.2 \u6253\u5f00 ",Object(c.b)("inlineCode",{parentName:"h3"},"\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0")),Object(c.b)("img",{src:Object(i.a)("img/dbfirst1.png")}),Object(c.b)("h3",{id:"92023-\u5207\u6362\u9ed8\u8ba4\u9879\u76ee"},"9.20.2.3 \u5207\u6362\u9ed8\u8ba4\u9879\u76ee"),Object(c.b)("p",null,"\u5c06 ",Object(c.b)("inlineCode",{parentName:"p"},"\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0")," \u9ed8\u8ba4\u9879\u76ee\u8bbe\u7f6e\u4e3a ",Object(c.b)("inlineCode",{parentName:"p"},"Fur.Database.Migrations")),Object(c.b)("img",{src:Object(i.a)("img/codefirst1.png")}),Object(c.b)("h3",{id:"92024-\u521b\u5efa\u6a21\u578b\u7248\u672c"},"9.20.2.4 \u521b\u5efa\u6a21\u578b\u7248\u672c"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration v1.0.0\n")),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},Object(c.b)("strong",{parentName:"p"},"v1.0.0")," \u662f\u6b64\u5904\u6570\u636e\u5e93\u66f4\u6539\u7684\u7248\u672c\u53f7\uff0c\u53ef\u4ee5\u5199\u4efb\u4f55\u5b57\u7b26\u4e32\uff0c\u4f46\u63a8\u8350\u5199\u7248\u672c\u53f7\uff0c\u6bcf\u6b21 ",Object(c.b)("strong",{parentName:"p"},"+1"),"\u3002"))),Object(c.b)("p",null,"\u6700\u7ec8\u547d\u4ee4\u5982\u4e0b\uff1a"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"PM> Add-Migration v1.0.0\nBuild started...\nBuild succeeded.\nMicrosoft.EntityFrameworkCore.Model.Validation[10400]\n Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data, this mode should only be enabled during development.\nMicrosoft.EntityFrameworkCore.Infrastructure[10403]\n Entity Framework Core 5.0.0-rc.1.20451.13 initialized 'FurDbContext' using provider 'Microsoft.EntityFrameworkCore.Sqlite' with options: SensitiveDataLoggingEnabled DetailedErrorsEnabled MaxPoolSize=100 MigrationsAssembly=Fur.Database.Migrations\nTo undo this action, use Remove-Migration.\nPM>\n")),Object(c.b)("p",null,"\u751f\u6210\u6210\u529f\u540e\uff0c",Object(c.b)("inlineCode",{parentName:"p"},"Fur.Database.Migrations")," \u9879\u76ee\u4e0b\u4f1a\u65b0\u589e ",Object(c.b)("inlineCode",{parentName:"p"},"Migrations")," \u6587\u4ef6\u5939\uff08\u5982\u679c\u6ca1\u6709\uff09\uff0c\u540c\u65f6\u672c\u6b21\u7684\u67b6\u6784\u751f\u6210\u6587\u4ef6\uff0c\u5982\uff1a"),Object(c.b)("img",{src:Object(i.a)("img/codefirst3.png")}),Object(c.b)("h3",{id:"92025-\u66f4\u65b0\u5230\u6570\u636e\u5e93"},"9.20.2.5 \u66f4\u65b0\u5230\u6570\u636e\u5e93"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database\n")),Object(c.b)("p",null,"\u6267\u884c\u8be5\u547d\u4ee4\u540e\uff0c\u6570\u636e\u5e93\u5c31\u4f1a\u81ea\u52a8\u6839\u636e\u6a21\u578b\u751f\u6210\u5bf9\u4e8e\u7684\u8868\u3002"),Object(c.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u5982\u679c ",Object(c.b)("inlineCode",{parentName:"p"},"Update-Database")," \u540e\u9762\u5e26\u5b57\u7b26\u4e32\u53c2\u6570\uff0c\u5219\u4f1a\u81ea\u52a8\u8fd8\u539f\u6570\u636e\u5e93\u5230\u6307\u5b9a\u7248\u672c\uff0c\u5982\uff1a"),Object(c.b)("pre",{parentName:"div"},Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database v0.0.3\n")),Object(c.b)("p",{parentName:"div"},"\u5c06\u6570\u636e\u5e93\u8fd8\u539f\u5230 ",Object(c.b)("inlineCode",{parentName:"p"},"v0.0.3")," \u7248\u672c"))),Object(c.b)("h2",{id:"9203-\u66f4\u65b0\u6a21\u578b"},"9.20.3 \u66f4\u65b0\u6a21\u578b"),Object(c.b)("p",null,"\u5982\u679c\u6a21\u578b\u6539\u53d8\u4e86\uff0c\u91cd\u590d\u4e0a\u9762\u64cd\u4f5c\u5373\u53ef\uff0c\u5982\uff1a"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Add-Migration v1.0.1\n")),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Update-Database\n")),Object(c.b)("h2",{id:"9204-\u5bfc\u51fa-sql"},"9.20.4 \u5bfc\u51fa ",Object(c.b)("inlineCode",{parentName:"h2"},"Sql")),Object(c.b)("p",null,"\u6709\u4e9b\u65f6\u5019\uff0c\u6211\u4eec\u6ca1\u6709\u76f4\u63a5\u66f4\u65b0\u6570\u636e\u5e93\u7684\u6743\u9650\uff0c\u6216\u8005\u6015\u51fa\u95ee\u9898\uff0c\u6211\u4eec\u90fd\u4f1a\u5148\u751f\u6210 ",Object(c.b)("inlineCode",{parentName:"p"},"Sql")," \u770b\u770b\uff0c\u8fd9\u65f6\u5019\u53ea\u9700\u8981\u901a\u8fc7 ",Object(c.b)("inlineCode",{parentName:"p"},"Script-Migration")," \u5bfc\u51fa\u5373\u53ef\uff0c\u5982\uff1a"),Object(c.b)("pre",null,Object(c.b)("code",Object(a.a)({parentName:"pre"},{className:"language-shell"}),"Script-Migration\n")),Object(c.b)("img",{src:Object(i.a)("img/codefirst2.png")}),Object(c.b)("h2",{id:"9205-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.20.5 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(c.b)("hr",null),Object(c.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(c.b)("h5",{parentName:"div"},Object(c.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(c.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(c.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(c.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(c.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(c.b)("inlineCode",{parentName:"p"},"\u6b63\u5411\u5de5\u5382")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(c.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli"}),"EF Core - \u7ba1\u7406\u6570\u636e\u5e93\u67b6\u6784")," \u7ae0\u8282\u3002"))))}l.isMDXComponent=!0},142:function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return u}));var a=n(0),r=n.n(a);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=r.a.createContext({}),d=function(e){var t=r.a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=d(e.components);return r.a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.a.createElement(r.a.Fragment,{},t)}},m=r.a.forwardRef((function(e,t){var n=e.components,a=e.mdxType,c=e.originalType,i=e.parentName,s=b(e,["components","mdxType","originalType","parentName"]),l=d(n),m=a,u=l["".concat(i,".").concat(m)]||l[m]||p[m]||c;return n?r.a.createElement(u,o(o({ref:t},s),{},{components:n})):r.a.createElement(u,o({ref:t},s))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var c=n.length,i=new Array(c);i[0]=m;var o={};for(var b in t)hasOwnProperty.call(t,b)&&(o[b]=t[b]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var s=2;sfunction(e,t,n,{forcePrependBaseUrl:a=!1,absolute:c=!1}={}){if(!n)return n;if(n.startsWith("#"))return n;if(Object(r.b)(n))return n;if(a)return t+n;const i=n.startsWith(t)?n:t+n.replace(/^\//,"");return c?e+i:i}(t,e,n,a)}}function i(e,t={}){const{withBaseUrl:n}=c();return n(e,t)}},145:function(e,t,n){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function r(e){return void 0!==e&&!a(e)}n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return r}))}}]); \ No newline at end of file diff --git a/docs/b0be1305.06a3f89a.js b/docs/b0be1305.f704cfc2.js similarity index 100% rename from docs/b0be1305.06a3f89a.js rename to docs/b0be1305.f704cfc2.js diff --git a/docs/b30e5fe3.41db337f.js b/docs/b30e5fe3.41db337f.js deleted file mode 100644 index d688b33baed..00000000000 --- a/docs/b30e5fe3.41db337f.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[57],{112:function(e,t,r){"use strict";r.r(t),r.d(t,"frontMatter",(function(){return a})),r.d(t,"metadata",(function(){return c})),r.d(t,"rightToc",(function(){return u})),r.d(t,"default",(function(){return b}));var n=r(2),o=r(6),i=(r(0),r(142)),a=(r(144),{id:"author",title:"1.2 \u5173\u4e8e\u4f5c\u8005",sidebar_label:"1.2 \u5173\u4e8e\u4f5c\u8005"}),c={unversionedId:"author",id:"author",isDocsHomePage:!1,title:"1.2 \u5173\u4e8e\u4f5c\u8005",description:"\u4e92\u8054\u7f51\u8d26\u53f7",source:"@site/docs\\author.mdx",slug:"/author",permalink:"/docs/author",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/author.mdx",version:"current",sidebar_label:"1.2 \u5173\u4e8e\u4f5c\u8005",sidebar:"docs",previous:{title:"1.1 \u4ecb\u7ecd",permalink:"/docs/"},next:{title:"1.3 \u6e90\u7801\u7ed3\u6784",permalink:"/docs/source"}},u=[{value:"\u4e92\u8054\u7f51\u8d26\u53f7",id:"\u4e92\u8054\u7f51\u8d26\u53f7",children:[]},{value:"\u6280\u672f\u80fd\u529b",id:"\u6280\u672f\u80fd\u529b",children:[]},{value:"\u804c\u4e1a\u60c5\u51b5",id:"\u804c\u4e1a\u60c5\u51b5",children:[]},{value:"\u5174\u8da3\u7231\u597d",id:"\u5174\u8da3\u7231\u597d",children:[]},{value:"\u4e2a\u4eba\u4e3b\u9875",id:"\u4e2a\u4eba\u4e3b\u9875",children:[]}],l={rightToc:u};function b(e){var t=e.components,r=Object(o.a)(e,["components"]);return Object(i.b)("wrapper",Object(n.a)({},l,r,{components:t,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"\u4e92\u8054\u7f51\u8d26\u53f7"},"\u4e92\u8054\u7f51\u8d26\u53f7"),Object(i.b)("ul",null,Object(i.b)("li",{parentName:"ul"},"\u767e\u5c0f\u50e7"),Object(i.b)("li",{parentName:"ul"},"Monk/MonkSoul")),Object(i.b)("h2",{id:"\u6280\u672f\u80fd\u529b"},"\u6280\u672f\u80fd\u529b"),Object(i.b)("p",null,"\u81ea 2008 \u5e74 \u63a5\u89e6 IT \u8fd9\u4e2a\u884c\u4e1a\u4e5f\u6709\u5341\u4f59\u5e74\u4e86\uff0c\u5728 \u540e\u7aef\uff08",Object(i.b)("inlineCode",{parentName:"p"},".NET/.NET Core/Java/PHP"),"\uff09\u3001\u79fb\u52a8\u7aef\uff08",Object(i.b)("inlineCode",{parentName:"p"},"Xamarin/\u5c0f\u7a0b\u5e8f/Java/Objective-C"),"\uff09\u3001\u684c\u9762\u7aef\uff08",Object(i.b)("inlineCode",{parentName:"p"},"WinForm/WPF/Electron"),"\uff09\u3001\u524d\u7aef\uff08",Object(i.b)("inlineCode",{parentName:"p"},"React/Vue/Angular/Node"),"\uff09\u7b49\u4e3b\u6d41\u9886\u57df\u7565\u77e5\u4e00\u4e8c\u3002"),Object(i.b)("p",null,"\u540c\u65f6\u5728\u6280\u672f\u57f9\u8bad\u9886\u57df\u4e5f\u591a\u6709\u6d89\u8db3\u3002"),Object(i.b)("h2",{id:"\u804c\u4e1a\u60c5\u51b5"},"\u804c\u4e1a\u60c5\u51b5"),Object(i.b)("p",null,"\u76ee\u524d\u7ecf\u8425\u4e00\u5bb6\u81ea\u5df1\u521b\u529e\u7684\u8f6f\u4ef6\u79d1\u6280\u516c\u53f8\uff0c\u4e3b\u8981\u9500\u552e\u81ea\u4e3b\u7814\u53d1\u7684 ERP \u4ea7\u54c1\u3002"),Object(i.b)("p",null,"\u5403\u4e0d\u8d77\u996d\u7684\u65f6\u5019\u4e5f\u4f1a\u63a5\u5916\u5305\u9879\u76ee\u3002"),Object(i.b)("h2",{id:"\u5174\u8da3\u7231\u597d"},"\u5174\u8da3\u7231\u597d"),Object(i.b)("p",null,"\u662f\u4e2a\u5403\u8d27\uff0c\u559c\u6b22\u770b\u6296\u97f3\uff0c\u770b\u52a8\u6f2b\uff0c\u770b\u7f8e\u5267\uff0c\u770b\u535a\u5ba2\u56ed\u3001\u770b\u5f00\u6e90\u4e2d\u56fd\u3002"),Object(i.b)("p",null,"\u5bf9\u65b0\u6280\u672f\u9887\u611f\u5174\u8da3\uff0c\u559c\u6b22\u5f00\u6e90\u4e8b\u4e1a\uff0c\u559c\u6b22\u5206\u4eab\u6280\u672f\u3002"),Object(i.b)("h2",{id:"\u4e2a\u4eba\u4e3b\u9875"},"\u4e2a\u4eba\u4e3b\u9875"),Object(i.b)("p",null,Object(i.b)("a",Object(n.a)({parentName:"p"},{href:"https://gitee.com/monksoul"}),"https://gitee.com/monksoul")),Object(i.b)("p",null,Object(i.b)("a",Object(n.a)({parentName:"p"},{href:"https://github.com/monksoul"}),"https://github.com/monksoul")))}b.isMDXComponent=!0},142:function(e,t,r){"use strict";r.d(t,"a",(function(){return p})),r.d(t,"b",(function(){return f}));var n=r(0),o=r.n(n);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=o.a.createContext({}),b=function(e){var t=o.a.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},p=function(e){var t=b(e.components);return o.a.createElement(l.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},d=o.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,a=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),p=b(r),d=n,f=p["".concat(a,".").concat(d)]||p[d]||s[d]||i;return r?o.a.createElement(f,c(c({ref:t},l),{},{components:r})):o.a.createElement(f,c({ref:t},l))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,a=new Array(i);a[0]=d;var c={};for(var u in t)hasOwnProperty.call(t,u)&&(c[u]=t[u]);c.originalType=e,c.mdxType="string"==typeof e?e:n,a[1]=c;for(var l=2;l=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=o.a.createContext({}),b=function(e){var t=o.a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=b(e.components);return o.a.createElement(l.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},d=o.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,c=e.originalType,a=e.parentName,l=u(e,["components","mdxType","originalType","parentName"]),p=b(n),d=r,f=p["".concat(a,".").concat(d)]||p[d]||s[d]||c;return n?o.a.createElement(f,i(i({ref:t},l),{},{components:n})):o.a.createElement(f,i({ref:t},l))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var c=n.length,a=new Array(c);a[0]=d;var i={};for(var u in t)hasOwnProperty.call(t,u)&&(i[u]=t[u]);i.originalType=e,i.mdxType="string"==typeof e?e:r,a[1]=i;for(var l=2;lfunction(e,t,n,{forcePrependBaseUrl:r=!1,absolute:c=!1}={}){if(!n)return n;if(n.startsWith("#"))return n;if(Object(o.b)(n))return n;if(r)return t+n;const a=n.startsWith(t)?n:t+n.replace(/^\//,"");return c?e+a:a}(t,e,n,r)}}function a(e,t={}){const{withBaseUrl:n}=c();return n(e,t)}},145:function(e,t,n){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function o(e){return void 0!==e&&!r(e)}n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return o}))}}]); \ No newline at end of file diff --git a/docs/b80c29d5.100571d2.js b/docs/b80c29d5.051540d5.js similarity index 100% rename from docs/b80c29d5.100571d2.js rename to docs/b80c29d5.051540d5.js diff --git a/docs/blog/index.html b/docs/blog/index.html index 0a082974d4a..12fca56c4b8 100644 --- a/docs/blog/index.html +++ b/docs/blog/index.html @@ -5,27 +5,39 @@ Blog | Fur - - - - - - - - - + + + + + + + + + + + + + + +

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下极易入门、极速开发的 Web 应用框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

- - - - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/blog/tags/fur/index.html b/docs/blog/tags/fur/index.html index 5f7a80a9d26..57afa501d55 100644 --- a/docs/blog/tags/fur/index.html +++ b/docs/blog/tags/fur/index.html @@ -5,27 +5,39 @@ Posts tagged "fur" | Fur - - - - - - - - + + + + + + + + + + + + + +

1 post tagged with "fur"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下极易入门、极速开发的 Web 应用框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

- - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/blog/tags/furos/index.html b/docs/blog/tags/furos/index.html index bbf41fc04b3..c57478417ac 100644 --- a/docs/blog/tags/furos/index.html +++ b/docs/blog/tags/furos/index.html @@ -5,27 +5,39 @@ Posts tagged "furos" | Fur - - - - - - - - - + + + + + + + + + + + + + + +

1 post tagged with "furos"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下极易入门、极速开发的 Web 应用框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

- - - - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/blog/tags/index.html b/docs/blog/tags/index.html index b030411d33f..ddfa7ee8023 100644 --- a/docs/blog/tags/index.html +++ b/docs/blog/tags/index.html @@ -5,23 +5,35 @@ Tags | Fur - - - - - - + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/blog/tags/net-5/index.html b/docs/blog/tags/net-5/index.html index cba0919f0d3..99287c11195 100644 --- a/docs/blog/tags/net-5/index.html +++ b/docs/blog/tags/net-5/index.html @@ -5,27 +5,39 @@ Posts tagged ".net5" | Fur - - - - - - - - + + + + + + + + + + + + + +

1 post tagged with ".net5"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下极易入门、极速开发的 Web 应用框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

- - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/blog/tags/net/index.html b/docs/blog/tags/net/index.html index 5f7cb74f3dd..e19e43009e0 100644 --- a/docs/blog/tags/net/index.html +++ b/docs/blog/tags/net/index.html @@ -5,27 +5,39 @@ Posts tagged ".net" | Fur - - - - - - - - + + + + + + + + + + + + + +

1 post tagged with ".net"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下极易入门、极速开发的 Web 应用框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

- - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/blog/tags/netcore/index.html b/docs/blog/tags/netcore/index.html index 742d7aa9dda..b5a81e6ec70 100644 --- a/docs/blog/tags/netcore/index.html +++ b/docs/blog/tags/netcore/index.html @@ -5,27 +5,39 @@ Posts tagged ".netcore" | Fur - - - - - - - - + + + + + + + + + + + + + +

1 post tagged with ".netcore"

View All Tags

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下极易入门、极速开发的 Web 应用框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

- - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/blog/welcome/index.html b/docs/blog/welcome/index.html index 1a301e0e53d..46aea4ba837 100644 --- a/docs/blog/welcome/index.html +++ b/docs/blog/welcome/index.html @@ -5,25 +5,37 @@ Fur 介绍 | Fur - - - - - - - - + + + + + + + + + + + + + +
-

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下极易入门、极速开发的 Web 应用框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-2020.10.10
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-2020.10.10 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-2020.10.10

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor

- - - - - - - - +

Fur 介绍

dotnet中国

dotnet中国

为中国 .NET 开发者提供优质的资讯和技术分享。

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下极易入门、极速开发的 Web 应用框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-2020.10.13
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-2020.10.13 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-2020.10.13

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor

+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/c456980b.530a8035.js b/docs/c456980b.bfa3e0aa.js similarity index 100% rename from docs/c456980b.530a8035.js rename to docs/c456980b.bfa3e0aa.js diff --git a/docs/cb0a942e.ba8927ad.js b/docs/cb0a942e.b51b137c.js similarity index 100% rename from docs/cb0a942e.ba8927ad.js rename to docs/cb0a942e.b51b137c.js diff --git a/docs/ccc49370.0b963bc5.js b/docs/ccc49370.0b963bc5.js new file mode 100644 index 00000000000..ddcb07b481e --- /dev/null +++ b/docs/ccc49370.0b963bc5.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[61,11],{141:function(e,t,a){"use strict";a.r(t);var n=a(0),l=a.n(n),i=a(153),r=a(161),c=a(152);var s=function(e){const{nextItem:t,prevItem:a}=e;return l.a.createElement("nav",{className:"pagination-nav","aria-label":"Blog post page navigation"},l.a.createElement("div",{className:"pagination-nav__item"},a&&l.a.createElement(c.a,{className:"pagination-nav__link",to:a.permalink},l.a.createElement("div",{className:"pagination-nav__sublabel"},"Newer Post"),l.a.createElement("div",{className:"pagination-nav__label"},"\xab ",a.title))),l.a.createElement("div",{className:"pagination-nav__item pagination-nav__item--next"},t&&l.a.createElement(c.a,{className:"pagination-nav__link",to:t.permalink},l.a.createElement("div",{className:"pagination-nav__sublabel"},"Older Post"),l.a.createElement("div",{className:"pagination-nav__label"},t.title," \xbb"))))},o=a(164);t.default=function(e){const{content:t}=e,{frontMatter:a,metadata:n}=t,{title:c,description:m,nextItem:d,prevItem:v,editUrl:u}=n,{hide_table_of_contents:g}=a;return l.a.createElement(i.a,{title:c,description:m},t&&l.a.createElement("div",{className:"container margin-vert--lg"},l.a.createElement("div",{className:"row"},l.a.createElement("div",{className:"col col--8 col--offset-2"},l.a.createElement(r.a,{frontMatter:a,metadata:n,isBlogPostPage:!0},l.a.createElement(t,null)),l.a.createElement("div",null,u&&l.a.createElement("a",{href:u,target:"_blank",rel:"noreferrer noopener"},l.a.createElement("svg",{fill:"currentColor",height:"1.2em",width:"1.2em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 40 40",style:{marginRight:"0.3em",verticalAlign:"sub"}},l.a.createElement("g",null,l.a.createElement("path",{d:"m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"}))),"Edit this page")),(d||v)&&l.a.createElement("div",{className:"margin-vert--xl"},l.a.createElement(s,{nextItem:d,prevItem:v}))),!g&&t.rightToc&&l.a.createElement("div",{className:"col col--2"},l.a.createElement(o.a,{headings:t.rightToc})))))}},154:function(e,t,a){"use strict";var n=a(151);a.d(t,"a",(function(){return n.a}))},164:function(e,t,a){"use strict";var n=a(0),l=a.n(n);var i=function(e,t,a){const[l,i]=Object(n.useState)(void 0);Object(n.useEffect)(()=>{let n,r;function c(){const c=function(){let e=0,t=null;for(n=document.getElementsByClassName("anchor");e=0&&i<=a&&(t=l),e+=1}return t}();if(c){let a=0,n=!1;for(r=document.getElementsByClassName(e);a{document.removeEventListener("scroll",c),document.removeEventListener("resize",c)}})},r=a(48),c=a.n(r);const s="table-of-contents__link";function o({headings:e,isChild:t}){return e.length?l.a.createElement("ul",{className:t?"":"table-of-contents table-of-contents__left-border"},e.map(e=>l.a.createElement("li",{key:e.id},l.a.createElement("a",{href:"#"+e.id,className:s,dangerouslySetInnerHTML:{__html:e.value}}),l.a.createElement(o,{isChild:!0,headings:e.children})))):null}t.a=function({headings:e}){return i(s,"table-of-contents__link--active",100),l.a.createElement("div",{className:c.a.tableOfContents},l.a.createElement(o,{headings:e}))}}}]); \ No newline at end of file diff --git a/docs/ccc49370.3426e43a.js b/docs/ccc49370.3426e43a.js deleted file mode 100644 index d4172d081dd..00000000000 --- a/docs/ccc49370.3426e43a.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[61],{141:function(e,a,t){"use strict";t.r(a);var n=t(0),r=t.n(n),l=t(153),m=t(156),i=t(151);var c=function(e){var a=e.nextItem,t=e.prevItem;return r.a.createElement("nav",{className:"pagination-nav","aria-label":"Blog post page navigation"},r.a.createElement("div",{className:"pagination-nav__item"},t&&r.a.createElement(i.a,{className:"pagination-nav__link",to:t.permalink},r.a.createElement("div",{className:"pagination-nav__sublabel"},"Newer Post"),r.a.createElement("div",{className:"pagination-nav__label"},"\xab ",t.title))),r.a.createElement("div",{className:"pagination-nav__item pagination-nav__item--next"},a&&r.a.createElement(i.a,{className:"pagination-nav__link",to:a.permalink},r.a.createElement("div",{className:"pagination-nav__sublabel"},"Older Post"),r.a.createElement("div",{className:"pagination-nav__label"},a.title," \xbb"))))},o=t(162);a.default=function(e){var a=e.content,t=a.frontMatter,n=a.metadata,i=n.title,s=n.description,u=n.nextItem,d=n.prevItem,v=n.editUrl,g=t.hide_table_of_contents;return r.a.createElement(l.a,{title:i,description:s},a&&r.a.createElement("div",{className:"container margin-vert--lg"},r.a.createElement("div",{className:"row"},r.a.createElement("div",{className:"col col--8 col--offset-2"},r.a.createElement(m.a,{frontMatter:t,metadata:n,isBlogPostPage:!0},r.a.createElement(a,null)),r.a.createElement("div",null,v&&r.a.createElement("a",{href:v,target:"_blank",rel:"noreferrer noopener"},r.a.createElement("svg",{fill:"currentColor",height:"1.2em",width:"1.2em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 40 40",style:{marginRight:"0.3em",verticalAlign:"sub"}},r.a.createElement("g",null,r.a.createElement("path",{d:"m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"}))),"Edit this page")),(u||d)&&r.a.createElement("div",{className:"margin-vert--xl"},r.a.createElement(c,{nextItem:u,prevItem:d}))),!g&&a.rightToc&&r.a.createElement("div",{className:"col col--2"},r.a.createElement(o.a,{headings:a.rightToc})))))}},154:function(e,a,t){"use strict";var n=t(152);t.d(a,"a",(function(){return n.a}))},156:function(e,a,t){"use strict";var n=t(0),r=t.n(n),l=t(146),m=t(142),i=t(155),c=t(151),o=t(159),s=t(144),u=t(48),d=t.n(u),v=["January","February","March","April","May","June","July","August","September","October","November","December"];a.a=function(e){var a,t,n,u,g,E=e.children,h=e.frontMatter,p=e.metadata,f=e.truncated,_=e.isBlogPostPage,b=void 0!==_&&_,N=p.date,k=p.permalink,w=p.tags,y=p.readingTime,I=h.author,x=h.title,M=h.image,L=h.keywords,C=h.author_url||h.authorURL,O=h.author_title||h.authorTitle,P=h.author_image_url||h.authorImageURL,R=Object(s.a)(M,{absolute:!0});return r.a.createElement(r.a.Fragment,null,r.a.createElement(i.a,null,L&&L.length&&r.a.createElement("meta",{name:"keywords",content:L.join(",")}),M&&r.a.createElement("meta",{property:"og:image",content:R}),M&&r.a.createElement("meta",{property:"twitter:image",content:R}),M&&r.a.createElement("meta",{name:"twitter:image:alt",content:"Image for "+x})),r.a.createElement("article",{className:b?void 0:"margin-bottom--xl"},(a=b?"h1":"h2",t=N.substring(0,10).split("-"),n=t[0],u=v[parseInt(t[1],10)-1],g=parseInt(t[2],10),r.a.createElement("header",null,r.a.createElement(a,{className:Object(l.a)("margin-bottom--sm",d.a.blogPostTitle)},b?x:r.a.createElement(c.a,{to:k},x)),r.a.createElement("div",{className:"margin-vert--md"},r.a.createElement("time",{dateTime:N,className:d.a.blogPostDate},u," ",g,", ",n," ",y&&r.a.createElement(r.a.Fragment,null," \xb7 ",Math.ceil(y)," min read"))),r.a.createElement("div",{className:"avatar margin-vert--md"},P&&r.a.createElement("a",{className:"avatar__photo-link avatar__photo",href:C,target:"_blank",rel:"noreferrer noopener"},r.a.createElement("img",{src:P,alt:I})),r.a.createElement("div",{className:"avatar__intro"},I&&r.a.createElement(r.a.Fragment,null,r.a.createElement("h4",{className:"avatar__name"},r.a.createElement("a",{href:C,target:"_blank",rel:"noreferrer noopener"},I)),r.a.createElement("small",{className:"avatar__subtitle"},O)))))),r.a.createElement("section",{className:"markdown"},r.a.createElement(m.a,{components:o.a},E)),(w.length>0||f)&&r.a.createElement("footer",{className:"row margin-vert--lg"},w.length>0&&r.a.createElement("div",{className:"col"},r.a.createElement("strong",null,"Tags:"),w.map((function(e){var a=e.label,t=e.permalink;return r.a.createElement(c.a,{key:t,className:"margin-horiz--sm",to:t},a)}))),f&&r.a.createElement("div",{className:"col text--right"},r.a.createElement(c.a,{to:p.permalink,"aria-label":"Read more about "+x},r.a.createElement("strong",null,"Read More"))))))}},162:function(e,a,t){"use strict";var n=t(0),r=t.n(n);var l=function(e,a,t){var r=Object(n.useState)(void 0),l=r[0],m=r[1];Object(n.useEffect)((function(){var n,r;function i(){var i=function(){var e=0,a=null;for(n=document.getElementsByClassName("anchor");e=0&&l<=t&&(a=r),e+=1}return a}();if(i){var c=0,o=!1;for(r=document.getElementsByClassName(e);c=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=a.a.createContext({}),u=function(e){var t=a.a.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):b(b({},t),e)),r},l=function(e){var t=u(e.components);return a.a.createElement(p.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},m=a.a.forwardRef((function(e,t){var r=e.components,n=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),l=u(r),m=n,O=l["".concat(c,".").concat(m)]||l[m]||s[m]||o;return r?a.a.createElement(O,b(b({ref:t},p),{},{components:r})):a.a.createElement(O,b({ref:t},p))}));function O(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var o=r.length,c=new Array(o);c[0]=m;var b={};for(var i in t)hasOwnProperty.call(t,i)&&(b[i]=t[i]);b.originalType=e,b.mdxType="string"==typeof e?e:n,c[1]=b;for(var p=2;p=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=a.a.createContext({}),u=function(e){var t=a.a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):b(b({},t),e)),n},l=function(e){var t=u(e.components);return a.a.createElement(p.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.a.createElement(a.a.Fragment,{},t)}},m=a.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),l=u(n),m=r,O=l["".concat(c,".").concat(m)]||l[m]||s[m]||o;return n?a.a.createElement(O,b(b({ref:t},p),{},{components:n})):a.a.createElement(O,b({ref:t},p))}));function O(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,c=new Array(o);c[0]=m;var b={};for(var i in t)hasOwnProperty.call(t,i)&&(b[i]=t[i]);b.originalType=e,b.mdxType="string"==typeof e?e:r,c[1]=b;for(var p=2;pfunction(e,t,n,{forcePrependBaseUrl:r=!1,absolute:o=!1}={}){if(!n)return n;if(n.startsWith("#"))return n;if(Object(a.b)(n))return n;if(r)return t+n;const c=n.startsWith(t)?n:t+n.replace(/^\//,"");return o?e+c:c}(t,e,n,r)}}function c(e,t={}){const{withBaseUrl:n}=o();return n(e,t)}},145:function(e,t,n){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return a}))}}]); \ No newline at end of file diff --git a/docs/d3ee75d5.89d8c15a.js b/docs/d3ee75d5.44c18a13.js similarity index 100% rename from docs/d3ee75d5.89d8c15a.js rename to docs/d3ee75d5.44c18a13.js diff --git a/docs/d43b3010.eaa01519.js b/docs/d43b3010.30d52cd3.js similarity index 100% rename from docs/d43b3010.eaa01519.js rename to docs/d43b3010.30d52cd3.js diff --git a/docs/d80bb0e0.35e8ea68.js b/docs/d80bb0e0.8acf41d2.js similarity index 100% rename from docs/d80bb0e0.35e8ea68.js rename to docs/d80bb0e0.8acf41d2.js diff --git a/docs/d8c8d2dc.1ab280a0.js b/docs/d8c8d2dc.2041bc52.js similarity index 100% rename from docs/d8c8d2dc.1ab280a0.js rename to docs/d8c8d2dc.2041bc52.js diff --git a/docs/d8f92c54.6ec458d9.js b/docs/d8f92c54.ddc0a31f.js similarity index 100% rename from docs/d8f92c54.6ec458d9.js rename to docs/d8f92c54.ddc0a31f.js diff --git a/docs/dc10b9c8.92049b15.js b/docs/dc10b9c8.05bc6c75.js similarity index 100% rename from docs/dc10b9c8.92049b15.js rename to docs/dc10b9c8.05bc6c75.js diff --git a/docs/dea2fede.c67f06e6.js b/docs/dea2fede.dbba7be7.js similarity index 53% rename from docs/dea2fede.c67f06e6.js rename to docs/dea2fede.dbba7be7.js index c4302058142..0a154d1dcaf 100644 --- a/docs/dea2fede.c67f06e6.js +++ b/docs/dea2fede.dbba7be7.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[72],{126:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return l})),t.d(n,"metadata",(function(){return s})),t.d(n,"rightToc",(function(){return b})),t.d(n,"default",(function(){return d}));var a=t(2),r=t(6),o=(t(0),t(142)),i=(t(144),t(149)),c=t(150),l={id:"tran",title:"9.25 \u4e8b\u52a1\u548c\u5de5\u4f5c\u5355\u5143",sidebar_label:"9.25 \u4e8b\u52a1\u548c\u5de5\u4f5c\u5355\u5143"},s={unversionedId:"tran",id:"tran",isDocsHomePage:!1,title:"9.25 \u4e8b\u52a1\u548c\u5de5\u4f5c\u5355\u5143",description:"9.25.1 \u4e8b\u52a1",source:"@site/docs\\tran.mdx",slug:"/tran",permalink:"/docs/tran",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/tran.mdx",version:"current",sidebar_label:"9.25 \u4e8b\u52a1\u548c\u5de5\u4f5c\u5355\u5143",sidebar:"docs",previous:{title:"9.24 \u6570\u636e\u5e93\u64cd\u4f5c\u62e6\u622a\u5668",permalink:"/docs/dbcontext-Interceptor"},next:{title:"9.26 \u8bfb\u5199\u5206\u79bb/\u4e3b\u4ece\u590d\u5236",permalink:"/docs/dbcontext-read-write"}},b=[{value:"9.25.1 \u4e8b\u52a1",id:"9251-\u4e8b\u52a1",children:[]},{value:"9.25.2 \u5de5\u4f5c\u5355\u5143",id:"9252-\u5de5\u4f5c\u5355\u5143",children:[]},{value:"9.25.3 \u5982\u4f55\u4f7f\u7528",id:"9253-\u5982\u4f55\u4f7f\u7528",children:[{value:"9.25.3.1 \u81ea\u52a8\u7ba1\u7406",id:"92531-\u81ea\u52a8\u7ba1\u7406",children:[]},{value:"9.25.3.2 \u624b\u52a8\u7ba1\u7406",id:"92532-\u624b\u52a8\u7ba1\u7406",children:[]}]},{value:"9.25.4 \u5de5\u4f5c\u5355\u5143\u7279\u6027\u8bf4\u660e",id:"9254-\u5de5\u4f5c\u5355\u5143\u7279\u6027\u8bf4\u660e",children:[{value:"9.25.4.1 [UnitOfWork]",id:"92541-unitofwork",children:[]},{value:"9.25.4.2 [NonTransact]",id:"92542-nontransact",children:[]}]},{value:"9.25.5 \u5e38\u89c1\u9519\u8bef",id:"9255-\u5e38\u89c1\u9519\u8bef",children:[]},{value:"9.25.6 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9256-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],u={rightToc:b};function d(e){var n=e.components,t=Object(r.a)(e,["components"]);return Object(o.b)("wrapper",Object(a.a)({},u,t,{components:n,mdxType:"MDXLayout"}),Object(o.b)("h2",{id:"9251-\u4e8b\u52a1"},"9.25.1 \u4e8b\u52a1"),Object(o.b)("p",null,"\u4e8b\u52a1\u6307\u4f5c\u4e3a\u5355\u4e2a\u903b\u8f91\u5de5\u4f5c\u5355\u5143\u6267\u884c\u7684\u4e00\u7cfb\u5217\u64cd\u4f5c\uff0c\u8981\u4e48",Object(o.b)("strong",{parentName:"p"},"\u5b8c\u5168\u5730\u6267\u884c\uff0c\u8981\u4e48\u5b8c\u5168\u5730\u4e0d\u6267\u884c"),"\u3002"),Object(o.b)("p",null,"\u7b80\u5355\u7684\u8bf4\uff0c\u4e8b\u52a1\u5c31\u662f\u5e76\u53d1\u63a7\u5236\u7684\u5355\u4f4d\uff0c\u662f\u7528\u6237\u5b9a\u4e49\u7684\u4e00\u4e2a\u64cd\u4f5c\u5e8f\u5217\u3002 \u800c\u4e00\u4e2a\u903b\u8f91\u5de5\u4f5c\u5355\u5143\u8981\u6210\u4e3a\u4e8b\u52a1\uff0c\u5c31\u5fc5\u987b\u6ee1\u8db3 ",Object(o.b)("inlineCode",{parentName:"p"},"ACID")," \u5c5e\u6027\u3002"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"A"),"\uff1a\u539f\u5b50\u6027\uff08Atomicity\uff09\uff1a\u4e8b\u52a1\u4e2d\u7684\u64cd\u4f5c\u8981\u4e48\u90fd\u4e0d\u505a\uff0c\u8981\u4e48\u5c31\u5168\u505a"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"C"),"\uff1a\u4e00\u81f4\u6027\uff08Consistency\uff09\uff1a\u4e8b\u52a1\u6267\u884c\u7684\u7ed3\u679c\u5fc5\u987b\u662f\u4ece\u6570\u636e\u5e93\u4ece\u4e00\u4e2a\u4e00\u81f4\u6027\u72b6\u6001\u8f6c\u6362\u5230\u53e6\u4e00\u4e2a\u4e00\u81f4\u6027\u72b6\u6001"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"I"),"\uff1a\u9694\u79bb\u6027\uff08Isolation\uff09\uff1a\u4e00\u4e2a\u4e8b\u52a1\u7684\u6267\u884c\u4e0d\u80fd\u88ab\u5176\u4ed6\u4e8b\u52a1\u5e72\u6270"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"D"),"\uff1a\u6301\u4e45\u6027\uff08Durability\uff09\uff1a\u4e00\u4e2a\u4e8b\u52a1\u4e00\u65e6\u63d0\u4ea4\uff0c\u5b83\u5bf9\u6570\u636e\u5e93\u4e2d\u6570\u636e\u7684\u6539\u53d8\u5c31\u5e94\u8be5\u662f\u6c38\u4e45\u6027\u7684")),Object(o.b)("p",null,Object(o.b)("strong",{parentName:"p"},"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(o.b)("inlineCode",{parentName:"strong"},"Fur")," \u6846\u67b6\u4e3a\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u5f00\u542f\u4e86\u5206\u5e03\u5f0f\u4e8b\u52a1\uff0c\u4fdd\u8bc1\u4e86\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u662f\u4e00\u4e2a\u5b8c\u6574\u7684 ",Object(o.b)("inlineCode",{parentName:"strong"},"\u5de5\u4f5c\u5355\u5143")),"\u3002\u5f53\u7136\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u624b\u52a8\u7ba1\u7406\u4e8b\u52a1\u3002"),Object(o.b)("h2",{id:"9252-\u5de5\u4f5c\u5355\u5143"},"9.25.2 \u5de5\u4f5c\u5355\u5143"),Object(o.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u5c31\u662f\u4e3a\u4e86\u4fdd\u8bc1\u4e00\u6b21\u5b8c\u6574\u7684\u529f\u80fd\u64cd\u4f5c\u6240\u4ea7\u751f\u7684\u4e00\u4e9b\u5217\u63d0\u4ea4\u6570\u636e\u7684\u5b8c\u6574\u6027\uff0c\u8d77\u7740\u4e8b\u52a1\u7684\u4f5c\u7528\u3002\u5728\u8ba1\u7b97\u673a\u9886\u57df\u4e2d\uff0c\u5de5\u4f5c\u5355\u5143\u901a\u5e38\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"UnitOfWork")," \u540d\u79f0\u8868\u793a\u3002"),Object(o.b)("p",null,"\u901a\u5e38\u6211\u4eec\u4fdd\u8bc1\u7528\u6237\u7684\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u662f\u5904\u4e8e\u5728\u4e00\u4e2a\u529f\u80fd\u5355\u5143\u4e2d\uff0c\u4e5f\u5c31\u662f\u5de5\u4f5c\u5355\u5143\u3002"),Object(o.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u5de5\u4f5c\u5355\u5143\u65e0\u9700\u6211\u4eec\u624b\u52a8\u7ef4\u62a4\uff0c\u6846\u67b6\u4f1a\u81ea\u52a8\u4fdd\u8bc1\u4e86\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u662f\u4e00\u4e2a ",Object(o.b)("inlineCode",{parentName:"p"},"\u5de5\u4f5c\u5355\u5143"),"\uff0c\u8981\u4e48\u540c\u65f6\u6210\u529f\uff0c\u8981\u4e48\u540c\u65f6\u5931\u8d25\u3002"),Object(o.b)("h2",{id:"9253-\u5982\u4f55\u4f7f\u7528"},"9.25.3 \u5982\u4f55\u4f7f\u7528"),Object(o.b)("h3",{id:"92531-\u81ea\u52a8\u7ba1\u7406"},"9.25.3.1 \u81ea\u52a8\u7ba1\u7406"),Object(o.b)("p",null,"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u5de5\u4f5c\u5355\u5143\u65e0\u9700\u6211\u4eec\u624b\u52a8\u7ef4\u62a4\uff0c\u6846\u67b6\u4f1a\u81ea\u52a8\u4fdd\u8bc1\u4e86\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u662f\u4e00\u4e2a ",Object(o.b)("inlineCode",{parentName:"p"},"\u5de5\u4f5c\u5355\u5143"),"\uff0c\u8981\u4e48\u540c\u65f6\u6210\u529f\uff0c\u8981\u4e48\u540c\u65f6\u5931\u8d25\u3002\u6240\u4ee5\u65e0\u9700\u64cd\u4f5c\u3002"),Object(o.b)("h3",{id:"92532-\u624b\u52a8\u7ba1\u7406"},"9.25.3.2 \u624b\u52a8\u7ba1\u7406"),Object(o.b)(i.a,{defaultValue:"one",values:[{label:"\u793a\u4f8b\u4e00",value:"one"},{label:"\u793a\u4f8b\u4e8c",value:"two"},{label:"\u793a\u4f8b\u4e09",value:"three"}],mdxType:"Tabs"},Object(o.b)(c.a,{value:"one",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u5f00\u542f\u4e8b\u52a1\nusing (var transaction = _testRepository.Database.BeginTransaction())\n{\n try\n {\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/dotnet" });\n _testRepository.SaveChanges();\n\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/visualstudio" });\n _testRepository.SaveChanges();\n\n var blogs = _testRepository.Entity\n .OrderBy(b => b.Url)\n .ToList();\n\n // \u63d0\u4ea4\u4e8b\u52a1\n transaction.Commit();\n }\n catch (Exception)\n {\n // \u56de\u6eda\u4e8b\u52a1\n transaction.RollBack();\n }\n}\n'))),Object(o.b)(c.a,{value:"two",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var options = new DbContextOptionsBuilder()\n .UseSqlServer(new SqlConnection(connectionString))\n .Options;\n\n// \u521b\u5efa\u8fde\u63a5\u5b57\u7b26\u4e32\nusing (var context1 = new HoaDbContext(options))\n{\n // \u5f00\u542f\u4e8b\u52a1\n using (var transaction = context1.Database.BeginTransaction())\n {\n try\n {\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/dotnet" });\n _testRepository.SaveChanges();\n\n context1.Blogs.Add(new Blog { Url = "http://blogs.msdn.com/dotnet" });\n context1.SaveChanges();\n\n // \u521b\u5efa\u65b0\u7684\u8fde\u63a5\u5bf9\u8c61\n using (var context2 = new HoaDbContext(options))\n {\n // \u5171\u4eab\u8fde\u63a5\u4e8b\u52a1\n context2.Database.UseTransaction(transaction.GetDbTransaction());\n\n var blogs = context2.Blogs\n .OrderBy(b => b.Url)\n .ToList();\n }\n\n // \u63d0\u4ea4\u4e8b\u52a1\n transaction.Commit();\n }\n catch (Exception)\n {\n // \u56de\u6eda\u4e8b\u52a1\n transaction.RollBack();\n }\n }\n}\n'))),Object(o.b)(c.a,{value:"three",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u5f00\u542f\u5206\u5e03\u5f0f\u4e8b\u52a1\nusing (var scope = new TransactionScope(\n TransactionScopeOption.Required,\n new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }))\n{\n using (var connection = new SqlConnection(connectionString))\n {\n connection.Open();\n\n try\n {\n // \u8fd9\u91cc\u662f Ado.NET \u64cd\u4f5c\n var command = connection.CreateCommand();\n command.CommandText = "DELETE FROM dbo.Blogs";\n command.ExecuteNonQuery();\n\n // \u521b\u5efaEF Core \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\n var options = new DbContextOptionsBuilder()\n .UseSqlServer(connection)\n .Options;\n using (var context = new BloggingContext(options))\n {\n context.Blogs.Add(new Blog { Url = "http://blogs.msdn.com/dotnet" });\n context.SaveChanges();\n }\n\n // \u6846\u67b6\u5c01\u88c5\u7684\u4ed3\u50a8\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/dotnet" });\n _testRepository.SaveChanges();\n\n // \u63d0\u4ea4\u4e8b\u52a1\n scope.Complete();\n }\n catch (System.Exception)\n {\n // \u81ea\u52a8\u56de\u6eda\n }\n }\n}\n')))),Object(o.b)("h2",{id:"9254-\u5de5\u4f5c\u5355\u5143\u7279\u6027\u8bf4\u660e"},"9.25.4 \u5de5\u4f5c\u5355\u5143\u7279\u6027\u8bf4\u660e"),Object(o.b)("h3",{id:"92541-unitofwork"},"9.25.4.1 ",Object(o.b)("inlineCode",{parentName:"h3"},"[UnitOfWork]")),Object(o.b)("p",null,Object(o.b)("inlineCode",{parentName:"p"},"[UnitOfWork]")," \u7279\u6027\u7528\u6765\u6807\u8bb0\u4e8b\u52a1\u4fe1\u606f\uff0c\u5982\u4f5c\u7528\u8303\u56f4\uff0c\u9694\u79bb\u7ea7\u522b\u7b49\u3002"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"Enabled"),"\uff1a\u662f\u5426\u542f\u52a8\u5de5\u4f5c\u5355\u5143\uff0c\u9ed8\u8ba4 ",Object(o.b)("inlineCode",{parentName:"li"},"true")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"ScopeOption"),"\uff1a\u5b9a\u4e49\u4e8b\u52a1\u8303\u56f4\u884c\u4e3a\uff0c\u9ed8\u8ba4 ",Object(o.b)("inlineCode",{parentName:"li"},"TransactionScopeOption.Required")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IsolationLevel"),"\uff1a\u8bbe\u7f6e\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\uff0c\u9ed8\u8ba4 ",Object(o.b)("inlineCode",{parentName:"li"},"IsolationLevel.ReadCommitted"),";"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"AsyncFlowOption"),"\uff1a\u5141\u8bb8\u8de8\u7ebf\u7a0b\u8fde\u7eed\u4efb\u52a1\u7684\u4e8b\u52a1\u6d41\uff0c\u5982\u6709\u5f02\u6b65\u64cd\u4f5c\u9700\u5f00\u542f\u8be5\u9009\u9879\uff0c\u9ed8\u8ba4\u5f00\u542f")),Object(o.b)("div",{className:"admonition admonition-important alert alert--info"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u4e00\u65e6\u65b9\u6cd5\u8d34\u4e86 ",Object(o.b)("inlineCode",{parentName:"p"},"[UnitOfWork(false)]")," \u7279\u6027\u540e\uff0c\u90a3\u4e48\u8be5\u65b9\u6cd5\u4e0d\u518d\u542f\u7528\u5de5\u4f5c\u5355\u5143\u6a21\u5f0f\uff0c\u4e5f\u5c31\u662f\u4e0d\u5305\u542b\u4e8b\u52a1\uff0c\u4e5f\u4e0d\u4f1a\u81ea\u52a8\u63d0\u4ea4\u6570\u636e\u5e93\u3002\u614e\u7528!"))),Object(o.b)("h3",{id:"92542-nontransact"},"9.25.4.2 ",Object(o.b)("inlineCode",{parentName:"h3"},"[NonTransact]")),Object(o.b)("p",null,"\u4e00\u4f46\u65b9\u6cd5\u6216\u7c7b\u8d34\u4e86 ",Object(o.b)("inlineCode",{parentName:"p"},"[NonTransact]")," \u7279\u6027\uff0c\u90a3\u4e48",Object(o.b)("strong",{parentName:"p"},"\u5c06\u5173\u95ed\u4e8b\u52a1\u64cd\u4f5c\uff0c\u4f46\u662f\u8fd8\u662f\u4f1a\u81ea\u52a8\u4fdd\u5b58\u6570\u636e\u5e93\u5230\u6570\u636e\u3002")),Object(o.b)("h2",{id:"9255-\u5e38\u89c1\u9519\u8bef"},"9.25.5 \u5e38\u89c1\u9519\u8bef"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"A TransactionScope must be disposed on the same thread that it was created."))),Object(o.b)("p",null,"\u53ea\u9700\u8981\u5728\u5f53\u524d\u64cd\u4f5c\u65b9\u6cd5\u4e0a\u8d34 ",Object(o.b)("inlineCode",{parentName:"p"},"[NonTransact]")," \u7279\u6027\u5373\u53ef\u3002"),Object(o.b)("h2",{id:"9256-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.25.6 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(o.b)("hr",null),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(o.b)("inlineCode",{parentName:"p"},"\u4e8b\u52a1")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/ef/core/saving/transactions"}),"EF Core - \u4f7f\u7528\u4e8b\u52a1")," \u7ae0\u8282\u3002"))))}d.isMDXComponent=!0},142:function(e,n,t){"use strict";t.d(n,"a",(function(){return u})),t.d(n,"b",(function(){return m}));var a=t(0),r=t.n(a);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function c(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=r.a.createContext({}),b=function(e){var n=r.a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},u=function(e){var n=b(e.components);return r.a.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.a.createElement(r.a.Fragment,{},n)}},p=r.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=b(t),p=a,m=u["".concat(i,".").concat(p)]||u[p]||d[p]||o;return t?r.a.createElement(m,c(c({ref:n},s),{},{components:t})):r.a.createElement(m,c({ref:n},s))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,i=new Array(o);i[0]=p;var c={};for(var l in n)hasOwnProperty.call(n,l)&&(c[l]=n[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var s=2;s[UnitOfWork]",id:"92541-unitofwork",children:[]},{value:"9.25.4.2 [NonTransact]",id:"92542-nontransact",children:[]}]},{value:"9.25.5 \u5e38\u89c1\u9519\u8bef",id:"9255-\u5e38\u89c1\u9519\u8bef",children:[]},{value:"9.25.6 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"9256-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],d={rightToc:b};function p(e){var n=e.components,t=Object(o.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},d,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"9251-\u4e8b\u52a1"},"9.25.1 \u4e8b\u52a1"),Object(r.b)("p",null,"\u4e8b\u52a1\u6307\u4f5c\u4e3a\u5355\u4e2a\u903b\u8f91\u5de5\u4f5c\u5355\u5143\u6267\u884c\u7684\u4e00\u7cfb\u5217\u64cd\u4f5c\uff0c\u8981\u4e48",Object(r.b)("strong",{parentName:"p"},"\u5b8c\u5168\u5730\u6267\u884c\uff0c\u8981\u4e48\u5b8c\u5168\u5730\u4e0d\u6267\u884c"),"\u3002"),Object(r.b)("p",null,"\u7b80\u5355\u7684\u8bf4\uff0c\u4e8b\u52a1\u5c31\u662f\u5e76\u53d1\u63a7\u5236\u7684\u5355\u4f4d\uff0c\u662f\u7528\u6237\u5b9a\u4e49\u7684\u4e00\u4e2a\u64cd\u4f5c\u5e8f\u5217\u3002 \u800c\u4e00\u4e2a\u903b\u8f91\u5de5\u4f5c\u5355\u5143\u8981\u6210\u4e3a\u4e8b\u52a1\uff0c\u5c31\u5fc5\u987b\u6ee1\u8db3 ",Object(r.b)("inlineCode",{parentName:"p"},"ACID")," \u5c5e\u6027\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"A"),"\uff1a\u539f\u5b50\u6027\uff08Atomicity\uff09\uff1a\u4e8b\u52a1\u4e2d\u7684\u64cd\u4f5c\u8981\u4e48\u90fd\u4e0d\u505a\uff0c\u8981\u4e48\u5c31\u5168\u505a"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"C"),"\uff1a\u4e00\u81f4\u6027\uff08Consistency\uff09\uff1a\u4e8b\u52a1\u6267\u884c\u7684\u7ed3\u679c\u5fc5\u987b\u662f\u4ece\u6570\u636e\u5e93\u4ece\u4e00\u4e2a\u4e00\u81f4\u6027\u72b6\u6001\u8f6c\u6362\u5230\u53e6\u4e00\u4e2a\u4e00\u81f4\u6027\u72b6\u6001"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"I"),"\uff1a\u9694\u79bb\u6027\uff08Isolation\uff09\uff1a\u4e00\u4e2a\u4e8b\u52a1\u7684\u6267\u884c\u4e0d\u80fd\u88ab\u5176\u4ed6\u4e8b\u52a1\u5e72\u6270"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"D"),"\uff1a\u6301\u4e45\u6027\uff08Durability\uff09\uff1a\u4e00\u4e2a\u4e8b\u52a1\u4e00\u65e6\u63d0\u4ea4\uff0c\u5b83\u5bf9\u6570\u636e\u5e93\u4e2d\u6570\u636e\u7684\u6539\u53d8\u5c31\u5e94\u8be5\u662f\u6c38\u4e45\u6027\u7684")),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c",Object(r.b)("inlineCode",{parentName:"strong"},"Fur")," \u6846\u67b6\u4e3a\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u5f00\u542f\u4e86\u5206\u5e03\u5f0f\u4e8b\u52a1\uff0c\u4fdd\u8bc1\u4e86\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u662f\u4e00\u4e2a\u5b8c\u6574\u7684 ",Object(r.b)("inlineCode",{parentName:"strong"},"\u5de5\u4f5c\u5355\u5143")),"\u3002\u5f53\u7136\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u624b\u52a8\u7ba1\u7406\u4e8b\u52a1\u3002"),Object(r.b)("h2",{id:"9252-\u5de5\u4f5c\u5355\u5143"},"9.25.2 \u5de5\u4f5c\u5355\u5143"),Object(r.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u5c31\u662f\u4e3a\u4e86\u4fdd\u8bc1\u4e00\u6b21\u5b8c\u6574\u7684\u529f\u80fd\u64cd\u4f5c\u6240\u4ea7\u751f\u7684\u4e00\u4e9b\u5217\u63d0\u4ea4\u6570\u636e\u7684\u5b8c\u6574\u6027\uff0c\u8d77\u7740\u4e8b\u52a1\u7684\u4f5c\u7528\u3002\u5728\u8ba1\u7b97\u673a\u9886\u57df\u4e2d\uff0c\u5de5\u4f5c\u5355\u5143\u901a\u5e38\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"UnitOfWork")," \u540d\u79f0\u8868\u793a\u3002"),Object(r.b)("p",null,"\u901a\u5e38\u6211\u4eec\u4fdd\u8bc1\u7528\u6237\u7684\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u662f\u5904\u4e8e\u5728\u4e00\u4e2a\u529f\u80fd\u5355\u5143\u4e2d\uff0c\u4e5f\u5c31\u662f\u5de5\u4f5c\u5355\u5143\u3002"),Object(r.b)("p",null,"\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u5de5\u4f5c\u5355\u5143\u65e0\u9700\u6211\u4eec\u624b\u52a8\u7ef4\u62a4\uff0c\u6846\u67b6\u4f1a\u81ea\u52a8\u4fdd\u8bc1\u4e86\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u662f\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"\u5de5\u4f5c\u5355\u5143"),"\uff0c\u8981\u4e48\u540c\u65f6\u6210\u529f\uff0c\u8981\u4e48\u540c\u65f6\u5931\u8d25\u3002"),Object(r.b)("h2",{id:"9253-\u5982\u4f55\u4f7f\u7528"},"9.25.3 \u5982\u4f55\u4f7f\u7528"),Object(r.b)("h3",{id:"92531-\u81ea\u52a8\u7ba1\u7406"},"9.25.3.1 \u81ea\u52a8\u7ba1\u7406"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u5de5\u4f5c\u5355\u5143\u65e0\u9700\u6211\u4eec\u624b\u52a8\u7ef4\u62a4\uff0c\u6846\u67b6\u4f1a\u81ea\u52a8\u4fdd\u8bc1\u4e86\u6bcf\u4e00\u6b21\u8bf7\u6c42\u90fd\u662f\u4e00\u4e2a ",Object(r.b)("inlineCode",{parentName:"p"},"\u5de5\u4f5c\u5355\u5143"),"\uff0c\u8981\u4e48\u540c\u65f6\u6210\u529f\uff0c\u8981\u4e48\u540c\u65f6\u5931\u8d25\u3002\u6240\u4ee5\u65e0\u9700\u64cd\u4f5c\u3002"),Object(r.b)("h3",{id:"92532-\u624b\u52a8\u7ba1\u7406"},"9.25.3.2 \u624b\u52a8\u7ba1\u7406"),Object(r.b)(i.a,{defaultValue:"one",values:[{label:"\u793a\u4f8b\u4e00",value:"one"},{label:"\u793a\u4f8b\u4e8c",value:"two"},{label:"\u793a\u4f8b\u4e09",value:"three"}],mdxType:"Tabs"},Object(r.b)(c.a,{value:"one",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u5f00\u542f\u4e8b\u52a1\nusing (var transaction = _testRepository.Database.BeginTransaction())\n{\n try\n {\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/dotnet" });\n _testRepository.SaveChanges();\n\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/visualstudio" });\n _testRepository.SaveChanges();\n\n var blogs = _testRepository.Entity\n .OrderBy(b => b.Url)\n .ToList();\n\n // \u63d0\u4ea4\u4e8b\u52a1\n transaction.Commit();\n }\n catch (Exception)\n {\n // \u56de\u6eda\u4e8b\u52a1\n transaction.RollBack();\n }\n}\n'))),Object(r.b)(c.a,{value:"two",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var options = new DbContextOptionsBuilder()\n .UseSqlServer(new SqlConnection(connectionString))\n .Options;\n\n// \u521b\u5efa\u8fde\u63a5\u5b57\u7b26\u4e32\nusing (var context1 = new HoaDbContext(options))\n{\n // \u5f00\u542f\u4e8b\u52a1\n using (var transaction = context1.Database.BeginTransaction())\n {\n try\n {\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/dotnet" });\n _testRepository.SaveChanges();\n\n context1.Blogs.Add(new Blog { Url = "http://blogs.msdn.com/dotnet" });\n context1.SaveChanges();\n\n // \u521b\u5efa\u65b0\u7684\u8fde\u63a5\u5bf9\u8c61\n using (var context2 = new HoaDbContext(options))\n {\n // \u5171\u4eab\u8fde\u63a5\u4e8b\u52a1\n context2.Database.UseTransaction(transaction.GetDbTransaction());\n\n var blogs = context2.Blogs\n .OrderBy(b => b.Url)\n .ToList();\n }\n\n // \u63d0\u4ea4\u4e8b\u52a1\n transaction.Commit();\n }\n catch (Exception)\n {\n // \u56de\u6eda\u4e8b\u52a1\n transaction.RollBack();\n }\n }\n}\n'))),Object(r.b)(c.a,{value:"three",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'// \u5f00\u542f\u5206\u5e03\u5f0f\u4e8b\u52a1\nusing (var scope = new TransactionScope(\n TransactionScopeOption.Required,\n new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }))\n{\n using (var connection = new SqlConnection(connectionString))\n {\n connection.Open();\n\n try\n {\n // \u8fd9\u91cc\u662f Ado.NET \u64cd\u4f5c\n var command = connection.CreateCommand();\n command.CommandText = "DELETE FROM dbo.Blogs";\n command.ExecuteNonQuery();\n\n // \u521b\u5efaEF Core \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\n var options = new DbContextOptionsBuilder()\n .UseSqlServer(connection)\n .Options;\n using (var context = new BloggingContext(options))\n {\n context.Blogs.Add(new Blog { Url = "http://blogs.msdn.com/dotnet" });\n context.SaveChanges();\n }\n\n // \u6846\u67b6\u5c01\u88c5\u7684\u4ed3\u50a8\n _testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/dotnet" });\n _testRepository.SaveChanges();\n\n // \u63d0\u4ea4\u4e8b\u52a1\n scope.Complete();\n }\n catch (System.Exception)\n {\n // \u81ea\u52a8\u56de\u6eda\n }\n }\n}\n')))),Object(r.b)("h2",{id:"9254-\u5de5\u4f5c\u5355\u5143\u7279\u6027\u8bf4\u660e"},"9.25.4 \u5de5\u4f5c\u5355\u5143\u7279\u6027\u8bf4\u660e"),Object(r.b)("h3",{id:"92541-unitofwork"},"9.25.4.1 ",Object(r.b)("inlineCode",{parentName:"h3"},"[UnitOfWork]")),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"[UnitOfWork]")," \u7279\u6027\u7528\u6765\u6807\u8bb0\u4e8b\u52a1\u4fe1\u606f\uff0c\u5982\u4f5c\u7528\u8303\u56f4\uff0c\u9694\u79bb\u7ea7\u522b\u7b49\u3002"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Enabled"),"\uff1a\u662f\u5426\u542f\u52a8\u5de5\u4f5c\u5355\u5143\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"true")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"ScopeOption"),"\uff1a\u5b9a\u4e49\u4e8b\u52a1\u8303\u56f4\u884c\u4e3a\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"TransactionScopeOption.Required")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"IsolationLevel"),"\uff1a\u8bbe\u7f6e\u4e8b\u52a1\u9694\u79bb\u7ea7\u522b\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"IsolationLevel.ReadCommitted"),";"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"AsyncFlowOption"),"\uff1a\u5141\u8bb8\u8de8\u7ebf\u7a0b\u8fde\u7eed\u4efb\u52a1\u7684\u4e8b\u52a1\u6d41\uff0c\u5982\u6709\u5f02\u6b65\u64cd\u4f5c\u9700\u5f00\u542f\u8be5\u9009\u9879\uff0c\u9ed8\u8ba4\u5f00\u542f")),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u6ce8\u610f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u4e00\u65e6\u65b9\u6cd5\u8d34\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"[UnitOfWork(false)]")," \u7279\u6027\u540e\uff0c\u90a3\u4e48\u8be5\u65b9\u6cd5\u4e0d\u518d\u542f\u7528\u5de5\u4f5c\u5355\u5143\u6a21\u5f0f\uff0c\u4e5f\u5c31\u662f\u4e0d\u5305\u542b\u4e8b\u52a1\uff0c\u4e5f\u4e0d\u4f1a\u81ea\u52a8\u63d0\u4ea4\u6570\u636e\u5e93\u3002\u614e\u7528!"))),Object(r.b)("h3",{id:"92542-nontransact"},"9.25.4.2 ",Object(r.b)("inlineCode",{parentName:"h3"},"[NonTransact]")),Object(r.b)("p",null,"\u4e00\u4f46\u65b9\u6cd5\u6216\u7c7b\u8d34\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"[NonTransact]")," \u7279\u6027\uff0c\u90a3\u4e48",Object(r.b)("strong",{parentName:"p"},"\u5c06\u5173\u95ed\u4e8b\u52a1\u64cd\u4f5c\uff0c\u4f46\u662f\u8fd8\u662f\u4f1a\u81ea\u52a8\u4fdd\u5b58\u6570\u636e\u5e93\u5230\u6570\u636e\u3002")),Object(r.b)("h2",{id:"9255-\u5e38\u89c1\u9519\u8bef"},"9.25.5 \u5e38\u89c1\u9519\u8bef"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"A TransactionScope must be disposed on the same thread that it was created."))),Object(r.b)("p",null,"\u53ea\u9700\u8981\u5728\u5f53\u524d\u64cd\u4f5c\u65b9\u6cd5\u4e0a\u8d34 ",Object(r.b)("inlineCode",{parentName:"p"},"[NonTransact]")," \u7279\u6027\u5373\u53ef\u3002"),Object(r.b)("h2",{id:"9256-\u53cd\u9988\u4e0e\u5efa\u8bae"},"9.25.6 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(r.b)("hr",null),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(r.b)("inlineCode",{parentName:"p"},"\u4e8b\u52a1")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/ef/core/saving/transactions"}),"EF Core - \u4f7f\u7528\u4e8b\u52a1")," \u7ae0\u8282\u3002"))))}p.isMDXComponent=!0},142:function(e,n,t){"use strict";t.d(n,"a",(function(){return d})),t.d(n,"b",(function(){return m}));var a=t(0),o=t.n(a);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function c(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=o.a.createContext({}),b=function(e){var n=o.a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},d=function(e){var n=b(e.components);return o.a.createElement(s.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return o.a.createElement(o.a.Fragment,{},n)}},u=o.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,i=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=b(t),u=a,m=d["".concat(i,".").concat(u)]||d[u]||p[u]||r;return t?o.a.createElement(m,c(c({ref:n},s),{},{components:t})):o.a.createElement(m,c({ref:n},s))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=u;var c={};for(var l in n)hasOwnProperty.call(n,l)&&(c[l]=n[l]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var s=2;sfunction(e,n,t,{forcePrependBaseUrl:a=!1,absolute:r=!1}={}){if(!t)return t;if(t.startsWith("#"))return t;if(Object(o.b)(t))return t;if(a)return n+t;const i=t.startsWith(n)?t:n+t.replace(/^\//,"");return r?e+i:i}(n,e,t,a)}}function i(e,n={}){const{withBaseUrl:t}=r();return t(e,n)}},145:function(e,n,t){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function o(e){return void 0!==e&&!a(e)}t.d(n,"b",(function(){return a})),t.d(n,"a",(function(){return o}))},146:function(e,n,t){"use strict";function a(e){var n,t,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;nn.value===e)&&j(e)}const h=e=>{j(e),null!=p&&m(p,e)},g=[],N=e=>{e.metaKey||e.altKey||e.ctrlKey||f(!0)},y=()=>{f(!1)};return Object(a.useEffect)(()=>{window.addEventListener("keydown",N),window.addEventListener("mousedown",y)},[]),o.a.createElement("div",null,o.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(i.a)("tabs",{"tabs--block":n})},d.map(({value:e,label:n})=>o.a.createElement("li",{role:"tab",tabIndex:0,"aria-selected":O===e,className:Object(i.a)("tabs__item",l.a.tabItem,{"tabs__item--active":O===e}),style:v?{}:{outline:"none"},key:e,ref:e=>g.push(e),onKeyDown:e=>{((e,n,t)=>{switch(t.keyCode){case b:((e,n)=>{const t=e.indexOf(n)+1;e[t]?e[t].focus():e[0].focus()})(e,n);break;case s:((e,n)=>{const t=e.indexOf(n)-1;e[t]?e[t].focus():e[e.length-1].focus()})(e,n)}})(g,e.target,e),N(e)},onFocus:()=>h(e),onClick:()=>{h(e),f(!1)},onPointerDown:()=>f(!1)},n))),o.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(t).filter(e=>e.props.value===O)[0]))}},150:function(e,n,t){"use strict";var a=t(0),o=t.n(a);n.a=function(e){return o.a.createElement("div",null,e.children)}}}]); \ No newline at end of file diff --git a/docs/docs/answer/index.html b/docs/docs/answer/index.html index bec3e97b42c..4e812e358f2 100644 --- a/docs/docs/answer/index.html +++ b/docs/docs/answer/index.html @@ -5,31 +5,41 @@ 29.1 常见问题 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/appstartup/index.html b/docs/docs/appstartup/index.html index 1e033617da4..11e7179cfa0 100644 --- a/docs/docs/appstartup/index.html +++ b/docs/docs/appstartup/index.html @@ -5,17 +5,22 @@ 3. 应用启动 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -47,16 +52,21 @@
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.Inject()
.UseStartup<Startup>();
});
}
}
}
Fur.Web.Entry\Startup.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace Fur.Web.Entry
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
}
}
}
Startup.cs 代码迁移

只需要将 ConfigureServicesConfigure 方法代码迁移到 FurWebCoreStartup.cs 中即可,而 Startup.cs 中两个方法留空即可。

非常简单吧。我们后续创建任何 MVCRazorPagesBlazor 项目只需要添加 Fur.Web.Core 引用和调用 Inject() 即可。

3.7 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/auth-control/index.html b/docs/docs/auth-control/index.html index 87bd4ccdec0..0d8906fd6b8 100644 --- a/docs/docs/auth-control/index.html +++ b/docs/docs/auth-control/index.html @@ -5,31 +5,41 @@ 14. 安全鉴权 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/author/index.html b/docs/docs/author/index.html index 250988939d0..6de8ca98020 100644 --- a/docs/docs/author/index.html +++ b/docs/docs/author/index.html @@ -5,31 +5,41 @@ 1.2 关于作者 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +

1.2 关于作者

互联网账号

  • 百小僧
  • Monk/MonkSoul

技术能力

自 2008 年 接触 IT 这个行业也有十余年了,在 后端(.NET/.NET Core/Java/PHP)、移动端(Xamarin/小程序/Java/Objective-C)、桌面端(WinForm/WPF/Electron)、前端(React/Vue/Angular/Node)等主流领域略知一二。

同时在技术培训领域也多有涉足。

职业情况

目前经营一家自己创办的软件科技公司,主要销售自主研发的 ERP 产品。

吃不起饭的时候也会接外包项目。

兴趣爱好

是个吃货,喜欢看抖音,看动漫,看美剧,看博客园、看开源中国。

对新技术颇感兴趣,喜欢开源事业,喜欢分享技术。

个人主页

https://gitee.com/monksoul

https://github.com/monksoul

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/cache/index.html b/docs/docs/cache/index.html index 2a483dc92c3..6b40cc29eaa 100644 --- a/docs/docs/cache/index.html +++ b/docs/docs/cache/index.html @@ -5,31 +5,41 @@ 13. 分布式缓存 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/configuration/index.html b/docs/docs/configuration/index.html index b2b31d8605f..bf24a02eab5 100644 --- a/docs/docs/configuration/index.html +++ b/docs/docs/configuration/index.html @@ -5,32 +5,42 @@ 4.1 配置 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +

4.1 配置

温馨提示

推荐使用 《4.2 选项》代替本章节功能。(为什么)?

4.1.1 什么是配置

简单来说,配置将系统应用可动态调配的选项放在统一地方管理,通过不同的配置让系统做出动态调整。

ASP.NET Core 应用程序启动时默认加载 启动项目 下的 appsettings.json 作为应用配置。同时还支持不同的运行环境加载对应的配置文件,如:

  • Development:加载 appsettings.Development.json
  • Staging:加载 appsettings.Staging.json
  • {Environment}appsettings.{Environment}.json

4.1.2 配置的使用

假设我们需要在系统运行时获取系统名称、版本号及版权信息,这些信息可能随时变化而且需要在多个地方使用。这时就需要将这些信息配置起来。具体步骤如下:

4.1.2.1 配置 appsettings.json 信息

{
"AppInfo": {
"Name": "Fur",
"Version": "1.0.0",
"Company": "Baiqian"
}
}

4.1.2.2 读取 appsettings.json 信息

Fur 框架中,提供了两种读取方式:

  • 依赖注入 IConfiguration 对象读取
  • 通过 App.Configuration[jsonKey] 读取
using Microsoft.AspNetCore.Mvc;
namespace Fur.Web.Entry.Controllers
{
[Route("api/[controller]")]
public class DefaultController : ControllerBase
{
[HttpGet]
public string Get()
{
return $@"名称:{App.Configuration["AppInfo:Name"]},
版本:{App.Configuration["AppInfo:Version"]},
公司:{App.Configuration["AppInfo:Company"]}";
}
}
}
依赖注入的方式

通过依赖注入注入实例有几种方式:

  • 构造函数注入方式
private readonly IConfiguration _configuration;
public DefaultController(IConfiguration configuration)
{
_configuration = configuration;
}
  • 参数注入方式 [FromServices]
public string Get([FromServices] IConfiguration configuration)
{
}
  • 属性注入方式
public IConfiguration Configuration { get; set; }

想了解更多关于《ASP.NET Core - 依赖注入》 知识

4.1.2.3 如何选择读取方式

  • 在可依赖注入类中,依赖注入 IConfiguration 读取
  • 在静态类/非依赖注入类中,选择 App.Configuration[jsonKey] 读取

4.1.3 路径符 查找节点

ASP.NET Core 中,配置采用 : 分隔符来读取分层配置数据。如上述例子中的 AppInfo:Name。如有更多层级数据则只需要通过 : 进入下一层节点即可。

假设我们有以下配置信息:

{
"AppInfo": {
"Name": "Fur",
"Version": "1.0.0",
"Company": {
"Name": "Baiqian",
"Address": {
"City": "中国",
"Province": "广东省",
"Detail": "中山市东区紫马公园西门"
}
}
}
}
var companyName = App.Configuration["AppInfo:Name"]; // => Fur

4.1.4 自定义配置文件

大多情况下,我们的配置只需要在 appsettings.json 中配置即可,但一些特殊情况下,我们希望某些组件或功能拥有独立的配置,这个时候就需要用到自定义配置,Fur 目前支持 .json.xml 两种方式配置,如:

Fur.Web.Entry/emailsetting.json
{
"outlook": {
"smtp": {
"server": "smtp.office365.com",
"port": "587",
"ssl": "STARTTLS"
},
"pop": {
"server": "outlook.office365.com",
"port": "995",
"ssl": "TLS"
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<MyKey>MyXMLFile Value</MyKey>
<Position>
<Title>Title from MyXMLFile</Title>
<Name>Name from MyXMLFile</Name>
</Position>
<Logging>
<LogLevel>
<Default>Information</Default>
<Microsoft>Warning</Microsoft>
</LogLevel>
</Logging>
</configuration>
xml 配置事项

如果采用 xml 配置,那么文件名必须以 .config.xml 结尾(不区分大小写)。

同时 Fur 提供了非常灵活的方式支持自定义配置文件读取,如:

4.1.4.1 读取 emailsetting.json 配置

读取自定义配置文件和读取 appsettings.json 一致,系统会自动从多个配置文件中读取输入,如:

var smtpServer = App.Configuration["outlook:smtp:server"]; // => smtp.office365.com
特别说明

Fur 框架会在启动时自动扫描每一个项目层根目录下的 *.json*.xml 文件加入配置中。所以无需手工配置。

4.1.5 不同环境读取

在实际应用开发中,我们可能会根据不同的环境加载不同的配置文件,如 数据库连接字符串

这时我们只需要遵循特定命名规范 {name}.{Environment}.json 即可。如:

  • appsettings.Development.json
  • appsettings.Staging.json
  • appsettings.Production.json
  • emailsetting.Development.json
  • emailsetting.Staging.json
  • emailsetting.Production.json

这时,ASP.NET Core 会在应用启动时自动加载不同环境的配置文件。

4.1.6 配置更改通知(热更新

.NET Core 应用程序中,配置支持更改通知,也就是热更新操作。一旦监听到 appsetting.json 或自定义配置文件发生变动,就会触发 OnChange 方法。代码如下:

var appInfoConfiguration = App.Configuration["AppInfo"];
ChangeToken.OnChange(() => appInfoConfiguration.GetReloadToken(), () =>
{
var name = appInfoConfiguration["Name"]; // 实时的最新值
var version = appInfoConfiguration["Version"]; // 实时的最新值
});

4.1.7 配置的优缺点

  • 优点

    • 能够在系统运行时快速读取
    • 无需额外配置
  • 缺点

    • 存在重复读取
    • 通过硬编码字符串读取,容易出错
    • 不能设置默认值
    • 不能在运行环境中动态配置
    • 不能验证配置有效性
    • 不支持更改通知

4.1.8 配置使用场景

如果只需要一次性读取配置信息,则使用配置,否则应该使用 《4.2 选项》代替。

4.1.9 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 配置 知识可查阅 ASP.NET Core - 配置 章节。

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/contribute/index.html b/docs/docs/contribute/index.html index 18ce68bba7e..af6739ea0e2 100644 --- a/docs/docs/contribute/index.html +++ b/docs/docs/contribute/index.html @@ -5,31 +5,41 @@ 28. 贡献指南 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/cors/index.html b/docs/docs/cors/index.html index 05d65f01e17..9b1c5b09a79 100644 --- a/docs/docs/cors/index.html +++ b/docs/docs/cors/index.html @@ -5,31 +5,41 @@ 15. CORS 跨域 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/data-validation/index.html b/docs/docs/data-validation/index.html index 9444fb405b1..4b11a4af860 100644 --- a/docs/docs/data-validation/index.html +++ b/docs/docs/data-validation/index.html @@ -5,17 +5,22 @@ 8. 数据校验 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -68,16 +73,21 @@
["StrongPassword", "密码太简单了!!!"]
]
}
}
}
important

appsettings.json 中相同的 Key 或覆盖 IValidationMessageTypeProvider 提供相同 Key 的值。

错误消息查找优先级

DefaultErrorMessage -> IValidationMessageTypeProvider -> appsettings.json (低 -> 高)

8.9 模型验证范围

Fur 提供多种模型验证范围设置:

  • 全局验证(默认)
  • [NonValidation] 跳过验证
  • [TypeFilter(typeof(DataValidationFilter))] 局部验证
  • [ApiController] 控制器范围验证

8.9.1 全局验证

默认情况下,通过 .AddDataValidation() 注册数据验证服务已经启用了全局验证,如若不想启用全局验证,则传入 false 即可,如:.AddDataValidation(false)

8.9.2 [NonValidation] 跳过验证

可通过 [NonValidation] 贴在 控制器动作方法 中跳过全局验证或不需要验证

8.9.3 [TypeFilter(typeof(DataValidationFilter))] 局部验证

我们也可以无需注册 .AddDataValidation() 服务,直接在 动作方法 上贴 [TypeFilter(typeof(DataValidationFilter))] 可启用局部验证。如:

using Fur.DataValidation;
using Fur.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
namespace Fur.Application
{
public class FurAppService : IDynamicApiController
{
[TypeFilter(typeof(DataValidationFilter))]
public TestDto Post(TestDto testDto)
{
return testDto;
}
}
}

8.9.4 [ApiController] 控制器范围验证

[ApiController]Mvc 提供的控制器范围(含所有动作方法)的验证。

using Microsoft.AspNetCore.Mvc;
namespace Fur.Web.Entry.Controllers
{
[ApiController]
public class MvcController : Controller
{
public IActionResult Index()
{
return View();
}
}
}

8.10 MiniProfiler 查看

如下图所示:

8.10 多语言支持

文档整理中...

8.11 验证模型提供器

文档整理中...

8.12 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-Interceptor/index.html b/docs/docs/dbcontext-Interceptor/index.html index 6459e6bf609..749a640c048 100644 --- a/docs/docs/dbcontext-Interceptor/index.html +++ b/docs/docs/dbcontext-Interceptor/index.html @@ -5,17 +5,22 @@ 9.24 数据库操作拦截器 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -53,16 +58,21 @@
// 提交到数据库之后(异步)
public override ValueTask<int> SavedChangesAsync(SaveChangesCompletedEventData eventData, int result, CancellationToken cancellationToken = default)
{
return base.SavedChangesAsync(eventData, result, cancellationToken);
}
// 提交数据库失败
public override void SaveChangesFailed(DbContextErrorEventData eventData)
{
base.SaveChangesFailed(eventData);
}
// 提交数据库失败(异步)
public override Task SaveChangesFailedAsync(DbContextErrorEventData eventData, CancellationToken cancellationToken = default)
{
return base.SaveChangesFailedAsync(eventData, cancellationToken);
}
}
}

9.24.2.4 SavedChangesEvent 拦截

Fur 框架中为所有 AppDbContext 子类都提供了三个可重写的方法,这三个方法分别由三个事件触发:

  • 提交更改之前 SavingChanges 事件:触发 void SavingChangesEvent(object sender, SavingChangesEventArgs e) 方法
  • 提交更改之后 SavedChanges 事件:触发 void SavedChangesEvent(object sender, SavedChangesEventArgs e) 方法
  • 提交更改失败 SaveChangesFailed 事件:触发 void SaveChangesFailedEvent(object sender, SaveChangesFailedEventArgs e) 方法

通过这三个事件我们可以在数据库做增、删、改时候做拦截,比如设置创建时间、更新时间或其他默认操作

如自动添加租户Id:

protected override void SavingChangesEvent(object sender, SavingChangesEventArgs e)
{
// 获取当前事件对应上下文
var dbContext = sender as FurDbContext;
// 获取所有新增和更新的实体
var entities = dbContext.ChangeTracker.Entries()
.Where(u => u.State == EntityState.Added || u.State == EntityState.Modified);
foreach (var entity in entities)
{
switch (entity.State)
{
// 自动设置租户Id
case EntityState.Added:
entity.Property(nameof(Entity.TenantId)).CurrentValue = GetTenantId();
break;
// 排除租户Id
case EntityState.Modified:
entity.Property(nameof(Entity.TenantId)).IsModified = false;
break;
}
}
}

9.24.3 注册自定义过滤器

定义好过滤器之后,我们需要在数据库上下文中注册:

services.AddSqlitePool<FurDbContext>(interceptors: new IInterceptor[] {
new SqlConnectionProfilerInterceptor(),
new DbContextSaveChangesInterceptor(),
new SqlCommandProfilerInterceptor()
});

9.24.4 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-add-or-update/index.html b/docs/docs/dbcontext-add-or-update/index.html index 8051f1890f4..9865007656a 100644 --- a/docs/docs/dbcontext-add-or-update/index.html +++ b/docs/docs/dbcontext-add-or-update/index.html @@ -5,17 +5,22 @@ 9.7 新增或更新操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -98,16 +103,21 @@
// 示例六
await user.InsertOrUpdateExcludeNowAsync("Age", "Name");
// 示例七
await user.InsertOrUpdateExcludeNowAsync(new[] { u=>u.Name, u=>u.Age});
// 示例八
await user.InsertOrUpdateExcludeNowAsync(new[] {"Age", "Name"});

9.5.7 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-add/index.html b/docs/docs/dbcontext-add/index.html index 08a7cc27e8d..ed0fe09e397 100644 --- a/docs/docs/dbcontext-add/index.html +++ b/docs/docs/dbcontext-add/index.html @@ -5,17 +5,22 @@ 9.5 新增操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -49,16 +54,21 @@
// 示例一
await repository.InsertNowAsync(user, user2);
// 示例二
await repository.InsertNowAsync(new List<User> { user, user2 });
// 示例三
await repository.InsertNowAsync(new[] {user, user2 });
小知识

所有带 Now 结尾的表示立即提交到数据库,也就是立即调用 SaveChangesSaveChangesAsync

9.5.5 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-audit/index.html b/docs/docs/dbcontext-audit/index.html index 3c6ec0e7ce7..8a5fe8ecd97 100644 --- a/docs/docs/dbcontext-audit/index.html +++ b/docs/docs/dbcontext-audit/index.html @@ -5,17 +5,22 @@ 9.22 审计日志 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -33,16 +38,21 @@
// 获取现在的实体值
var newValue = currentValues[propName];
object oldValue = null;
// 如果是新增数据,则 databaseValues 为空,所以需要判断一下
if (databaseValues != null)
{
oldValue = databaseValues[propName];
}
// 插入审计日志表
dbContext.Audits.Add(new Audit
{
Table = entityType.Name, // 表名
Column = propName, // 更新的列
NewValue = newValue, // 新值
OldValue = oldValue, // 旧值
CreatedTime = DateTime.Now, // 操作时间
UserId = userId, // 操作人
Operate = entity.State.ToString(); // 操作方式:新增、更新、删除
});
}
}
}
}
}
小知识

如果对性能有所要求,那么建议审计日志通过 日志组件 写入数据库,如,通过 Nlog、Log4Net 这些等:

// 插入审计日志表
dbContext.Audits.Add(new Audit
{
Table = entityType.Name, // 表名
Column = propName, // 更新的列
newValue = newValue, // 新值
OldValue = oldValue, // 旧值
CreatedTime = DateTime.Now, // 操作时间
UserId = userId, // 操作人
Operate = entity.State.ToString(); // 操作方式:新增、更新、删除
});

替换为:

logger.Information(JsonConvert.SerializeObject(new Audit
{
Table = entityType.Name, // 表名
Column = propName, // 更新的列
newValue = newValue, // 新值
OldValue = oldValue, // 旧值
CreatedTime = DateTime.Now, // 操作时间
UserId = userId, // 操作人
Operate = entity.State.ToString(); // 操作方式:新增、更新、删除
}));

通过上面的例子,我们就可以对数据库所有的新增、更新、删除进行监控了。

9.22.4 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-batch/index.html b/docs/docs/dbcontext-batch/index.html index 5a6ef6b9f1d..a4f6f723044 100644 --- a/docs/docs/dbcontext-batch/index.html +++ b/docs/docs/dbcontext-batch/index.html @@ -5,17 +5,22 @@ 9.9 批量操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -28,16 +33,21 @@
// 批量清空表(慎用!!!!!)
repository.DbContext.Truncate<Entity>();
repository.DbContext.TruncateAsync<Entity>();

9.9.2.2 查询后批量操作

// 根据条件批量删除
repository.Where(a => a.ItemId > 500).BatchDelete();
await repository.Where(a => a.ItemId > 500).BatchDeleteAsync();
// 根据条件批量更新
repository.Where(a => a.ItemId <= 500).BatchUpdate(a => new Item { Quantity = a.Quantity + 100 });
repository.Where(a => a.ItemId <= 500).BatchUpdate(new Item { Description = "Updated" });
await repository.Where(a => a.ItemId <= 500).BatchUpdateAsync(new Item { Description = "Updated" });
// 批量更新指定列
var updateColumns = new List<string> { nameof(Item.Quantity) };
var q = repository.Where(a => a.ItemId <= 500);
int affected = q.BatchUpdate(new Item { Description = "Updated" }, updateColumns);

9.9.3 批量操作性能

Operations\Rows100,000 EF100,000 EFBulk1,000,000 EFBulk
Insert38.98 s2.10 s17.99 s
Update109.25 s3.96 s31.45 s
Delete7.26 s2.04 s12.18 s
---------------------------------------------------------------
Together70.70 s5.88 s56.84 s

9.9.4 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 EFCore.BulkExtensions 知识可查阅 EFCore.BulkExtensions 开源仓库

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-code-first/index.html b/docs/docs/dbcontext-code-first/index.html index 9aeaca75390..af423cd731f 100644 --- a/docs/docs/dbcontext-code-first/index.html +++ b/docs/docs/dbcontext-code-first/index.html @@ -5,17 +5,22 @@ 9.20 模型生成数据库 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -24,16 +29,21 @@
/// <summary>
/// 姓名
/// </summary>
[MaxLength(32)]
public string Name { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// 住址
/// </summary>
public string Address { get; set; }
}
}
实体约定

所有数据库实体必须直接或间接继承 IEntity 接口。

9.20.2.2 打开 程序包管理控制台

9.20.2.3 切换默认项目

程序包管理控制台 默认项目设置为 Fur.Database.Migrations

9.20.2.4 创建模型版本

Add-Migration v1.0.0
特别说明

v1.0.0 是此处数据库更改的版本号,可以写任何字符串,但推荐写版本号,每次 +1

最终命令如下:

PM> Add-Migration v1.0.0
Build started...
Build succeeded.
Microsoft.EntityFrameworkCore.Model.Validation[10400]
Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data, this mode should only be enabled during development.
Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 5.0.0-rc.1.20451.13 initialized 'FurDbContext' using provider 'Microsoft.EntityFrameworkCore.Sqlite' with options: SensitiveDataLoggingEnabled DetailedErrorsEnabled MaxPoolSize=100 MigrationsAssembly=Fur.Database.Migrations
To undo this action, use Remove-Migration.
PM>

生成成功后,Fur.Database.Migrations 项目下会新增 Migrations 文件夹(如果没有),同时本次的架构生成文件,如:

9.20.2.5 更新到数据库

Update-Database

执行该命令后,数据库就会自动根据模型生成对于的表。

小知识

如果 Update-Database 后面带字符串参数,则会自动还原数据库到指定版本,如:

Update-Database v0.0.3

将数据库还原到 v0.0.3 版本

9.20.3 更新模型

如果模型改变了,重复上面操作即可,如:

Add-Migration v1.0.1
Update-Database

9.20.4 导出 Sql

有些时候,我们没有直接更新数据库的权限,或者怕出问题,我们都会先生成 Sql 看看,这时候只需要通过 Script-Migration 导出即可,如:

Script-Migration

9.20.5 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 正向工厂 知识可查阅 EF Core - 管理数据库架构 章节。

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-db-first/index.html b/docs/docs/dbcontext-db-first/index.html index c1e4992e82e..3ebcccc76a3 100644 --- a/docs/docs/dbcontext-db-first/index.html +++ b/docs/docs/dbcontext-db-first/index.html @@ -5,17 +5,22 @@ 9.19 数据库生成模型 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -50,16 +55,21 @@
entityBuilder.Property(e => e.Name).HasMaxLength(32);
}
}
}
Fur Tools v1.0.0 全部实体生成成功!
PM>

9.13.4 命令参数配置

Fur Tools Cli 支持多个参数配置,使用方法只需要在命令后面添加即可,如:

&"../tools/cli.ps1" -Context 数据库上下文名 -ConnectionName 连接字符串Key

支持参数如下:

  • -Tables:配置要生成的数据库表,数组类型,如果为空,则生成数据库所有表和视图。如:-Tables Person,PersonDetails
  • -Context:配置数据库上下文,默认 FurDbContext,如果有多个数据库上下文,则此参数必须配置
  • -ConnectionName:配置数据库连接字符串,对于 appsetting.json 中的 Key
  • -OutputDir:生成实体代码输出目录,默认为:./Fur.Core/Entities/
  • -DbProvider:数据库提供器,默认是 Microsoft.EntityFrameworkCore.SqlServer,其他数据库请指定对应程序集
    • SqlServerMicrosoft.EntityFrameworkCore.SqlServer
    • SqliteMicrosoft.EntityFrameworkCore.Sqlite
    • CosmosMicrosoft.EntityFrameworkCore.Cosmos
    • InMemoryDatabaseMicrosoft.EntityFrameworkCore.InMemory
    • MySqlPomelo.EntityFrameworkCore.MySql
    • PostgreSQLNpgsql.EntityFrameworkCore.PostgreSQL
    • OracleCitms.EntityFrameworkCore.Oracle
    • DmMicrosoft.EntityFrameworkCore.Dm
  • -EntryProject:Web 启用项目层名,默认 Fur.Web.Entry
  • -CoreProject:实体项目层名,默认 Fur.Core
  • -DbContextLocators:多数据库上下文定位器,默认 MasterDbContextLocator,支持多个,如:MasterDbContextLocator,MySqlDbContextLocator
  • -Product:解决方案默认前缀,如 Fur
  • -UseDatabaseNames:是否保持生成和数据库、表一致的名称

9.13.5 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-delete/index.html b/docs/docs/dbcontext-delete/index.html index bd1e32b1e26..bb65be58d63 100644 --- a/docs/docs/dbcontext-delete/index.html +++ b/docs/docs/dbcontext-delete/index.html @@ -5,17 +5,22 @@ 9.8 删除操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -65,16 +70,21 @@
// 示例四
await repository.FakeDeleteNowAsync(1);
// 示例五
await entity.FakeDeleteAsync();
// 示例六
await repository.UpdateIncludeAsync(user, u => u.IsDeleted);

9.8.9 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-filter/index.html b/docs/docs/dbcontext-filter/index.html index ce704bb69e6..00e138df64c 100644 --- a/docs/docs/dbcontext-filter/index.html +++ b/docs/docs/dbcontext-filter/index.html @@ -5,17 +5,22 @@ 9.23 实体/全局查询筛选器 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -32,16 +37,21 @@
/// <summary>
/// 构建 u => EF.Property<bool>(u, "IsDeleted") == false 表达式
/// </summary>
/// <param name="entityBuilder"></param>
/// <returns></returns>
private LambdaExpression BuilderIsDeleteLambdaExpression(EntityTypeBuilder entityBuilder)
{
// 获取实体构建器元数据
var metadata = entityBuilder.Metadata;
if (metadata.FindProperty(nameof(Entity.IsDeleted)) == null) return default;
// 创建表达式元素
var parameter = Expression.Parameter(metadata.ClrType, "u");
var properyName = Expression.Constant(nameof(Entity.IsDeleted));
var propertyValue = Expression.Constant(false);
// 构建表达式 u => EF.Property<bool>(u, "IsDeleted") == false
var expressionBody = Expression.Equal(Expression.Call(typeof(EF), nameof(EF.Property), new[] { typeof(bool) }, parameter, properyName), propertyValue);
var expression = Expression.Lambda(expressionBody, parameter);
return expression;
}
}
}
小建议

如果对动态构建 LambdaExpression 不熟悉的朋友,可以使用 System.Linq.Dynamic.Corehttps://github.com/zzzprojects/System.Linq.Dynamic.Core

9.23.3 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-function/index.html b/docs/docs/dbcontext-function/index.html index a221408e563..9545cdf2c69 100644 --- a/docs/docs/dbcontext-function/index.html +++ b/docs/docs/dbcontext-function/index.html @@ -5,17 +5,22 @@ 9.14 函数操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -44,16 +49,21 @@
public FurDbContext(DbContextOptions<FurDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity(typeof(F_Person)).HasNoKey();
modelBuilder.HasDbFunction(() => GetPersons(default));
}
}
}

9.14.5.4 在 Linq 中使用

IQueryable<F_Person> query = _repository.DynamicDbContext.GetPersons(1);
var result = query.Where(u => u.Name.Equals("Fur")).ToList();

最终生成 Sql

SELECT [g].Id, [g].Name, [g].Age, [g].Address
FROM dbo.GetPersons(1) AS [g]
WHERE [g].Name == N'Fur';

9.14.6 在 EF Core 内置函数

EF Core 为我们提供了很多常用的内置函数,可以在 Lambda 条件中使用,主要是通过 EF.Functions 调用,如:

_repository.Where(u => EF.Functions.DateDiffHour(u.CreatedDt, DateTime.Now) > 8).FirstOrDefault();

这个语句使用了 EF.Functions.DateDiffHour 最终生成的 Sql 如下:

SELECT TOP(1) [a].*
FROM [dbo].[TEST] AS [a]
WHERE DATEDIFF(HOUR, [a].[CREATED_DT], GETDATE()) > 8

EF Core 内置函数就不一一列出了,可以通过 EF.Functions 查看更多,如果不能满足自己的需求,那么可以自定义 Linq 标量函数

9.14.7 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-hight-query/index.html b/docs/docs/dbcontext-hight-query/index.html index 0f321a2adff..e57575a8607 100644 --- a/docs/docs/dbcontext-hight-query/index.html +++ b/docs/docs/dbcontext-hight-query/index.html @@ -5,17 +5,22 @@ 9.11 高级查询操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -51,16 +56,21 @@
// 示例二
var e = DynamicExpressionParser.ParseLambda(
typeof(Customer), typeof(bool),
"City = @0 and Orders.Count >= @1",
"London", 10);

9.11.11 性能优化

默认情况下,EF Core 会跟踪所有实体,也就是任何数据改变都会引起数据检查,所以如果只做查询操作,建议关闭实体跟踪功能。

Fur 框架提供了以下高性能实体集合:

  • DetachedEntities:脱轨/不追踪实体
  • AsQueryable():不追踪实体
  • Entities.AsNoTracking():手动关闭实体追踪

EF Core 中,复杂查询总是会生成一个 sql,也就是 AsSingleQuery(),我们也可以设置为 AsSplitQuery() 切割成多个查询。

9.11.12 分表查询小例子

using Fur.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
namespace Fur.Core
{
public class Person : Entity, IEntityTypeBuilder<Person>
{
public string Name { get; set; }
/// <summary>
/// 配置实体关系
/// </summary>
/// <param name="entityBuilder"></param>
/// <param name="dbContext"></param>
/// <param name="dbContextLocator"></param>
public void Configure(EntityTypeBuilder<City> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.ToSqlQuery(
@"select * from dbo.person.2020-09-19
union all
select * from dbo.person.2020-09-20");
}
}
}
var posts = repository.Where(u => u.Id > 10).ToList();

9.11.12 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-locator/index.html b/docs/docs/dbcontext-locator/index.html index a30422e3b6b..519c291b13a 100644 --- a/docs/docs/dbcontext-locator/index.html +++ b/docs/docs/dbcontext-locator/index.html @@ -5,33 +5,43 @@ 9.2 数据库上下文定位器 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +

9.2 数据库上下文定位器

9.2.1 数据库上下文定位器

在了解数据库上下文定位器之前,我们先了解什么是 定位器定位器 就是给物体安装特殊配置,使其能够被实时追踪和定位。

那为什么需要 定位器

由于 EF Core 本身支持多个数据库上下文操作,但是通过 依赖注入 的方式默认只初始化一个数据库上下文,也就是如果我们想要操作多个数据库上下文,那么 构造函数 注入方式就会变得复杂。

所以,Fur 实现了一套 定位器 功能,通过这个 定位器 ,我们就能够通过 依赖注入 等多个方式定位到数据库上下文并初始化。

9.2.2 数据库上下文定位器作用

  • 能够实现构造函数初始化多个数据库上下文
  • 能够避免业务层直接引用 DbContext
  • 能够实现动态切换数据库、读写分离、主从库等复杂操作

9.2.3 如何定义数据库上下文定位器

定义数据库上下文定位器只需遵循三个原则即可:

  • 必须是公开 class 类型同时具备无参构造函数
  • 该类型必须继承 IDbContextLocator 接口
  • 数据库上下文定位器和数据库上下文必须是一对一关系,也就是不能同时被多个数据库上下文使用

数据库上下文定位器定义代码如下:

using Fur.DatabaseAccessor;
namespace Fur.Core
{
public sealed class FurDbContextLocator : IDbContextLocator
{
}
}

9.2.4 默认数据库上下文定位器

Fur 框架中已经提供了 MasterDbContextLocator 默认数据库上下文定位器,所以默认数据库上下文只需继承 AppDbContext<TDbContext> 即可。

AppDbContext<TDbContext> 定义代码如下:

using Fur.DependencyInjection;
using Microsoft.EntityFrameworkCore;
namespace Fur.DatabaseAccessor
{
/// <summary>
/// 默认应用数据库上下文
/// </summary>
/// <typeparam name="TDbContext">数据库上下文</typeparam>
[NonBeScan]
public abstract class AppDbContext<TDbContext> : AppDbContext<TDbContext, MasterDbContextLocator>
where TDbContext : DbContext
{
/// <summary>
/// 构造函数
/// </summary>
/// <param name="options"></param>
public AppDbContext(DbContextOptions<TDbContext> options) : base(options)
{
}
}
}

9.2.5 数据库上下文定位器支持对象

目前数据库上下文支持以下多个对象:

  • AppDbContext<TEntity, TDbContextLocator>:数据上下文
  • IRepository<TEntity, TDbContextLocator:实体仓储
  • ISqlRepository<TDbContextLocator>: Sql 操作仓储
  • Func<Type, DbContext>:依赖注入获取数据库上下文
  • Entity<Tkey, TDbContextLocator> :实体配置
  • EntityBase<Tkey, TDbContextLocator1, ... TDbContextLocator8>:实体配置
  • EntityNotKey<TDbContextLocator1, ... TDbContextLocator8>:无键实体配置
  • IEntitySeedData<TEntity, TDbContextLocator1, ... TDbContextLocator8>:种子数据配置
  • IEntityTypeBuilder<TEntity, TDbContextLocator1, ... TDbContextLocator8>:实体类型构建器
  • IModelBuilderFilter<TDbContextLocator1, ... TDbContextLocator8>:模型构建筛选器
  • [QueryableFunction(DbContextLocators=Type[])]:查询函数

9.2.6 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-multi-database/index.html b/docs/docs/dbcontext-multi-database/index.html index c0be5ecc8d0..df9e700524b 100644 --- a/docs/docs/dbcontext-multi-database/index.html +++ b/docs/docs/dbcontext-multi-database/index.html @@ -5,17 +5,22 @@ 9.18 多数据库操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -37,16 +42,21 @@
// 切换到 Sqlite 操作 Person表
var sqliteRepository = sqlRepository.Change<SqliteDbContextLocator>();

9.18.3.4 实体定义方式

// 支持一个数据库
public class Person: IEntity<MySqlDbContextLocator>
{
// ....
}
// 支持多个数据库
public class Person: IEntity<MySqlDbContextLocator, SqliteDbContextLocator>
{
// ....
}
小知识

所有的 实体依赖接口或抽象类 都支持泛型方式 指定 数据库上下文定位器,最多支持 8 个。

9.18.3.5 Linq 函数方式

public static class QueryFunctions
{
[QueryableFunction("FN_GetId", "dbo", typeof(MySqlDbContextLocator), typeof(SqliteDbContextLocator))]
public static int GetId(int id) => throw new NotSupportedException();
}

9.18.4 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-proc/index.html b/docs/docs/dbcontext-proc/index.html index 1a638dbe14c..232ddc7c9ea 100644 --- a/docs/docs/dbcontext-proc/index.html +++ b/docs/docs/dbcontext-proc/index.html @@ -5,17 +5,22 @@ 9.13 存储过程操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -113,16 +118,21 @@
// 变态懒人方式,直接通过存储过程名执行
ProcedureOutputResult<(List<Test>, List<Test>)> result = "proc_Complex".SqlProcedureOutput<(List<Test>, List<Test>)>(new ProcOutputModel{});
// 获取 OUTPUT 参数值
var outputs = result.OutputValues;
// 获取 RETURN 返回值
var reval = result.ReturnValue;
// 获取返回结果集
var (list1,list2) = result.Result;
关于异步

Fur 框架每一个数据库操作都支持异步方式,由于篇幅有限,就不列举异步方式了。

9.13.3 关于 [DbParameter]

[DbParameter] 特性是用来标注 Sql函数存储过程 参数的,可配置属性:

  • Direction:设置参数方向,ParameterDirection 枚举类型,默认 ParameterDirection.Input
  • DbType:设置参数类型,DbType 枚举类型,无默认
  • Size:设置参数长度的,int 类型

其中 Direction 属性是默认构造函数参数。

9.13.4 关于 ProcedureOutputResult

ProcedureOutputResultProcedureOutputResult<TResult> 是复杂存储过程执行返回模型类,有以下属性:

  • OutputValues:多个输出值,ProcedureOutputValue 类型
  • ReturnValue:返回值,object 类型
  • Result:结果集,非泛型版本是 DataSet类型,否则是 泛型类型

9.13.5 存储过程参数

所有 sql 参数都支持四种方式:

  • DbParameter[]:数组类型
  • new {}:匿名类型
  • new Class{}:强类型类型(支持复杂存储过程参数)
  • Dictionary<string,object> 类型

9.13.6 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-query/index.html b/docs/docs/dbcontext-query/index.html index 94e098800f4..ce7c048e3f5 100644 --- a/docs/docs/dbcontext-query/index.html +++ b/docs/docs/dbcontext-query/index.html @@ -5,17 +5,22 @@ 9.10 查询操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -132,16 +137,21 @@
// 示例三
var sum = await repository.DetachedEntities.AverageAsync(u => u.Cost);

9.10.6.7 时间查询

var starDate = DateTime.Parse("2020-09-10");
var endDate = DateTime.Parse("2020-09-10");
var query = repository.Where(u => u.CreatedDt >= starDate && u.CreatedDt <= endDate);

9.10.6.8 模糊查询

// 示例一
repository.Where(u => u.Name.StartWith("Fur"));
// 示例二
_testRepository.Where(u => u.Name.EndWith("Fur"));
// 示例三
_testRepository.Where(u => u.Name.Contains("Fur"));

9.10.6.9 Case When

数据库中的 Case When 实际上对应的是我们程序中的 三元表达式 ,也就是使用 三元表达式 即可自动生成 Case When 语句。

9.10.7 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-read-write/index.html b/docs/docs/dbcontext-read-write/index.html index 0a0368cc579..f613d707867 100644 --- a/docs/docs/dbcontext-read-write/index.html +++ b/docs/docs/dbcontext-read-write/index.html @@ -5,17 +5,22 @@ 9.26 读写分离/主从复制 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -32,16 +37,21 @@
/// <summary>
/// 新增走主库
/// </summary>
/// <param name="person"></param>
/// <returns></returns>
public void Insert(Person person)
{
_msRepository.Master<Person>().Insert(person);
}
/// <summary>
/// 查询走从库
/// </summary>
/// <returns></returns>
public List<Person> Get()
{
return _msRepository.Slave1<Person>().AsEnumerable();
}
}
}

9.26.3 主从复制

主从复制:是一种数据备份的方案。

简单来说,是使用两个或两个以上相同的数据库,将一个数据库当做主数据库,而另一个数据库当做从数据库。在主数据库中进行相应操作时,从数据库记录下所有主数据库的操作,使其二者一模一样。

9.26.4 主从复制几种方式

9.26.4.1 同步复制

所谓的同步复制,意思是 Master 的变化,必须等待 Slave-1,Slave-2,...,Slave-n 完成后才能返回。 这样,显然不可取,比如,在 Web 前端页面上,用户增加了条记录,需要等待很长时间。

9.26.4.2 异步复制

如同 AJAX 请求一样。Master 只需要完成自己的数据库操作即可。至于 Slaves 是否收到二进制日志,是否完成操作,不用关心。(推荐方式)

9.26.4.3 半同步复制

Master 只保证 Slaves 中的一个操作成功,就返回,其他 Slave 不管。

下面将使用 SqlServer 简单配置主从复制功能。

9.26.5 SqlServer 主库配置

9.26.5.1 添加 本地发布

9.26.5.2 选择 分发服务器

9.26.5.3 启用 代理

9.26.5.4 发布数据库

9.26.5.5 快照发布

具体选择何种发布类型,视具体业务场景而定。

9.26.5.6 选择发布项目

9.26.5.7 配置分发计划

9.26.5.8 配置安全设置

9.26.5.9 完成配置

9.26.6 SqlServer 从库配置

9.26.6.1 添加 本地订阅

9.26.6.2 选择 分发服务器

9.26.6.3 选择 分发代理位置

9.26.6.4 选择 订阅数据库

9.26.6.5 选择 分发安全设置

9.26.6.6 选择 同步计划

9.26.6.7 完成订阅

9.26.7 分发定义监视

9.26.8 查看主从复制结果

特别特性

主从复制有一定迟延性,所以系统设计要有一定“容忍性"。

9.26.9 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-repository/index.html b/docs/docs/dbcontext-repository/index.html index 5123d744a9a..3575c4e7d0a 100644 --- a/docs/docs/dbcontext-repository/index.html +++ b/docs/docs/dbcontext-repository/index.html @@ -5,17 +5,22 @@ 9.4 仓储模式 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -27,16 +32,21 @@
// 切换到 Sqlite 操作 Person表
var sqliteRepository = repository.Change<Person, SqliteDbContextLocator>();
// 其他更多数据库一样的操作

另外任何仓储或实体配置都支持多个数据库同时操作

仓储方式

IRepository<Person, MsSqlDbContextLocator> mssqlRepository
ISqlRepository<MsSqlDbContextLocator> mssqlRepository;

动态 sql 方式

"select * from person".Change<MsSqlDbContextLocator>().SqlQuery();

实体配置方式

public class User:Entity<MsSqlDbContextLocator, MySqlDbContextLocator>
{
}

Sql 代理方式

[SqlFunction("funcName", DbContextLocator = typeof(MySqlDbContextLocator))]
int GetAge(int id);

Linq 中方式

[QueryableFunction("funcName","dbo", DbContextLocator = typeof(MySqlDbContextLocator))]
string GetName()=> throw Oops.Oh("不支持该数据库操作");

9.4.5 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-seed-data/index.html b/docs/docs/dbcontext-seed-data/index.html index 90db4bb0df0..534713cbef5 100644 --- a/docs/docs/dbcontext-seed-data/index.html +++ b/docs/docs/dbcontext-seed-data/index.html @@ -5,17 +5,22 @@ 9.21 实体种子数据 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -26,16 +31,21 @@
// 配置种子数据
public IEnumerable<Person> HasData(DbContext dbContext, Type dbContextLocator)
{
return new List<Person>
{
new Person { Id = 1, Name = "百小僧", Address = "广东省中山市" },
new Person { Id = 2, Name = "新生帝", Address = "广东省珠海市" }
};
}
}
}
特别注意

主键 值必须手动插入,因为会自动关闭主键或自增标识检查。

9.21.2.2 在任意对象类中使用

using Fur.DatabaseAccessor;
using System.Collections.Generic;
namespace Fur.Application
{
public class PersonSeedData : IEntitySeedData<Person>
{
// 配置种子数据
public IEnumerable<Person> HasData(DbContext dbContext, Type dbContextLocator)
{
return new List<Person>
{
new Person { Id = 1, Name = "百小僧", Address = "广东省中山市" },
new Person { Id = 2, Name = "新生帝", Address = "广东省珠海市" }
};
}
}
}

9.21.3 导航属性

通常我们的实体有 一对多多对多等外键关系,那么我们需要单独为每一个实体添加数据种子,而不是直接写在主表中。

9.21.4 多个数据库种子数据

Fur 提供泛型的方式支持多个数据库种子数据设定,如:

using Fur.DatabaseAccessor;
using System.Collections.Generic;
namespace Fur.Application
{
public class PersonSeedData : IEntitySeedData<Person, MySqlDbContextLocator, SqliteDbContextLocator>
{
// 配置种子数据
public IEnumerable<Person> HasData(DbContext dbContext, Type dbContextLocator)
{
return new List<Person>
{
new Person { Id = 1, Name = "百小僧", Address = "广东省中山市" },
new Person { Id = 2, Name = "新生帝", Address = "广东省珠海市" }
};
}
}
}

上面的例子表示同时为 MySqlDbContextSqliteDbContext 创建种子数据。

9.21.5 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 数据种子 知识可查阅 EF Core - 数据种子设定 章节。

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-sql-proxy/index.html b/docs/docs/dbcontext-sql-proxy/index.html index f60857d6b61..116ff5b1c9d 100644 --- a/docs/docs/dbcontext-sql-proxy/index.html +++ b/docs/docs/dbcontext-sql-proxy/index.html @@ -5,17 +5,22 @@ 9.17 Sql 高级代理 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -70,16 +75,21 @@
[SqlProcedure("PROC_Name")]
ProcedureOutputResult<(List<Person>, List<Student>)> GetOutput(ProcOutputModel pams);
}
}

9.17.5 函数 操作

using Fur.DatabaseAccessor;
namespace Fur.Application
{
public interface ISql : ISqlDispatchProxy
{
[SqlFunction("FN_Name")] // 标量函数
string GetValue(MyParam dto);
[SqlProcedure("FN_Name")] // 表值函数
List<Person> GetPersons(int id);
}
}
补充说明

Sql 代理会自动判断返回值然后自动执行特定函数类型。

9.17.6 为什么用它?

通过上面的例子大家就可以了解,这种方式操作 sql 非常简单,而且极易维护。大家不用去关系返回值,关心用哪个方法,所有东西会自动给你处理好。

所以,如果需要用 Sql 操作,推荐使用 Sql 高级代理。

9.17.7 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-sql-template/index.html b/docs/docs/dbcontext-sql-template/index.html index c7375e0e304..8c20c801395 100644 --- a/docs/docs/dbcontext-sql-template/index.html +++ b/docs/docs/dbcontext-sql-template/index.html @@ -5,33 +5,43 @@ 9.16 Sql 模板 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +

9.16 Sql 模板

9.16.1 Sql 模板

通常我们程序中执行数据库的 sql 语句都写在了程序集中,随程序一起编译,后续需要修改,则重新编译代码。

所以,Fur 创造出一种 Sql 模板的方式,程序执行 Sql 时,只需要使用特殊标记即可:#(模板Key),这些真实的 Sql 配置在 .json.xml 配置文件中。

如:

  • Json 方式
{
"Select.User": "select * from User where id > @id"
}
  • Xml 方式
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<Select.User>select * from User where id > @id</Select.User>
</configuration>

9.16.2 Sql 模板优缺点

9.16.2.1 优点

  • 支持 Sql 动态配置,可在程序运行时动态调配 Sql 语句
  • 支持程序 Sql 语句加密

9.16.2.2 缺点

  • 需增加对应配置文件
  • 不容易调试 Sql 代码

9.16.3 如何使用

在执行 Sql 的时候,只需要填写指定模板即可。

9.16.3.1 常规使用

// 仓储方式
var users = repository.SqlQuery<User>("#(Select.User)", new { id = 1});
// 懒人方式
var users = "#(Select.User)".SqlQuery<User>(new { id = 1});
// Sql 代理方式
[SqlExecute("#(Select.User)")]
List<User> GetUser(int id);

9.16.3.2 高级嵌套

var users = repository.SqlQuery<User>(
@"select * from user u
left join #(User.Detail) d on u.Id = d.UserId
where id > @id");

9.16.4 Sql 模板配置

9.16.4.1 普通模式

{
"Select.User": "select * from User"
}

9.16.4.2 更多配置

{
"Select.User": {
"Sql": "select * from User where id > @id and Name = @name",
"Params": [
{
"Name": " Id",
"Value": "1",
"DbType": "Int16",
"Size": 10
},
{
"Name": " Name",
"Value": "百小僧",
"DbType": "String",
"Size": 10
}
]
}
}

9.16.5 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-sql/index.html b/docs/docs/dbcontext-sql/index.html index 417d5dae77d..573fed7d05f 100644 --- a/docs/docs/dbcontext-sql/index.html +++ b/docs/docs/dbcontext-sql/index.html @@ -5,17 +5,22 @@ 9.15 Sql 操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -167,16 +172,21 @@
// 示例五
var persons = sqlRepository.SqlQuery<Person>("select * from person where id > @id", new { id = 10});
// 不再举例子。。。。。。
补充说明

不管是那种方式操作 Sql ,方法名参数都是一致的,如:

  • SqlQuery
  • SqlQueryAsync
  • SqlQueries
  • SqlQueriesAsync
  • SqlNonQuery
  • SqlNonQueryAsync
  • SqlScalar
  • SqlScalarAsync
  • SqlProcedureQuery
  • SqlProcedureQueryAsync
  • SqlProcedureQueries
  • SqlProcedureQueriesAsync
  • SqlProcedureScalar
  • SqlProcedureScalarAsync
  • SqlProcedureNonQuery
  • SqlProcedureNonQueryAsync
  • SqlProcedureOutput
  • SqlProcedureOutputAsync
  • SqlFunctionScalar
  • SqlFunctionScalarAsync
  • SqlFunctionQuery
  • SqlFunctionQuery

9.15.6 IRepository 操作

IRepository 也能操作 sql,调用方法也是和上面一致的,如:

var dataTable = repository.Sql().SqlQuery("select * from person");
特别说明

由于篇幅有限,不再列举所有例子。

9.15.7 IRepository<TEntity> 操作

IRepository<TEntity> 也能操作 sql,调用方法也是和上面一致的,如:

var dataTable = personRepository.SqlQuery("select * from person");
特别说明

由于篇幅有限,不再列举所有例子。

9.15.8 关于 Sql 参数

所有 sql存储过程函数 参数都支持四种方式:

  • DbParameter[]:数组类型
  • new {}:匿名类型
  • new Class{}:强类型类型(支持复杂存储过程参数)
  • Dictionary<string,object> 类型
小知识

建议除了复杂的存储过程(带 OUTPUT/RETURN)的以外,所有参数建议使用 new {} 匿名类型,如果需要动态参数,则可以使用 Dictionary<string,object> 类型。

9.15.9 多数据库 Sql 操作 💯 💛

Fur 框架拥有非常灵活的多数据库操作方式,只需通过多数据库上下文定位器即可动态切换数据库。

9.15.9.1 懒人无敌 🐮 方式

var dataTable = "select * from person".Change<MySqlDbContextLocator>().SqlQuery();
var persons = "select * from person whre id > @id".Change<SqliteDbContextLocator>().SqlQuery<Person>();
补充说明

懒人方式 只需要通过 Change<TDbContextLocator> 方式即可动态切换数据库。

9.15.9.2 ISqlRepository 方式

只需要通过 ISqlRepository<TDbContextLocator> 注入或通过 sqlRepository.Change<TDbContextLocator>() 切换。

9.15.9.3 IRepository 方式

只需要通过 repository.Change<TDbContextLocator>() 获取即可。

9.15.9.4 IRepository<TEntity> 方式

只需要通过 IRepository<TEntity, TDbContextLocator> 注入或通过 personRepository.Change<TEntity, TDbContextLocator>() 切换。

9.15.10 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-update/index.html b/docs/docs/dbcontext-update/index.html index 835fa50b081..daac307fdd2 100644 --- a/docs/docs/dbcontext-update/index.html +++ b/docs/docs/dbcontext-update/index.html @@ -5,17 +5,22 @@ 9.6 更新操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -192,16 +197,21 @@
// 示例一
await repository.UpdateNowAsync(user, user2);
// 示例二
await repository.UpdateNowAsync(new List<User> { user, user2 });
// 示例三
await repository.UpdateNowAsync(new[] {user, user2 });
小知识

所有带 Now 结尾的表示立即提交到数据库,也就是立即调用 SaveChangesSaveChangesAsync

9.6.15 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext-view/index.html b/docs/docs/dbcontext-view/index.html index 33220ef46a9..9e44d00fa60 100644 --- a/docs/docs/dbcontext-view/index.html +++ b/docs/docs/dbcontext-view/index.html @@ -5,17 +5,22 @@ 9.12 视图操作 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -28,16 +33,21 @@
namespace Fur.Application.Persons
{
public class FurService : IDynamicApiController
{
private readonly IReadableRepository<V_Person> _readableRepository;
public FurService(IRepository<V_Person> repository)
{
// 初始化只读仓储
_readableRepository = repository.Constraint<IReadableRepository<V_Person>>();
}
/// <summary>
/// 读取视图
/// </summary>
/// <returns></returns>
public async Task<List<V_Person>> GetVPerson()
{
var list = await _readableRepository.AsAsyncEnumerable();
return list;
}
}
}
小知识

通过 .Constraint<TEntity,TDbContextLocator> 方法可以将仓储约束为特定仓储,如只读仓储,可读可写仓储,只新增仓储等。

9.12.5 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dbcontext/index.html b/docs/docs/dbcontext/index.html index 8a7e85c38ec..f80471fde2f 100644 --- a/docs/docs/dbcontext/index.html +++ b/docs/docs/dbcontext/index.html @@ -5,17 +5,22 @@ 9.1 数据库上下文 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -31,16 +36,21 @@
namespace Fur.EntityFramework.Core
{
[AppStartup(600)]
public sealed class FurEntityFrameworkCoreStartup : AppStartup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddDatabaseAccessor(options =>
{
options.AddDbPool<FurDbContext>(DbProvider.Sqlite);
});
}
}
}

如果有多个数据库操作,那么从第二个起,就需要绑定数据库上下文定位器,如:

options.AddDbPool<FurDbContext>(DbProvider.Sqlite); // 第一个数据库
options.AddDbPool<SecondDbContext, SecondDbContextDbContextLocator>(DbProvider.SqlServer); // 第二个数据库
options.AddDbPool<ThirdDbContext, ThirdDbContextDbContextLocator>(DbProvider.SqlServer); // 第三个数据库

9.1.8 动态数据库上下文对象

Fur 框架中,数据库上下文是定义在 Fur.EntityFramework.Core 项目层,并且该层不被 Fur.ApplicationFur.Core 等层引用。

所以就不能直接在 Fur.Application 项目层直接使用 Fur.EntityFramework.Core 定义的数据库上下文。

Fur 为了解决这个问题,提供了两种方式处理:

  • respository.DbContext :当前数据库上下文对象,返回是 DbContext 抽象类型
  • respository.DynamicDbContext:当前数据库上下文对象,返回的是 dynamic 类型

如果你只是想使用 DbContext 的功能,直接使用 respository.DbContext 即可,如:

respository.DbContext.SaveChanges();

如果你想能够获取具体的数据库上下文类型,如 MyDbContext,那么使用 respository.DynamicDbContext 就可以获取到具体的 MyDbContext 类型。如:

var persons = respository.DynamicDbContext.Persons.Find(1);
var users = respository.DynamicDbContext.Users;

这样就可以直接操作 MyDbContext 定义的属性和方法了。

9.1.9 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 数据库上下文 知识可查阅 EF Core - 配置 DbContext 章节。

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dependency-injection/index.html b/docs/docs/dependency-injection/index.html index e140609ffaf..030c317c15e 100644 --- a/docs/docs/dependency-injection/index.html +++ b/docs/docs/dependency-injection/index.html @@ -5,17 +5,22 @@ 11. 依赖注入/控制反转 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -53,16 +58,21 @@
var result = targetMethod.Invoke(Target, args);
Console.WriteLine("SayHello 方法返回值:" + result);
return result;
}
}
}

之后我们只需要为 TestService 增加 [Injection] 特性即可,如:

[Injection(Proxy = typeof(LogDispatchProxy))]
public class TestService: ITestService, ITransient
{
public string SayHello(string word)
{
return $"Hello {word}";
}
}

之后 SayHello 方法被调用的时候就可以实现动态拦截了,比如这里写日志。

11.12.1 AOP 的作用

这种面向切面的能力(动态拦截/代理)可以实现很多很多功能,如:

  • 动态日志记录
  • 动态修改参数
  • 动态修改返回值
  • 动态方法重定向
  • 动态修改代码逻辑
  • 动态实现异常监听

还可以做更多更多的事情。

11.13 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/deploy/index.html b/docs/docs/deploy/index.html index 4f55114fd83..bed40b7c5ca 100644 --- a/docs/docs/deploy/index.html +++ b/docs/docs/deploy/index.html @@ -5,31 +5,41 @@ 25. 托管部署 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/devops/index.html b/docs/docs/devops/index.html index 8e96ee1c98a..78db93564a6 100644 --- a/docs/docs/devops/index.html +++ b/docs/docs/devops/index.html @@ -5,31 +5,41 @@ 26. 持续部署集成 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/dynamic-api-controller/index.html b/docs/docs/dynamic-api-controller/index.html index d17fdafb6c0..d8fac3bc19e 100644 --- a/docs/docs/dynamic-api-controller/index.html +++ b/docs/docs/dynamic-api-controller/index.html @@ -5,17 +5,22 @@ 5. 动态 WebAPI | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -66,16 +71,21 @@
public int Get(int id)
{
return id;
}
}
}

如下图所示:

小知识

如果 Tag 名字一样,则会自动合并,否则只是命名。

5.10 DynamicApiControllerSettings 配置

Fur 还提供动态 WebAPI 接口一些全局配置选项,如:

  • DefaultRoutePrefix:默认路由前缀,string,默认 api
  • DefaultHttpMethod:默认请求谓词,string,默认:POST
  • DefaultModule:默认模块名称(区域),可用作接口版本,string,默认:v1
  • LowercaseRoute:小写路由格式,bool,默认:true
  • KeepVerb:是否保留动作谓词,bool,默认:false
  • CamelCaseSeparator:骆驼命名分隔符,string,默认:-
  • VersionSeparator:版本分隔符,string,默认:@
  • ModelToQueryGET/HEAD 请求将 类类型参数转查询参数bool,默认 false
  • SupportedMvcController:是否支持 Mvc Controller 动态配置,bool,默认 false
  • AbandonControllerAffixes:默认去除控制器名称前后缀列表名,string[],默认:
    • AppServices
    • AppService
    • ApiController
    • Controller
    • Services
    • Service
  • AbandonActionAffixes:默认去除动作方法名称前后缀列表名,string[],默认:
    • Async

5.10.1 支持 Mvc 控制器 动态配置

默认情况下,Fur 动态 WebAPI 接口不对 ControllerBase 类型进行任何处理。当然,我们也可以手动启用 ControllerBase 支持。

Fur.Web.Entry/appsettings.json
{
"AppSettings": {
"DynamicApiControllerSettings": {
"SupportedMvcController": true
}
}
}

设置 SupportedMvcController: true 后,Mvc ControllerBase 类型也能和动态 WebAPI 一样的灵活了。代码如下:

using Microsoft.AspNetCore.Mvc;
namespace Fur.Web.Entry.Controllers
{
public class MvcController : ControllerBase
{
public string Get()
{
return nameof(Fur);
}
}
}
注意事项

启用该配置后,如果 Mvc 控制器 没有任何 [Route] 特性,但是贴了 [ApiController] 特性将会报错。原因是 [ApiController] 特性内部做了路由特性检测。所以建议使用 [ApiDataValidation] 代替。

查看 ASP.NET Core - ApiBehaviorApplicationModelProvider 源码

5.11 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/entity/index.html b/docs/docs/entity/index.html index c6a1ed99c7e..b72869f928d 100644 --- a/docs/docs/entity/index.html +++ b/docs/docs/entity/index.html @@ -5,17 +5,22 @@ 9.3 数据库实体 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -33,16 +38,21 @@
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
// 配置数据库实体
public void Configure(EntityTypeBuilder<User> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasKey(u => u.Id);
entityBuilder.HasIndex(u => u.Name);
}
}
}

9.3.3.2 在任何实例类中配置

using Fur.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
namespace Fur.Core
{
public class SomeClass : IEntityTypeBuilder<User>
{
public void Configure(EntityTypeBuilder<User> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasKey(u => u.Id);
entityBuilder.HasIndex(u => u.Name);
}
}
}

如,上面例子,通过 SomeClass 配置 User 数据库实体。

9.3.4 数据库实体配置说明

Fur 框架会自动扫描所有继承 IEntity 接口的类进行 DbSet<TEntity> 注册,也就是实现自动配置 DbContextOnModelCreating

如果需要跳过自动注册,只需要贴 [NonAutomatic][SkipScan] 特性即可。一旦贴了次特性,那么就需要手动配置 DbContextOnModelCreating

9.3.5 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/errors/index.html b/docs/docs/errors/index.html index 0a764b32d42..c80cbc376e6 100644 --- a/docs/docs/errors/index.html +++ b/docs/docs/errors/index.html @@ -5,31 +5,41 @@ 29.2 常见错误 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/event-bus/index.html b/docs/docs/event-bus/index.html index e15077d1b92..e384f5ecf88 100644 --- a/docs/docs/event-bus/index.html +++ b/docs/docs/event-bus/index.html @@ -5,31 +5,41 @@ 18. 事件总线 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/friendly-exception/index.html b/docs/docs/friendly-exception/index.html index 90869b564bf..5594d20230e 100644 --- a/docs/docs/friendly-exception/index.html +++ b/docs/docs/friendly-exception/index.html @@ -5,17 +5,22 @@ 7. 友好异常处理 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -53,16 +58,21 @@
/// <summary>
/// 成功返回值
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public IActionResult OnSuccessed(ActionExecutedContext context)
{
object data;
// 处理内容结果
if (context.Result is ContentResult contentResult) data = contentResult.Content;
// 处理对象结果
else if (context.Result is ObjectResult objectResult) data = objectResult.Value;
else return null;
return new JsonResult(new RESTfulResult
{
StatusCode = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK,
Successed = true,
Data = data,
Errors = null
});
}
/// <summary>
/// 验证失败返回值
/// </summary>
/// <param name="context"></param>
/// <param name="modelStates"></param>
/// <param name="validationResults"></param>
/// <param name="validateFaildMessage"></param>
/// <returns></returns>
public IActionResult OnValidateFailed(ActionExecutingContext context, ModelStateDictionary modelStates, Dictionary<string, IEnumerable<string>> validationResults, string validateFaildMessage)
{
return new JsonResult(new RESTfulResult
{
StatusCode = StatusCodes.Status400BadRequest,
Successed = false,
Data = null,
Errors = validationResults
});
}
}
}

之后在 Startup.cs 中注册即可:

services.AddControllers().AddUnifyResult<RESTfulResult, RESTfulResultProvider>();

7.14 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/get-start/index.html b/docs/docs/get-start/index.html index 60382fac239..4c3fd20c0f0 100644 --- a/docs/docs/get-start/index.html +++ b/docs/docs/get-start/index.html @@ -5,17 +5,22 @@ 2. 一分钟入门 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -39,16 +44,21 @@
namespace Fur.Application
{
public class PersonDto
{
/// <summary>
/// Id
/// </summary>
public int? Id { get; set; }
/// <summary>
/// 姓名
/// </summary>
[StringLength(32, MinimumLength = 2)]
public string Name { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
}
}

说好一分钟入门,你们用了多长时间。😁

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/gooduse/index.html b/docs/docs/gooduse/index.html index 5afaa421d95..1bbb6001e51 100644 --- a/docs/docs/gooduse/index.html +++ b/docs/docs/gooduse/index.html @@ -5,31 +5,41 @@ 29.3 最佳实践 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/grpc/index.html b/docs/docs/grpc/index.html index 37227d032a0..544ee0019ca 100644 --- a/docs/docs/grpc/index.html +++ b/docs/docs/grpc/index.html @@ -5,31 +5,41 @@ 24. Grpc 服务 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/http/index.html b/docs/docs/http/index.html index b1d37e40f95..a7e1eb06ce0 100644 --- a/docs/docs/http/index.html +++ b/docs/docs/http/index.html @@ -5,31 +5,41 @@ 20. 网络请求 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/index.html b/docs/docs/index.html index 2c5feac1e90..fdddfdba6d0 100644 --- a/docs/docs/index.html +++ b/docs/docs/index.html @@ -5,31 +5,41 @@ 1.1 介绍 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
-

1.1 介绍

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下极易入门、极速开发的 Web 应用框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-2020.10.10
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-2020.10.10 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-2020.10.10

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor

- - - - - - - - +

1.1 介绍

star fork GitHub stars GitHub forks GitHub license nuget

Fur.NET 5 平台下极易入门、极速开发的 Web 应用框架。

🍕 名字的由来

故事是这样子的:

起初,想开发一个极易入门、极易维护的框架,开发理念为:一切从简,只为了更懒

所以自然而然想到了:Lazier,也就是 更懒 的意思。但是 更懒更烂 读音相近且中文名没有特色,对此换名问题我苦恼了好几天。

刚好有一次我在博客园中帮一个博友解答问题,解决后博友赞扬我对 .NET Core 颇有了解,我就顺嘴回答了一句:“略懂皮毛”

就这时,脑瓜子灵机一动,干脆起名为:“皮毛”?英文单词 Fur [fɜː(r)]”,单词又短而且中文读音既俗气又顺口。😄😎

所以,Fur 就诞生了。

之后就有了 “小僧不才,略懂皮毛(Fur)。” 广告语 和 chinadot.net 域名。

🍔 关于 LOGO

Fur LOGO 设计由 F U R 三个单词组成:

我相信很多人看到 Fur 的 LOGO 时都会问:“为什么选择奶牛?”,因为 那些年吹过的牛逼都实现了 🐮

之所以选择 奶牛 是因为 具有脚踏实地,任劳任怨的做事风格,同时 奶牛 意味着丰富的营养价值,正如 Fur 所能带给你的。

🍟 文档地址

🌭 开源地址

🍿 Docker 镜像

  • Docker Hub 线上镜像
docker run --name fur -p 5000:80 monksoul/fur:v1.0.0-2020.10.13
  • 手动 打包镜像

打开 CMD/Shell/PowerShell 进入 Fur 项目根目录打包 Fur 镜像:

docker build -t fur:v1.0.0-2020.10.13 .

打包成功后,直接 docker run

docker run --name fur -p 5000:80 fur:v1.0.0-2020.10.13

🥞 架构设计

正在整理中...

🥝 功能模块

🥐 框架依赖

Fur 为了追求极速入门,极致性能,尽可能的不使用或减少第三方依赖。目前 Fur 仅集成了以下三个依赖:

麻雀虽小五脏俱全。Fur 即使只集成了这三个依赖,但是主流的 依赖注入/控制反转AOP 面向切面编程,事件总线数据验证数据库操作 等等一个都不少。

🥗 环境要求

  • Visual Studio 2019 Preview 16.8 +
  • .NET 5 SDK +
  • .Net Standard 2.1 +

🥪 支持平台

  • 运行环境
    • Windows
    • Linux
    • MacOS
    • Docker/K8S/K3S/Rancher
    • Xamarin/MAUI
  • 数据库
    • SqlServer
    • Sqlite
    • Azure Cosmos
    • MySql
    • PostgreSQL
    • InMemoryDatabase
    • Oracle
    • Firebird
    • 达梦数据库
  • 应用部署
    • Kestrel
    • Nginx
    • Jexus
    • IIS
    • Apache
    • PM2
    • Supervisor
    • 单文件
    • 容器(Docker/K8S/K3S/Rancher)

🍖 关于性能

Fur 目前采用 Visual Studio 2019 Preview 16.8 自带性能测试和 JMeter 进行测试,由于篇幅有限,只贴部分测试图,测试结果如下:


🍚 关于作者

一个拥有 12 年开发经验 .NETer。喜欢分享,喜欢新技术,在互联网多个技术领域皆有涉猎。

🍤 项目成员

🎈 欢迎更多的开发者加入 Fur 大家庭。

🍝 他们都在用

  • 百签科技(广东)有限公司
  • 码为科技(广州)有限公司
  • 广州启顺国际货运代理有限公司
  • 森丰供应链服务(广州)有限公司
  • 中山赢友网络科技有限公司
  • 中山模思软件科技有限公司
  • 珠海市恒泰新软件有限责任公司
  • 珠海思诺锐创软件有限公司
  • 深圳市易胜科技有限公司
  • 重庆虫儿飞科技有限公司
  • 重庆林木森科技有限公司
  • 深圳市品立方科技有限公司

如果您的项目使用到 Fur 开发,可以告诉我们。

🍻 贡献代码

Fur 遵循 Apache-2.0 开源协议,欢迎大家提交 PRIssue

如果要为项目做出贡献,请查看贡献指南。

🍍 捐赠列表

注:排序按捐赠顺序书写

捐赠人昵称捐赠金额(元)附语
🤴 爱吃油麦菜100感谢您的开源项目!
👳‍♂️ 麦壳饼200感谢您的开源项目!
👨 Sun100感谢您的开源项目!
👶 d61761720感谢您的开源项目!
👦 Diqiguoji00816.66见贤思齐
👲 nodyang100感谢您的开源项目!
👳‍♀️ mictxd100吹过的牛都实现。
🧓 欧流全10希望将来超越 Spring
👨‍⚕️ lionkon10...看了框架感觉拿来学习是很不错的...

非常感谢您们的支持,正是因为您们,中国开源才可以越走越远,Fur 越走越远。

🥔 QQ 交流群

🧆 友情链接

👉 Fur 👉 SqlSugar 👉 Layx 👉 t-io 👉 ThinkPHP 👉 Hutool 👉 BootstrapAdmin 👉 BootstrapBlazor

+ + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/job/index.html b/docs/docs/job/index.html index 18074a89338..0654bc26ff4 100644 --- a/docs/docs/job/index.html +++ b/docs/docs/job/index.html @@ -5,31 +5,41 @@ 22. 任务调度 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/local-language/index.html b/docs/docs/local-language/index.html index 33b576e6dd4..443ba60c187 100644 --- a/docs/docs/local-language/index.html +++ b/docs/docs/local-language/index.html @@ -5,31 +5,41 @@ 16. 多语言处理 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/logging/index.html b/docs/docs/logging/index.html index d917181d83f..d5e1706b3b8 100644 --- a/docs/docs/logging/index.html +++ b/docs/docs/logging/index.html @@ -5,31 +5,41 @@ 19. 日志记录 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/object-mapper/index.html b/docs/docs/object-mapper/index.html index 3e30f17be25..ce9be50329d 100644 --- a/docs/docs/object-mapper/index.html +++ b/docs/docs/object-mapper/index.html @@ -5,31 +5,41 @@ 12. 对象数据映射 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/options/index.html b/docs/docs/options/index.html index 60d0d48414b..787a0165a3b 100644 --- a/docs/docs/options/index.html +++ b/docs/docs/options/index.html @@ -5,17 +5,22 @@ 4.2 选项 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -32,16 +37,21 @@
namespace Fur.Application
{
public class AppInfoOptions : IConfigurableOptionsListener<AppInfoOptions>
{
public string Name { get; set; }
public string Version { get; set; }
public string Company { get; set; }
}
public void OnListener(AppInfoOptions options, IConfiguration configuration)
{
var name = options.Name; // 实时的最新值
var version = options.Version; // 实时的最新值
}
public void PostConfigure(AppInfoOptions options, IConfiguration configuration)
{
}
}
特别说明

IConfigurableOptionsListener<TOptions> 继承自 IConfigurableOptions<TOptions>

4.2.10 选项的优缺点

  • 优点

    • 强类型配置
    • 提供多种读取方式
    • 支持热加载
    • 支持设置默认值/后期配置
    • 支持在运行环境中动态配置
    • 支持验证配置有效性
    • 支持更改通知
    • 支持命名选项
  • 缺点

    • 需要定义对应类型
    • 需要在启动时注册

4.2.11 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 选项 知识可查阅 ASP.NET Core - 选项 章节。

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/performance/index.html b/docs/docs/performance/index.html index b911050be16..77fb794fdfd 100644 --- a/docs/docs/performance/index.html +++ b/docs/docs/performance/index.html @@ -5,31 +5,41 @@ 27.2 性能测试 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/process-service/index.html b/docs/docs/process-service/index.html index b643cdf0c99..39dc0e42ed6 100644 --- a/docs/docs/process-service/index.html +++ b/docs/docs/process-service/index.html @@ -5,31 +5,41 @@ 21. 进程服务 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/reference/index.html b/docs/docs/reference/index.html index d2179c43244..5eeaa808e8b 100644 --- a/docs/docs/reference/index.html +++ b/docs/docs/reference/index.html @@ -5,17 +5,22 @@ 1.4 项目引用 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -26,16 +31,21 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>

所有新建项目都需添加 上述高亮代码,方可使用 Fur 全部功能。

1.4.3 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/saas/index.html b/docs/docs/saas/index.html index 9e257674717..84ebae1edfb 100644 --- a/docs/docs/saas/index.html +++ b/docs/docs/saas/index.html @@ -5,17 +5,22 @@ 10. SaaS 多租户 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -54,16 +59,21 @@
namespace Fur.EntityFramework.Core
{
public class TenantSeedData : IEntitySeedData<Tenant, MultiTenantDbContextLocator>
{
public IEnumerable<Tenant> HasData(DbContext dbContext, Type dbContextLocator)
{
return new List<Tenant>
{
new Tenant
{
TenantId=Guid.Parse("383AFB88-F519-FFF8-B364-6D563BF3687F"),
Name="默认租户",
Host="localhost:44313",
CreatedTime=DateTime.Parse("2020-10-06 20:19:07"),
Schema="dbo" // Schema
},
new Tenant
{
TenantId=Guid.Parse("C5798CB6-16D6-0F42-EB56-59C695353BC0"),
Name="其他租户",
Host="localhost:5000",
CreatedTime=DateTime.Parse("2020-10-06 20:20:32"),
Schema="fur" // Schema
}
};
}
}
}
特别说明

该步骤只在 Code First 方式执行,Database First 无需配置种子数据。

10.7.4 根据模型创建 Tenant

Add-Migration add_tenant_table -Context MultiTenantDbContext
Update-Database -Context MultiTenantDbContext

10.7.5 实现 IMultiTenantOnSchema 接口

在需要多租户的数据库上下文中实现 IMultiTenantOnSchema 接口,如:

using Fur.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
namespace Fur.EntityFramework.Core
{
[AppDbContext("Sqlite3ConnectionString")]
public class FurDbContext : AppDbContext<FurDbContext>, IMultiTenantOnSchema
{
public FurDbContext(DbContextOptions<FurDbContext> options) : base(options)
{
}
public string GetSchemaName()
{
return base.Tenant?.Schema;
}
}
}

10.7.6 关于 Code First 数据迁移

基于 Schema 方式比较特别,生成数据迁移的时候没办法获取租户信息,所以建议分开多次迁移,如:

public string GetSchemaName()
{
return base.Tenant?.Schema?? "租户一Schema";
}
public string GetSchemaName()
{
return base.Tenant?.Schema?? "租户二Schema";
}

这样就可以在迁移的时候生成多次迁移了。

10.8 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/signalr/index.html b/docs/docs/signalr/index.html index e93c09e455f..3e1cbd46d7c 100644 --- a/docs/docs/signalr/index.html +++ b/docs/docs/signalr/index.html @@ -5,31 +5,41 @@ 23. 即时通讯 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/source/index.html b/docs/docs/source/index.html index dfbade61046..7f6723b2fc0 100644 --- a/docs/docs/source/index.html +++ b/docs/docs/source/index.html @@ -5,17 +5,22 @@ 1.3 源码结构 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -52,16 +57,21 @@
#Style - qualification options
#prefer fields not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_field = false:suggestion
#prefer methods not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_method = false:suggestion
#prefer properties not to be prefaced with this. or Me. in Visual Basic
dotnet_style_qualification_for_property = false:suggestion
# Add file header
file_header_template = -----------------------------------------------------------------------------\nFur 是 .NET 5 平台下极易入门、极速开发的 Web 应用框架。\nCopyright © 2020 Fur, Baiqian Co.,Ltd.\n\n框架名称:Fur\n框架作者:百小僧\n框架版本:1.0.0\n源码地址:Gitee:https://gitee.com/monksoul/Fur \n Github:https://github.com/monksoul/Fur \n开源协议:Apache-2.0(http://www.apache.org/licenses/LICENSE-2.0)\n-----------------------------------------------------------------------------

1.2.4 Fur 核心层

Fur 核心层是 Fur 框架的中心,也是 Fur 能够支撑起来的必备层。

源码结构:

Fur
├─Fur.csproj
├─Fur.csproj.user
├─FurStartup.cs
├─ViewEngine
| ├─IViewEngine.cs
| ├─ViewEngine.cs
| ├─Templates
| | ├─IViewEngineCompiledTemplate.cs
| | ├─IViewEngineTemplate.cs
| | ├─ViewEngineCompiledTemplate.cs
| | └ViewEngineTemplate.cs
| ├─Options
| | └ViewEngineCompilationOptions.cs
| ├─Models
| | └AnonymousTypeWrapper.cs
| ├─Exceptions
| | ├─ViewEngineCompilationException.cs
| | └ViewEngineException.cs
| ├─Compilations
| | ├─IViewEngineCompilationOptionsBuilder.cs
| | └ViewEngineCompilationOptionsBuilder.cs
├─UnifyResult
| ├─Providers
| | ├─IUnifyResultProvider.cs
| | └RESTfulResultProvider.cs
| ├─Models
| | └RESTfulResult.cs
| ├─Filters
| | └SuccessUnifyResultFilter.cs
| ├─Extensions
| | └UnifyResultServiceCollectionExtensions.cs
├─SpecificationDocument
| ├─Options
| | └SpecificationDocumentSettingsOptions.cs
| ├─Models
| | ├─GroupOrder.cs
| | ├─SpecificationOpenApiInfo.cs
| | ├─SpecificationOpenApiSecurityRequirementItem.cs
| | └SpecificationOpenApiSecurityScheme.cs
| ├─Extensions
| | ├─SpecificationDocumentApplicationBuilderExtensions.cs
| | └SpecificationDocumentServiceCollectionExtensions.cs
| ├─Builders
| | └SpecificationDocumentBuilder.cs
| ├─Assets
| | └index-mini-profiler.html
├─ObjectMapper
| ├─Extensions
| | └ObjectMapperServiceCollectionExtensions.cs
| ├─Dependencies
| | └IObjectMapper.cs
├─LinqBuilder
| ├─Visitors
| | └ParameterReplaceExpressionVisitor.cs
| ├─Extensions
| | └LinqExtensions.cs
| ├─Builders
| | └LinqExpression.cs
├─FriendlyException
| ├─Oops.cs
| ├─Providers
| | └IErrorCodeTypeProvider.cs
| ├─Options
| | └ErrorCodeMessageSettingsOptions.cs
| ├─Models
| | └MethodIfException.cs
| ├─Filters
| | └FriendlyExceptionFilter.cs
| ├─Extensions
| | └FriendlyExceptionServiceCollectionExtensions.cs
| ├─Attributes
| | ├─ErrorCodeItemMetadataAttribute.cs
| | ├─ErrorCodeTypeAttribute.cs
| | └IfExceptionAttribute.cs
├─DynamicApiController
| ├─Penetrates.cs
| ├─Providers
| | └DynamicApiControllerFeatureProvider.cs
| ├─Options
| | └DynamicApiControllerSettingsOptions.cs
| ├─Models
| | └ParameterRouteTemplate.cs
| ├─Extensions
| | └DynamicApiControllerServiceCollectionExtensions.cs
| ├─Enums
| | └ApiSeats.cs
| ├─Dependencies
| | └IDynamicApiController.cs
| ├─Conventions
| | └DynamicApiControllerApplicationModelConvention.cs
| ├─Attributes
| | ├─ApiDescriptionSettingsAttribute.cs
| | ├─ApiSeatAttribute.cs
| | └DynamicApiControllerAttribute.cs
├─DependencyInjection
| ├─Options
| | └DependencyInjectionSettingsOptions.cs
| ├─Models
| | └ExternalService.cs
| ├─Extensions
| | └DependencyInjectionServiceCollectionExtensions.cs
| ├─Enums
| | ├─InjectionActions.cs
| | ├─InjectionPatterns.cs
| | └RegisterType.cs
| ├─Dependencies
| | ├─IPrivateDependency.cs
| | ├─IScoped.cs
| | ├─ISingleton.cs
| | ├─ITransient.cs
| | ├─Proxies
| | | └IDispatchProxy.cs
| ├─Attributes
| | ├─InjectionAttribute.cs
| | └SkipScanAttribute.cs
├─DataValidation
| ├─Validators
| | └DataValidator.cs
| ├─Providers
| | └IValidationMessageTypeProvider.cs
| ├─Options
| | └ValidationTypeMessageSettingsOptions.cs
| ├─Models
| | └DataValidationResult.cs
| ├─Filters
| | └DataValidationFilter.cs
| ├─Extensions
| | ├─DataValidationExtensions.cs
| | └DataValidationServiceCollectionExtensions.cs
| ├─Enums
| | ├─ValidationPattern.cs
| | └ValidationTypes.cs
| ├─Attributes
| | ├─DataValidationAttribute.cs
| | ├─NonValidationAttribute.cs
| | ├─ValidationItemMetadataAttribute.cs
| | ├─ValidationMessageAttribute.cs
| | ├─ValidationMessageTypeAttribute.cs
| | └ValidationTypeAttribute.cs
├─DataEncryption
| ├─AESEncryption.cs
| ├─DESCEncryption.cs
| └MD5Encryption.cs
├─DatabaseAccessor
| ├─UnitOfWork
| | ├─Filters
| | | └UnitOfWorkFilter.cs
| | ├─Attributes
| | | ├─NonTransactAttribute.cs
| | | └UnitOfWorkAttribute.cs
| ├─Repositories
| | ├─EFCoreRepository.cs
| | ├─IMSRepository.cs
| | ├─IRepository.cs
| | ├─ISqlRepository.cs
| | ├─MSRepository.cs
| | ├─SqlRepository.cs
| | ├─Implantations
| | | ├─DeletableRepository.cs
| | | ├─InsertableRepository.cs
| | | ├─OperableRepository.cs
| | | ├─ReadableRepository.cs
| | | ├─SqlExecutableRepository.cs
| | | ├─SqlReaderRepository.cs
| | | ├─UpdateableRepository.cs
| | | └WritableRepository.cs
| | ├─Dependencies
| | | ├─IDeletableRepository.cs
| | | ├─IInsertableRepository.cs
| | | ├─IOperableRepository.cs
| | | ├─IReadableRepository.cs
| | | ├─IRepositoryDependency.cs
| | | ├─ISqlExecutableRepository.cs
| | | ├─ISqlReaderRepository.cs
| | | ├─IUpdateableRepository.cs
| | | └IWritableRepository.cs
| ├─Pools
| | ├─DbContextPool.cs
| | └IDbContextPool.cs
| ├─MultiTenants
| | ├─Locators
| | | └MultiTenantDbContextLocator.cs
| | ├─Enums
| | | └MultiTenantOptions.cs
| | ├─Entities
| | | └Tenant.cs
| | ├─Dependencies
| | | ├─IMultiTenantOnDatabase.cs
| | | ├─IMultiTenantOnSchema.cs
| | | ├─IMultiTenantOnTable.cs
| | | └IPrivateMultiTenant.cs
| ├─Models
| | ├─DbProvider.cs
| | ├─PagedList.cs
| | ├─ProcedureOutputResult.cs
| | ├─ProcedureOutputValue.cs
| | ├─SqlTemplate.cs
| | └SqlTemplateParameter.cs
| ├─Locators
| | ├─IDbContextLocator.cs
| | └MasterDbContextLocator.cs
| ├─Interceptors
| | ├─DbContextSaveChangesInterceptor.cs
| | ├─SqlCommandProfilerInterceptor.cs
| | └SqlConnectionProfilerInterceptor.cs
| ├─Helpers
| | └DbHelpers.cs
| ├─Extensions
| | ├─DatabaseAccessorServiceCollectionExtensions.cs
| | ├─PagedQueryableExtensions.cs
| | ├─Repositories
| | | ├─IEntityExtensions.cs
| | | ├─IEntityWithDbContextLocatorExtensions.cs
| | | └SqlExtensions.cs
| | ├─DatabaseProvider
| | | ├─DatabaseProviderServiceCollectionExtensions.cs
| | | └Penetrates.cs
| | ├─DatabaseFacade
| | | ├─DbDataConvertExtensions.cs
| | | ├─DbObjectExtensions.cs
| | | └SqlAdoNetExtensions.cs
| ├─Enums
| | ├─DbFunctionType.cs
| | ├─EFCoreErrorCodes.cs
| | └ManualOptions.cs
| ├─Entities
| | ├─Dependencies
| | | ├─Entity.cs
| | | ├─EntityBase.cs
| | | ├─EntityNotKey.cs
| | | ├─IEntity.cs
| | | └IEntityNotKey.cs
| | ├─Configures
| | | ├─IEntitySeedData.cs
| | | ├─IEntityTypeBuilder.cs
| | | ├─IModelBuilderFilter.cs
| | | └IPrivateModelBuilder.cs
| | ├─Attributes
| | | ├─FakeDeleteAttribute.cs
| | | ├─NonAutomaticAttribute.cs
| | | └QueryableFunctionAttribute.cs
| ├─DynamicModels
| | ├─DynamicModelCacheKeyFactory.cs
| | └IEntityMutableTable.cs
| ├─Contexts
| | ├─AppDbContext.cs
| | ├─Builders
| | | ├─AppDbContextBuilder.cs
| | | ├─Models
| | | | └DbContextCorrelationType.cs
| | ├─Attributes
| | | └AppDbContextAttribute.cs
| ├─Attributes
| | └DbParameterAttribute.cs
| ├─Advances
| | ├─Proxies
| | | └SqlDispatchProxy.cs
| | ├─Models
| | | └SqlProxyMethod.cs
| | ├─Dependencies
| | | └ISqlDispatchProxy.cs
| | ├─Attributes
| | | ├─SqlExecuteAttribute.cs
| | | ├─SqlFunctionAttribute.cs
| | | ├─SqlProcedureAttribute.cs
| | | ├─Basics
| | | | ├─SqlObjectProxyAttribute.cs
| | | | ├─SqlProxyAttribute.cs
| | | | └SqlSentenceProxyAttribute.cs
├─CorsAccessor
| ├─Options
| | └CorsAccessorSettingsOptions.cs
| ├─Extensions
| | ├─CorsAccessorApplicationBuilderExtensions.cs
| | └CorsAccessorServiceCollectionExtensions.cs
├─ConfigurableOptions
| ├─Options
| | └IConfigurableOptions.cs
| ├─Extensions
| | └ConfigurableOptionsServiceCollectionExtensions.cs
| ├─Attributes
| | └OptionsSettingsAttribute.cs
├─Authorization
| ├─Penetrates.cs
| ├─Requirements
| | └AuthorizePolicyRequirement.cs
| ├─Providers
| | └AuthorizePolicyProvider.cs
| ├─Options
| | └JWTSettingsOptions.cs
| ├─Handlers
| | └AuthorizePolicyHandler.cs
| ├─Extensions
| | └PolicyAuthorizationServiceCollectionExtensions.cs
| ├─Attributes
| | └AuthorizePolicyAttribute.cs
├─App
| ├─App.cs
| ├─Startups
| | ├─AppStartup.cs
| | └HostingStartup.cs
| ├─Options
| | └AppSettingsOptions.cs
| ├─Filters
| | └StartupFilter.cs
| ├─Extensions
| | ├─AppApplicationBuilderExtensions.cs
| | ├─AppServiceCollectionExtensions.cs
| | ├─WebHostBuilderExtensions.cs
| | ├─Types
| | | └ObjectExtensions.cs
| ├─Attributes
| | └AppStartupAttribute.cs

1.2.5 Fur.Application 业务应用层

Fur.Application 业务应用层是最常用的层,几乎所有的业务代码都在这个层中编写。

源码结构:

Fur.Application
├─Fur.Application.Core.csproj
├─Fur.Application.Core.xml
└FurApplicationStartup.cs

1.2.6 Fur.Core 仓储实体层

Fur.Core 主要是存储自定义仓储和定义实体的层。

源码结构:

Fur.Core
├─Fur.Core.csproj
└FurCoreStartup.cs

1.2.7 Fur.Database.Migrations 数据库架构维护层

Fur.Database.Migrations 主要是用来存放 Database FirstCode First 生成的维护文件。

源码结构:

Fur.Database.Migrations
└Fur.Database.Migrations.csproj

1.2.8 Fur.EntityFramework.Core 数据库上下文配置层

Fur.EntityFramework.Core 主要是用来配置数据库上下文和其他数据库相关配置信息的。

源码结构:

Fur.EntityFramework.Core
└Fur.EntityFramework.Core.csproj

1.2.9 Fur.Web.Core 应用核心层

Fur.Web.Core 主要是用来配置 Web 入口一些代码,如 FilterMiddlewares 等。

源码结构:

Fur.Web.Core
├─Fur.Web.Core.xml
└FurWebCoreStartup.cs

1.2.10 Fur.Web.Entry 应用入口层

Fur.Web.Entry 是我们的应用层,也就是我们的 Web 项目层,发布层。

源码结构:

Fur.Web.Entry
├─appsettings.Development.json
├─appsettings.json
├─Fur.Web.Entry.csproj
├─Fur.Web.Entry.csproj.user
├─Fur.Web.Entry.xml
├─Program.cs
├─Startup.cs
├─wwwroot
| └README.md
├─Properties
| └launchSettings.json
├─Controllers
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/specification-document/index.html b/docs/docs/specification-document/index.html index 59c08cfb444..56712904260 100644 --- a/docs/docs/specification-document/index.html +++ b/docs/docs/specification-document/index.html @@ -5,17 +5,22 @@ 6. 规范化接口文档 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -47,16 +52,21 @@
/// <summary>
/// 成功返回值
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public IActionResult OnSuccessed(ActionExecutedContext context)
{
object data;
// 处理内容结果
if (context.Result is ContentResult contentResult) data = contentResult.Content;
// 处理对象结果
else if (context.Result is ObjectResult objectResult) data = objectResult.Value;
else return null;
return new JsonResult(new RESTfulResult
{
StatusCode = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK,
Successed = true,
Data = data,
Errors = null
});
}
/// <summary>
/// 验证失败返回值
/// </summary>
/// <param name="context"></param>
/// <param name="modelStates"></param>
/// <param name="validationResults"></param>
/// <param name="validateFaildMessage"></param>
/// <returns></returns>
public IActionResult OnValidateFailed(ActionExecutingContext context, ModelStateDictionary modelStates, Dictionary<string, IEnumerable<string>> validationResults, string validateFaildMessage)
{
return new JsonResult(new RESTfulResult
{
StatusCode = StatusCodes.Status400BadRequest,
Successed = false,
Data = null,
Errors = validationResults
});
}
}
}

之后在 Startup.cs 中注册即可:

services.AddControllers().AddUnifyResult<RESTfulResult, RESTfulResultProvider>();

6.8 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/split-db/index.html b/docs/docs/split-db/index.html index 8b463468081..9ce40c6bbe2 100644 --- a/docs/docs/split-db/index.html +++ b/docs/docs/split-db/index.html @@ -5,17 +5,22 @@ 9.27 分表分库 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -24,16 +29,21 @@ 例如按时间字段分片,有些分片存储最近时间段内的数据,可能会被频繁的读写,而有些分片存储的历史数据,则很少被查询

9.27.4.3 一致性 Hash 算法

一致性 Hash 算法能很好的解决因为 Hash 取模而产生的分片集群扩容时,需要迁移旧的数据的难题。具体原理可参考 https://www.cnblogs.com/duhuo/p/4996105.html

9.27.5 分库分表带来的问题

任何事情都有两面性,分库分表也不例外,如果采用分库分表,会引入新的的问题:

9.27.5.1 分布式事务问题

使用分布式事务中间件解决,具体是通过最终一致性还是强一致性分布式事务,看业务需求,这里就不多说。

9.27.5.2 跨节点关联查询 Join 问题

切分之前,我们可以通过 Join 来完成。而切分之后,数据可能分布在不同的节点上,此时 Join 带来的问题就比较麻烦了,考虑到性能,尽量避免使用 Join 查询。

解决这个问题的一些方法:

  • 全局表

全局表,也可看做是 "数据字典表",就是系统中所有模块都可能依赖的一些表,为了避免跨库 Join 查询,可以将 这类表在每个数据库中都保存一份。这些数据通常

很少会进行修改,所以也不担心一致性的问题。

  • 字段冗余

利用空间换时间,为了性能而避免 join 查询。例:订单表保存 userId 时候,也将 userName 冗余保存一份,这样查询订单详情时就不需要再去查询"买家 user 表"了。

  • 数据组装

在系统层面,分两次查询。第一次查询的结果集中找出关联数据 id,然后根据 id 发起第二次请求得到关联数据。最后将获得到的数据进行字段拼装。

9.27.5.3 跨节点分页、排序、函数问题

跨节点多库进行查询时,会出现 Limit 分页、Order by 排序等问题。分页需要按照指定字段进行排序,当排序字段就是分片字段时,通过分片规则就比较容易定位到指定的分片;

当排序字段非分片字段时,就变得比较复杂了。需要先在不同的分片节点中将数据进行排序并返回,然后将不同分片返回的结果集进行汇总和再次排序,最终返回给用户。

9.27.5.4 全局主键避重问题

如果都用主键自增肯定不合理,如果用 UUID 那么无法做到根据主键排序,所以我们可以考虑通过雪花 ID 来作为数据库的主键,

9.27.5.5 数据迁移问题

采用双写的方式,修改代码,所有涉及到分库分表的表的增、删、改的代码,都要对新库进行增删改。同时,再有一个数据抽取服务,不断地从老库抽数据,往新库写,

边写边按时间比较数据是不是最新的。

9.27.6 如何实现

特别说明

由于分表分库不仅仅需要内置代码的支持,同时还需要集成数据库中间件,这里推荐 MyCat 中间件。MyCat 官方网站

Fur 框架中提供了轻量级的 分表分库 支持:

  • 动态切换数据库
// 直接改变数据库
repository.ChangeDatabase("数据库连接字符串");
// 通过数据库上下文定位器切换
repository.Change<Entity, MyDbContextLocator2>();

如需跨库查询,需用到数据库技术,如 SqlServer 链接服务器或同义词。

  • 动态切换数据库表
// 直接改变表,会有多线程操作bug,同时无法刷新模型
repository.ChangeTable("数据库表");
// 创建新的 DbContext,然后刷新 OnModelCreating(推荐方式)
var dynamicDbContextResolve = App.TransientServices.GetService<Func<Type, IScoped, DbContext>>();
var dynamicDbContext = dynamicDbContextResolve(typeof(MyDbContextLocator), default);
// 重新调用 OnModelCreating,在 OnModelCreating 中配置 ToTable("动态表") 即可。
DynamicModelCacheKeyFactory.RebuildModels();
var persons= dynamicDbContext.Set<Person>();
persons.Add(new Person{});
了解更多

想了解更多 DynamicModelCacheKeyFactory 知识可查阅 EF Core - 多个模型之间交替 章节。

9.27.7 反馈与建议

与我们交流

给 Fur 提 Issue

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/tran/index.html b/docs/docs/tran/index.html index 3b8d5ba65cd..81aee854893 100644 --- a/docs/docs/tran/index.html +++ b/docs/docs/tran/index.html @@ -5,17 +5,22 @@ 9.25 事务和工作单元 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
@@ -23,16 +28,21 @@
_testRepository.Insert(new Blog { Url = "http://blogs.msdn.com/visualstudio" });
_testRepository.SaveChanges();
var blogs = _testRepository.Entity
.OrderBy(b => b.Url)
.ToList();
// 提交事务
transaction.Commit();
}
catch (Exception)
{
// 回滚事务
transaction.RollBack();
}
}

9.25.4 工作单元特性说明

9.25.4.1 [UnitOfWork]

[UnitOfWork] 特性用来标记事务信息,如作用范围,隔离级别等。

  • Enabled:是否启动工作单元,默认 true
  • ScopeOption:定义事务范围行为,默认 TransactionScopeOption.Required
  • IsolationLevel:设置事务隔离级别,默认 IsolationLevel.ReadCommitted;
  • AsyncFlowOption:允许跨线程连续任务的事务流,如有异步操作需开启该选项,默认开启
特别注意

一旦方法贴了 [UnitOfWork(false)] 特性后,那么该方法不再启用工作单元模式,也就是不包含事务,也不会自动提交数据库。慎用!

9.25.4.2 [NonTransact]

一但方法或类贴了 [NonTransact] 特性,那么将关闭事务操作,但是还是会自动保存数据库到数据。

9.25.5 常见错误

  • A TransactionScope must be disposed on the same thread that it was created.

只需要在当前操作方法上贴 [NonTransact] 特性即可。

9.25.6 反馈与建议

与我们交流

给 Fur 提 Issue


了解更多

想了解更多 事务 知识可查阅 EF Core - 使用事务 章节。

- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/unittest/index.html b/docs/docs/unittest/index.html index c68d73faa04..580d2060a0d 100644 --- a/docs/docs/unittest/index.html +++ b/docs/docs/unittest/index.html @@ -5,31 +5,41 @@ 27.1 单元测试 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/docs/view-engine/index.html b/docs/docs/view-engine/index.html index e2b3fc8b02e..87e7ecf4b77 100644 --- a/docs/docs/view-engine/index.html +++ b/docs/docs/view-engine/index.html @@ -5,31 +5,41 @@ 17. 视图引擎 | Fur - - - - - - - - + + + + + + + + + + + + + - - + +
- - - - - - - - + + + + + + + + + + + + + - - + + \ No newline at end of file diff --git a/docs/e0678751.32876613.js b/docs/e0678751.1b3a8d90.js similarity index 87% rename from docs/e0678751.32876613.js rename to docs/e0678751.1b3a8d90.js index 919c0801a0e..6a0e208e422 100644 --- a/docs/e0678751.32876613.js +++ b/docs/e0678751.1b3a8d90.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[73],{127:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return o})),t.d(n,"metadata",(function(){return p})),t.d(n,"rightToc",(function(){return s})),t.d(n,"default",(function(){return m}));var i=t(2),a=t(6),r=(t(0),t(142)),c=t(144),l=t(149),b=t(150),o={id:"specification-document",title:"6. \u89c4\u8303\u5316\u63a5\u53e3\u6587\u6863",sidebar_label:"6. \u89c4\u8303\u5316\u63a5\u53e3\u6587\u6863"},p={unversionedId:"specification-document",id:"specification-document",isDocsHomePage:!1,title:"6. \u89c4\u8303\u5316\u63a5\u53e3\u6587\u6863",description:"6.1 \u4ec0\u4e48\u662f\u63a5\u53e3\u6587\u6863",source:"@site/docs\\specification-document.mdx",slug:"/specification-document",permalink:"/docs/specification-document",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/specification-document.mdx",version:"current",sidebar_label:"6. \u89c4\u8303\u5316\u63a5\u53e3\u6587\u6863",sidebar:"docs",previous:{title:"5. \u52a8\u6001 WebAPI",permalink:"/docs/dynamic-api-controller"},next:{title:"7. \u53cb\u597d\u5f02\u5e38\u5904\u7406",permalink:"/docs/friendly-exception"}},s=[{value:"6.1 \u4ec0\u4e48\u662f\u63a5\u53e3\u6587\u6863",id:"61-\u4ec0\u4e48\u662f\u63a5\u53e3\u6587\u6863",children:[]},{value:"6.2 \u4e3a\u4ec0\u4e48\u8981\u5199\u63a5\u53e3\u6587\u6863",id:"62-\u4e3a\u4ec0\u4e48\u8981\u5199\u63a5\u53e3\u6587\u6863",children:[]},{value:"6.3 \u4e3a\u4ec0\u4e48\u9700\u8981\u89c4\u8303\u5316\u6587\u6863",id:"63-\u4e3a\u4ec0\u4e48\u9700\u8981\u89c4\u8303\u5316\u6587\u6863",children:[{value:"6.3.1 \u534f\u8bae\u89c4\u8303",id:"631-\u534f\u8bae\u89c4\u8303",children:[]},{value:"6.3.2 \u63a5\u53e3\u8def\u5f84\u89c4\u8303",id:"632-\u63a5\u53e3\u8def\u5f84\u89c4\u8303",children:[]},{value:"6.3.3 \u7248\u672c\u63a7\u5236\u89c4\u8303",id:"633-\u7248\u672c\u63a7\u5236\u89c4\u8303",children:[]},{value:"6.3.4 \u63a5\u53e3\u547d\u540d\u89c4\u8303",id:"634-\u63a5\u53e3\u547d\u540d\u89c4\u8303",children:[]},{value:"6.3.5 \u8bf7\u6c42\u53c2\u6570\u89c4\u8303",id:"635-\u8bf7\u6c42\u53c2\u6570\u89c4\u8303",children:[]},{value:"6.3.6 \u8fd4\u56de\u6570\u636e\u89c4\u8303",id:"636-\u8fd4\u56de\u6570\u636e\u89c4\u8303",children:[]}]},{value:"6.4 \u4ec0\u4e48\u662f Swagger",id:"64-\u4ec0\u4e48\u662f-swagger",children:[]},{value:"6.5 Swagger \u4f7f\u7528",id:"65-swagger-\u4f7f\u7528",children:[{value:"6.5.1 \u6ce8\u518c\u670d\u52a1",id:"651-\u6ce8\u518c\u670d\u52a1",children:[]},{value:"6.5.2 \u9ed8\u8ba4\u5730\u5740",id:"652-\u9ed8\u8ba4\u5730\u5740",children:[]},{value:"6.5.3 \u9ed8\u8ba4\u5206\u7ec4",id:"653-\u9ed8\u8ba4\u5206\u7ec4",children:[]},{value:"6.5.4 \u6587\u6863\u6ce8\u91ca",id:"654-\u6587\u6863\u6ce8\u91ca",children:[]},{value:"6.5.5 \u591a\u5206\u7ec4\u652f\u6301",id:"655-\u591a\u5206\u7ec4\u652f\u6301",children:[]},{value:"6.5.6 \u591a\u5206\u7ec4\u6392\u5e8f",id:"656-\u591a\u5206\u7ec4\u6392\u5e8f",children:[]},{value:"6.5.7 \u591a\u5206\u7ec4\u4fe1\u606f\u914d\u7f6e",id:"657-\u591a\u5206\u7ec4\u4fe1\u606f\u914d\u7f6e",children:[]},{value:"6.5.8 \u7ec4\u4e2d\u7ec4\uff08\u6807\u7b7e\uff09",id:"658-\u7ec4\u4e2d\u7ec4\uff08\u6807\u7b7e\uff09",children:[]},{value:"6.5.9 \u9ed8\u8ba4\u5c55\u5f00\u6240\u6709\u6587\u6863",id:"659-\u9ed8\u8ba4\u5c55\u5f00\u6240\u6709\u6587\u6863",children:[]},{value:"6.5.10 \u914d\u7f6e\u6587\u6863\u6807\u9898",id:"6510-\u914d\u7f6e\u6587\u6863\u6807\u9898",children:[]},{value:"6.5.11 \u6388\u6743\u63a7\u5236",id:"6511-\u6388\u6743\u63a7\u5236",children:[]},{value:"6.5.12 \u5728\u7ebf\u6d4b\u8bd5",id:"6512-\u5728\u7ebf\u6d4b\u8bd5",children:[]},{value:"6.5.13 \u6027\u80fd\u76d1\u89c6 MiniProfiler",id:"6513-\u6027\u80fd\u76d1\u89c6-miniprofiler",children:[]},{value:"6.5.14 \u5b9a\u4e49\u63a5\u53e3\u8f93\u51fa\u7c7b\u578b",id:"6514-\u5b9a\u4e49\u63a5\u53e3\u8f93\u51fa\u7c7b\u578b",children:[]}]},{value:"6.6 SpecificationDocumentSettings \u914d\u7f6e",id:"66-specificationdocumentsettings-\u914d\u7f6e",children:[]},{value:"6.7 \u7edf\u4e00\u8fd4\u56de\u503c\u6a21\u578b",id:"67-\u7edf\u4e00\u8fd4\u56de\u503c\u6a21\u578b",children:[]},{value:"6.8 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"68-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],u={rightToc:s};function m(e){var n=e.components,t=Object(a.a)(e,["components"]);return Object(r.b)("wrapper",Object(i.a)({},u,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"61-\u4ec0\u4e48\u662f\u63a5\u53e3\u6587\u6863"},"6.1 \u4ec0\u4e48\u662f\u63a5\u53e3\u6587\u6863"),Object(r.b)("p",null,"\u5728\u73b0\u5728\u79fb\u52a8\u4e3a\u738b\u3001\u591a\u7aef\u4e92\u8f85\u3001\u524d\u7aef\u767e\u82b1\u9f50\u653e\u7684\u5f00\u653e\u65f6\u4ee3\uff0c\u4e0d\u518d\u662f\u4e00\u4eba\u5305\u63fd\u5f0f\u5f00\u53d1\uff0c\u5927\u5bb6\u5404\u53f8\u5176\u804c\uff0c\u540e\u7aef\u5de5\u7a0b\u5e08\u8d1f\u8d23\u63a5\u53e3\u5f00\u53d1\uff0c\u524d\u7aef\u8d1f\u8d23\u63a5\u53e3\u8054\u8c03\uff0c\u4e5f\u5c31\u662f\u4e92\u8054\u7f51\u73b0\u5728\u6d41\u884c\u7684\u524d\u540e\u7aef\u5206\u79bb\u67b6\u6784\u3002"),Object(r.b)("p",null,"\u6240\u4ee5\u5c31\u9700\u8981\u7531\u524d\u540e\u7aef\u5de5\u7a0b\u5e08\u5171\u540c\u5b9a\u4e49\u63a5\u53e3\uff0c\u7f16\u5199\u63a5\u53e3\u6587\u6863\uff0c\u4e4b\u540e\u5927\u5bb6\u6309\u7167\u8fd9\u4e2a\u63a5\u53e3\u6587\u6863\u8fdb\u884c\u5f00\u53d1\u3001\u7ef4\u62a4\u53ca\u5f00\u653e\u7ed9\u7b2c\u4e09\u65b9\u3002"),Object(r.b)("h2",{id:"62-\u4e3a\u4ec0\u4e48\u8981\u5199\u63a5\u53e3\u6587\u6863"},"6.2 \u4e3a\u4ec0\u4e48\u8981\u5199\u63a5\u53e3\u6587\u6863"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u80fd\u591f\u8ba9\u524d\u7aef\u5f00\u53d1\u4e0e\u540e\u53f0\u5f00\u53d1\u4eba\u5458\u66f4\u597d\u7684\u914d\u5408\uff0c\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387"),Object(r.b)("li",{parentName:"ul"},"\u9879\u76ee\u8fed\u4ee3\u6216\u8005\u9879\u76ee\u4eba\u5458\u66f4\u8fed\u65f6\uff0c\u65b9\u4fbf\u540e\u671f\u4eba\u5458\u67e5\u770b\u548c\u7ef4\u62a4"),Object(r.b)("li",{parentName:"ul"},"\u65b9\u4fbf\u6d4b\u8bd5\u4eba\u5458\u8fdb\u884c\u63a5\u53e3\u6d4b\u8bd5")),Object(r.b)("h2",{id:"63-\u4e3a\u4ec0\u4e48\u9700\u8981\u89c4\u8303\u5316\u6587\u6863"},"6.3 \u4e3a\u4ec0\u4e48\u9700\u8981\u89c4\u8303\u5316\u6587\u6863"),Object(r.b)("p",null,"\u7531\u4e8e\u6bcf\u4e2a\u516c\u53f8\u540e\u7aef\u4eba\u5458\u6280\u672f\u53c2\u5dee\u4e0d\u9f50\uff0c\u6280\u672f\u6587\u6863\u80fd\u529b\u4e5f\u4e0d\u4f8b\u5916\uff0c\u5bfc\u81f4\u63a5\u53e3\u5b9a\u4e49\u53ca\u6587\u6863\u4e94\u82b1\u516b\u95e8\uff0c\u4e0d\u540c\u9879\u76ee\u6216\u4e0d\u540c\u516c\u53f8\u5bf9\u63a5\u6781\u5176\u56f0\u96be\uff0c\u800c\u4e14\u4f53\u9a8c\u7cdf\u7cd5\u3002\u6240\u4ee5\uff0c\u65e0\u89c4\u77e9\u4e0d\u6210\u65b9\u5706\uff0c\u4e3a\u4e86\u5f00\u53d1\u4eba\u5458\u95f4\u66f4\u597d\u7684\u914d\u5408\uff0c\u8feb\u5207\u9700\u8981\u6574\u7406\u51fa\u4e00\u5957\u89c4\u8303\u3002"),Object(r.b)("p",null,"\u901a\u5e38\u63a5\u53e3\u89c4\u8303\u5206\u4e3a\u516d\u4e2a\u90e8\u5206\uff1a"),Object(r.b)("h3",{id:"631-\u534f\u8bae\u89c4\u8303"},"6.3.1 \u534f\u8bae\u89c4\u8303"),Object(r.b)("p",null,"\u4e3a\u4e86\u786e\u4fdd\u4e0d\u540c\u7cfb\u7edf/\u6a21\u5757\u95f4\u7684\u6570\u636e\u4ea4\u4e92\uff0c\u9700\u8981\u4e8b\u5148\u7ea6\u5b9a\u597d\u901a\u8baf\u534f\u8bae\uff0c\u5982\uff1aTCP\u3001HTTP\u3001HTTPS \u534f\u8bae\u3002\u4e3a\u4e86\u786e\u4fdd\u6570\u636e\u4ea4\u4e92\u5b89\u5168\uff0c\u5efa\u8bae\u4f7f\u7528 HTTPS \u534f\u8bae"),Object(r.b)("h3",{id:"632-\u63a5\u53e3\u8def\u5f84\u89c4\u8303"},"6.3.2 \u63a5\u53e3\u8def\u5f84\u89c4\u8303"),Object(r.b)("p",null,"\u4f5c\u4e3a\u63a5\u53e3\u8def\u5f84\uff0c\u4e3a\u4e86\u65b9\u4fbf\u6e05\u6670\u7684\u533a\u5206\u6765\u81ea\u4e0d\u540c\u7684\u7cfb\u7edf\uff0c\u53ef\u4ee5\u91c7\u7528\u4e0d\u540c\u7cfb\u7edf/\u6a21\u5757\u540d\u4f5c\u4e3a\u63a5\u53e3\u8def\u5f84\u524d\u7f00\uff0c\u5982\uff1a\u652f\u4ed8\u6a21\u5757\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"/pay/xxx"),"\uff0c\u8ba2\u5355\u6a21\u5757\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"/order/xxx")),Object(r.b)("h3",{id:"633-\u7248\u672c\u63a7\u5236\u89c4\u8303"},"6.3.3 \u7248\u672c\u63a7\u5236\u89c4\u8303"),Object(r.b)("p",null,'\u4e3a\u4e86\u4fbf\u4e8e\u540e\u671f\u63a5\u53e3\u7684\u5347\u7ea7\u548c\u7ef4\u62a4\uff0c\u5efa\u8bae\u5728\u63a5\u53e3\u8def\u5f84\u4e2d\u52a0\u5165\u7248\u672c\u53f7\uff0c\u4fbf\u4e8e\u7ba1\u7406\uff0c\u5b9e\u73b0\u63a5\u53e3\u591a\u7248\u672c\u7684\u53ef\u7ef4\u62a4\u6027\u3002\u5982\uff1a\u63a5\u53e3\u8def\u5f84\u4e2d\u6dfb\u52a0\u7c7b\u4f3c"',Object(r.b)("inlineCode",{parentName:"p"},"v1"),'"\u3001"',Object(r.b)("inlineCode",{parentName:"p"},"v2"),'"\u7b49\u7248\u672c\u53f7'),Object(r.b)("h3",{id:"634-\u63a5\u53e3\u547d\u540d\u89c4\u8303"},"6.3.4 \u63a5\u53e3\u547d\u540d\u89c4\u8303"),Object(r.b)("p",null,'\u548c C# \u547d\u540d\u89c4\u8303\u4e00\u6837\uff0c\u597d\u7684\u3001\u7edf\u4e00\u7684\u63a5\u53e3\u547d\u540d\u89c4\u8303\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u589e\u5f3a\u5176\u53ef\u8bfb\u6027\uff0c\u800c\u4e14\u8fd8\u4f1a\u51cf\u5c11\u5f88\u591a\u4e0d\u5fc5\u8981\u7684\u53e3\u5934/\u4e66\u9762\u4e0a\u7684\u89e3\u91ca\u3002\uff0c\u53ef\u4f7f\u7528"\u9a7c\u5cf0\u547d\u540d\u6cd5"\u6309\u7167\u5b9e\u73b0\u63a5\u53e3\u7684',Object(r.b)("strong",{parentName:"p"},"\u4e1a\u52a1\u7c7b\u578b\u3001\u4e1a\u52a1\u573a\u666f"),"\u7b49\u547d\u540d\uff0c\u6709\u5fc5\u8981\u65f6\u53ef\u91c7\u53d6\u591a\u7ea7\u76ee\u5f55\u547d\u540d\uff0c\u4f46\u76ee\u5f55\u4e0d\u5b9c\u8fc7\u957f\uff0c\u4e24\u7ea7\u76ee\u5f55\u8f83\u4e3a\u9002\u5b9c"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u5e38\u89c1\u547d\u540d\u65b9\u5f0f"),":",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u63a5\u53e3\u540d\u79f0\u52a8\u8bcd\u524d/\u540e\u7f00\u5316"),"\uff1a \u63a5\u53e3\u540d\u79f0\u4ee5\u63a5\u53e3\u6570\u636e\u64cd\u4f5c\u7684\u52a8\u8bcd\u4e3a\u524d/\u540e\u7f00\uff0c\u5e38\u89c1\u52a8\u8bcd\u6709\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Add\u3001Delete\u3001Update\u3001Query\u3001Get\u3001Send\u3001Save\u3001Detail\u3001List"),"\u7b49\uff0c\u5982\uff1a\u65b0\u5efa\u7528\u6237 ",Object(r.b)("inlineCode",{parentName:"li"},"AddUser"),"\u3001\u67e5\u8be2\u8ba2\u5355\u8be6\u60c5 ",Object(r.b)("inlineCode",{parentName:"li"},"QueryOrderDetail"),"\u3002"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u63a5\u53e3\u540d\u79f0\u52a8\u8bcd + \u8bf7\u6c42\u65b9\u5f0f"),"\uff1a\u63a5\u53e3\u8def\u5f84\u4e2d\u5305\u542b\u5177\u4f53\u63a5\u53e3\u540d\u79f0\u7684\u540d\u8bcd\uff0c\u63a5\u53e3\u6570\u636e\u64cd\u4f5c\u52a8\u4f5c\u4ee5 HTTP \u8bf7\u6c42\u65b9\u5f0f\u6765\u533a\u5206\u3002\u5e38\u7528\u7684 HTTP \u8bf7\u6c42\u65b9\u5f0f\u6709\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"GET"),"\uff1a\u4ece\u670d\u52a1\u5668\u53d6\u51fa\u8d44\u6e90\uff08\u4e00\u9879\u6216\u591a\u9879\uff09"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"POST"),"\uff1a\u5728\u670d\u52a1\u5668\u65b0\u5efa\u4e00\u4e2a\u8d44\u6e90"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"PUT"),"\uff1a\u5728\u670d\u52a1\u5668\u66f4\u65b0\u8d44\u6e90\uff08\u5ba2\u6237\u7aef\u63d0\u4f9b\u6539\u53d8\u540e\u7684\u5b8c\u6574\u8d44\u6e90\uff09"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"PATCH"),"\uff1a\u5728\u670d\u52a1\u5668\u66f4\u65b0\u8d44\u6e90\uff08\u5ba2\u6237\u7aef\u63d0\u4f9b\u6539\u53d8\u7684\u5c5e\u6027\uff09"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DELETE"),"\uff1a\u4ece\u670d\u52a1\u5668\u5220\u9664\u8d44\u6e90")))))),Object(r.b)("h3",{id:"635-\u8bf7\u6c42\u53c2\u6570\u89c4\u8303"},"6.3.5 \u8bf7\u6c42\u53c2\u6570\u89c4\u8303"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u8bf7\u6c42\u65b9\u5f0f"),"\uff1a\u6309\u7167 ",Object(r.b)("inlineCode",{parentName:"li"},"GET\u3001POST\u3001PUT")," \u7b49\u542b\u4e49\u5b9a\u4e49\uff0c\u907f\u514d\u51fa\u73b0\u4e0d\u4e00\u81f4\u73b0\u8c61\uff0c\u5bf9\u4eba\u9020\u6210\u8bef\u89e3\u3001\u6b67\u4e49",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u8bf7\u6c42\u5934"),"\uff1a\u8bf7\u6c42\u5934\u6839\u636e\u9879\u76ee\u9700\u6c42\u6dfb\u52a0\u914d\u7f6e\u53c2\u6570\u3002\u5982\uff1a\u8bf7\u6c42\u6570\u636e\u683c\u5f0f\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"accept=application/json")," \u7b49\u3002\u5982\u6709\u9700\u8981\uff0c\u8bf7\u6c42\u5934\u53ef\u6839\u636e\u9879\u76ee\u9700\u6c42\u8981\u6c42\u4f20\u5165\u7528\u6237 token\u3001\u552f\u4e00\u9a8c\u7b7e\u7801\u7b49\u52a0\u5bc6\u6570\u636e"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u8bf7\u6c42\u53c2\u6570/\u8bf7\u6c42\u4f53"),"\uff1a \u8bf7\u6c42\u53c2\u6570\u5b57\u6bb5\uff0c\u5c3d\u53ef\u80fd\u4e0e\u6570\u636e\u5e93\u8868\u5b57\u6bb5\u3001\u5bf9\u8c61\u5c5e\u6027\u540d\u7b49\u4fdd\u6301\u4e00\u81f4\uff0c\u56e0\u4e3a\u4fdd\u6301\u4e00\u81f4\u6700\u7701\u4e8b\uff0c\u6700\u8212\u670d\u7684\u4e00\u4ef6\u4e8b")))),Object(r.b)("h3",{id:"636-\u8fd4\u56de\u6570\u636e\u89c4\u8303"},"6.3.6 \u8fd4\u56de\u6570\u636e\u89c4\u8303"),Object(r.b)("p",null,"\u7edf\u4e00\u89c4\u8303\u8fd4\u56de\u6570\u636e\u7684\u683c\u5f0f\uff0c\u5bf9\u5df1\u5bf9\u5f7c\u90fd\u6709\u597d\u5904\uff0c\u6b64\u5904\u4ee5 json \u683c\u5f0f\u4e3a\u4f8b\u3002\u8fd4\u56de\u6570\u636e\u5e94\u5305\u542b\uff1a",Object(r.b)("strong",{parentName:"p"},"\u8fd4\u56de\u72b6\u6001\u7801\u3001\u8fd4\u56de\u72b6\u6001\u4fe1\u606f\u3001\u5177\u4f53\u6570\u636e"),"\u3002",Object(r.b)("strong",{parentName:"p"},"\u8fd4\u56de\u6570\u636e\u4e2d\u7684\u72b6\u6001\u7801\u3001\u72b6\u6001\u4fe1\u606f\uff0c\u5e38\u6307\u5177\u4f53\u7684\u4e1a\u52a1\u72b6\u6001\uff0c\u4e0d\u5efa\u8bae\u548c HTTP \u72b6\u6001\u7801\u6df7\u5728\u4e00\u8d77"),"\u3002HTTP \u72b6\u6001\uff0c\u662f\u7528\u6765\u4f53\u73b0 HTTP \u94fe\u8def\u72b6\u6001\u60c5\u51b5\uff0c\u5982\uff1a404-Not Found\u3002HTTP \u72b6\u6001\u7801\u548c json \u7ed3\u679c\u4e2d\u7684\u72b6\u6001\u7801\uff0c\u5e76\u5b58\u5c1a\u53ef\uff0c\u7528\u4e8e\u4f53\u73b0\u4e0d\u540c\u7ef4\u5ea6\u7684\u72b6\u6001\u3002"),Object(r.b)("h2",{id:"64-\u4ec0\u4e48\u662f-swagger"},"6.4 \u4ec0\u4e48\u662f Swagger"),Object(r.b)("p",null,"\u76f8\u4fe1\u65e0\u8bba\u662f\u524d\u7aef\u8fd8\u662f\u540e\u7aef\u5f00\u53d1\uff0c\u90fd\u6216\u591a\u6216\u5c11\u5730\u88ab\u63a5\u53e3\u6587\u6863\u6298\u78e8\u8fc7\u3002\u524d\u7aef\u7ecf\u5e38\u62b1\u6028\u540e\u7aef\u7ed9\u7684\u63a5\u53e3\u6587\u6863\u4e0e\u5b9e\u9645\u60c5\u51b5\u4e0d\u4e00\u81f4\u3002\u540e\u7aef\u53c8\u89c9\u5f97\u7f16\u5199\u53ca\u7ef4\u62a4\u63a5\u53e3\u6587\u6863\u4f1a\u8017\u8d39\u4e0d\u5c11\u7cbe\u529b\uff0c\u7ecf\u5e38\u6765\u4e0d\u53ca\u66f4\u65b0\u3002"),Object(r.b)("p",null,"\u5176\u5b9e\u65e0\u8bba\u662f\u524d\u7aef\u8c03\u7528\u540e\u7aef\uff0c\u8fd8\u662f\u540e\u7aef\u8c03\u7528\u540e\u7aef\uff0c\u90fd\u671f\u671b\u6709\u4e00\u4e2a\u597d\u7684\u63a5\u53e3\u6587\u6863\u3002\u4f46\u662f\u8fd9\u4e2a\u63a5\u53e3\u6587\u6863\u5bf9\u4e8e\u7a0b\u5e8f\u5458\u6765\u8bf4\uff0c\u5c31\u8ddf\u6ce8\u91ca\u4e00\u6837\uff0c\u7ecf\u5e38\u4f1a\u62b1\u6028\u522b\u4eba\u5199\u7684\u4ee3\u7801\u6ca1\u6709\u5199\u6ce8\u91ca\uff0c\u7136\u800c\u81ea\u5df1\u5199\u8d77\u4ee3\u7801\u8d77\u6765\uff0c\u6700\u8ba8\u538c\u7684\uff0c\u4e5f\u662f\u5199\u6ce8\u91ca\u3002\u6240\u4ee5\u4ec5\u4ec5\u53ea\u901a\u8fc7\u5f3a\u5236\u6765\u89c4\u8303\u5927\u5bb6\u662f\u4e0d\u591f\u7684\uff0c\u968f\u7740\u65f6\u95f4\u63a8\u79fb\uff0c\u7248\u672c\u8fed\u4ee3\uff0c\u63a5\u53e3\u6587\u6863\u5f80\u5f80\u5f88\u5bb9\u6613\u5c31\u8ddf\u4e0d\u4e0a\u4ee3\u7801\u4e86\u3002"),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u53d1\u73b0\u4e86\u75db\u70b9\u5c31\u8981\u53bb\u627e\u89e3\u51b3\u65b9\u6848\u3002\u89e3\u51b3\u65b9\u6848\u7528\u7684\u4eba\u591a\u4e86\uff0c\u5c31\u6210\u4e86\u6807\u51c6\u7684\u89c4\u8303\uff0c\u8fd9\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"strong"},"Swagger")," \u7684\u7531\u6765"),"\u3002"),Object(r.b)("p",null,"\u901a\u8fc7\u8fd9\u5957\u89c4\u8303\uff0c\u4f60\u53ea\u9700\u8981\u6309\u7167\u5b83\u7684\u89c4\u8303\u53bb\u5b9a\u4e49\u63a5\u53e3\u53ca\u63a5\u53e3\u76f8\u5173\u7684\u4fe1\u606f\u3002\u518d\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u884d\u751f\u51fa\u6765\u7684\u4e00\u7cfb\u5217\u9879\u76ee\u548c\u5de5\u5177\uff0c\u5c31\u53ef\u4ee5\u505a\u5230\u751f\u6210\u5404\u79cd\u683c\u5f0f\u7684\u63a5\u53e3\u6587\u6863\uff0c\u751f\u6210\u591a\u79cd\u8bed\u8a00\u7684\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u7684\u4ee3\u7801\uff0c\u4ee5\u53ca\u5728\u7ebf\u63a5\u53e3\u8c03\u8bd5\u9875\u9762\u7b49\u7b49\u3002"),Object(r.b)("p",null,"\u8fd9\u6837\uff0c\u5982\u679c\u6309\u7167\u65b0\u7684\u5f00\u53d1\u6a21\u5f0f\uff0c\u5728\u5f00\u53d1\u65b0\u7248\u672c\u6216\u8005\u8fed\u4ee3\u7248\u672c\u7684\u65f6\u5019\uff0c\u53ea\u9700\u8981\u66f4\u65b0 ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u63cf\u8ff0\u6587\u4ef6\uff0c\u5c31\u53ef\u4ee5\u81ea\u52a8\u751f\u6210\u63a5\u53e3\u6587\u6863\u548c\u5ba2\u6237\u7aef\u670d\u52a1\u7aef\u4ee3\u7801\uff0c\u505a\u5230\u8c03\u7528\u7aef\u4ee3\u7801\u3001\u670d\u52a1\u7aef\u4ee3\u7801\u4ee5\u53ca\u63a5\u53e3\u6587\u6863\u7684\u4e00\u81f4\u6027\u3002"),Object(r.b)("p",null,"\u6240\u4ee5\uff0cSwagger \u662f\u4e00\u4e2a\u89c4\u8303\u548c\u5b8c\u6574\u7684\u6846\u67b6\uff0c\u7528\u4e8e\u751f\u6210\u3001\u63cf\u8ff0\u3001\u8c03\u7528\u548c\u53ef\u89c6\u5316",Object(r.b)("inlineCode",{parentName:"p"},"RESTful")," \u98ce\u683c\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"Web")," \u670d\u52a1\u3002"),Object(r.b)("p",null,"\u603b\u4f53\u76ee\u6807\u662f\u4f7f\u5ba2\u6237\u7aef\u548c\u6587\u4ef6\u7cfb\u7edf\u4f5c\u4e3a\u670d\u52a1\u5668\u4ee5\u540c\u6837\u7684\u901f\u5ea6\u6765\u66f4\u65b0\u3002\u6587\u4ef6\u7684\u65b9\u6cd5\u3001\u53c2\u6570\u548c\u6a21\u578b\u7d27\u5bc6\u96c6\u6210\u5230\u670d\u52a1\u5668\u7aef\u7684\u4ee3\u7801\uff0c\u5141\u8bb8 API \u6765\u59cb\u7ec8\u4fdd\u6301\u540c\u6b65\u3002",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u8ba9\u90e8\u7f72\u7ba1\u7406\u548c\u4f7f\u7528\u529f\u80fd\u5f3a\u5927\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"API")," \u4ece\u672a\u5982\u6b64\u7b80\u5355\u3002"),Object(r.b)("h2",{id:"65-swagger-\u4f7f\u7528"},"6.5 Swagger \u4f7f\u7528"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u65b9\u4fbf\u4e14\u7075\u6d3b\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u914d\u7f6e\uff0c\u65e0\u9700\u589e\u52a0\u989d\u5916\u5b66\u4e60\u6210\u672c\u3002"),Object(r.b)("h3",{id:"651-\u6ce8\u518c\u670d\u52a1"},"6.5.1 \u6ce8\u518c\u670d\u52a1"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:'{11,21} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11,21}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddSpecificationDocuments();\n services.AddControllers();\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n // Other Codes\n\n app.UseSpecificationDocuments();\n\n app.UseEndpoints(endpoints =>\n {\n endpoints.MapControllers();\n });\n }\n }\n}\n")),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"services.AddSpecificationDocuments()")," \u901a\u5e38\u548c ",Object(r.b)("inlineCode",{parentName:"p"},".AddDynamicApiControllers()")," \u6210\u5bf9\u51fa\u73b0\u3002"))),Object(r.b)("h3",{id:"652-\u9ed8\u8ba4\u5730\u5740"},"6.5.2 \u9ed8\u8ba4\u5730\u5740"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"p"},"\u89c4\u8303\u5316\u6587\u6863")," \u5730\u5740\u4e3a\u4e3b\u673a\u6839\u76ee\u5f55\uff0c",Object(r.b)("strong",{parentName:"p"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"),"\u3002"),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger1.png")}),Object(r.b)("h3",{id:"653-\u9ed8\u8ba4\u5206\u7ec4"},"6.5.3 \u9ed8\u8ba4\u5206\u7ec4"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\u9ed8\u8ba4\u5206\u7ec4\u540d\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"Default"),"\uff0c",Object(r.b)("strong",{parentName:"p"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"),"\u3002"),Object(r.b)("h3",{id:"654-\u6587\u6863\u6ce8\u91ca"},"6.5.4 \u6587\u6863\u6ce8\u91ca"),Object(r.b)("p",null,"\u89c4\u8303\u5316\u6587\u6863\u9ed8\u8ba4\u626b\u63cf ",Object(r.b)("inlineCode",{parentName:"p"},"Fur.Application"),"\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur.Web.Core"),"\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur.Web.Entry")," \u4e09\u4e2a\u7a0b\u5e8f\u96c6",Object(r.b)("inlineCode",{parentName:"p"},".xml")," \u6ce8\u91ca\u6587\u4ef6\uff0c",Object(r.b)("strong",{parentName:"p"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"),"\u3002"),Object(r.b)("p",null,"\u53ea\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},"///")," \u6807\u8bc6\u7684\u6ce8\u91ca\u8bed\u6cd5\uff0c\u5982\uff1a",Object(r.b)("strong",{parentName:"p"},"\u7c7b\u3001\u65b9\u6cd5\u3001\u5c5e\u6027\u3001\u53c2\u6570\u3001\u8fd4\u56de\u503c\u3001\u9a8c\u8bc1\u7279\u6027"),"\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{5-7,10-13,19-23}","{5-7,10-13,19-23}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n /// \n /// \u7c7b\u6ce8\u91ca\n /// \n public class FurAppService : IDynamicApiController\n {\n /// \n /// \u65b9\u6cd5\u6ce8\u91ca\n /// \n /// \n public string Get()\n {\n return nameof(Fur);\n }\n\n /// \n /// \u5e26 ID \u53c2\u6570\u7684\u65b9\u6cd5\u6ce8\u91ca\n /// \n /// \n /// \n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger2.png")}),Object(r.b)("h3",{id:"655-\u591a\u5206\u7ec4\u652f\u6301"},"6.5.5 \u591a\u5206\u7ec4\u652f\u6301"),Object(r.b)("p",null,"\u591a\u5206\u7ec4\u662f\u4e00\u4e2a\u7cfb\u7edf\u4e2d\u5fc5\u5907\u529f\u80fd\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u7cfb\u7edf\u5212\u5206\u4e3a\u591a\u4e2a\u6a21\u5757\uff0c\u6bcf\u4e2a\u6a21\u5757\u90fd\u72ec\u7acb\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"api")," \u914d\u7f6e\u3002\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u5b9e\u73b0\u591a\u5206\u7ec4\u975e\u5e38\u7b80\u5355\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,21,32}","{5,21,32}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings("Group1")]\n public class FurAppService : IDynamicApiController\n {\n /// \n /// \u968f\u7236\u7c7b Group1 \u5206\u7ec4\n /// \n /// \n public string Post()\n {\n return nameof(Fur);\n }\n\n /// \n /// \u5728 Group1\u3001Group3 \u90fd\u6709\u6211\n /// \n /// \n [ApiDescriptionSettings("Group1", "Group3")]\n public string Get()\n {\n return nameof(Fur);\n }\n\n /// \n /// \u6211\u53ea\u5728 Group2 \u51fa\u73b0\n /// \n /// \n /// \n [ApiDescriptionSettings("Group2")]\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger3.gif")}),Object(r.b)("h3",{id:"656-\u591a\u5206\u7ec4\u6392\u5e8f"},"6.5.6 \u591a\u5206\u7ec4\u6392\u5e8f"),Object(r.b)(l.a,{defaultValue:"fz1",values:[{label:"\u65b9\u5f0f\u4e00",value:"fz1"},{label:"\u65b9\u5f0f\u4e8c",value:"fz2"}],mdxType:"Tabs"},Object(r.b)(b.a,{value:"fz1",mdxType:"TabItem"},Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u901a\u8fc7\u5206\u7ec4\u540d\u79f0\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"strong"},"@\u6574\u6570")," \u8fdb\u884c\u6392\u5e8f")),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,19}","{5,19}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings("Group1@1")]\n public class FurAppService : IDynamicApiController\n {\n public string Post()\n {\n return nameof(Fur);\n }\n\n [ApiDescriptionSettings("Group1", "Group3")]\n public string Get()\n {\n return nameof(Fur);\n }\n\n [ApiDescriptionSettings("Group@2")]\n public int Get(int id),19\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u53ef\u4ee5\u901a\u8fc7\u5728\u5206\u7ec4\u540d\u540e\u9762\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"p"},"@\u6574\u6570")," \u8fdb\u884c\u6392\u5e8f\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"\u6574\u6570")," \u8d8a\u5927\u6392\u524d\u9762\u3002\u5982\u679c\u5206\u7ec4\u540d\u79f0\u591a\u6b21\u6307\u5b9a\u4e14\u591a\u6b21\u6307\u5b9a\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"@\u6574\u6570")," \uff0c\u5219\u81ea\u52a8",Object(r.b)("strong",{parentName:"p"},"\u53d6\u8be5\u5206\u7ec4\u6700\u5927\u7684\u6574\u6570"),"\u8fdb\u884c\u6392\u5e8f\u3002")),Object(r.b)(b.a,{value:"fz2",mdxType:"TabItem"},Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u914d\u7f6e\u6392\u5e8f")),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-json",metastring:'{2,3,4-17} title="Fur.Web.Entry/appsettings.json"',"{2,3,4-17}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "SpecificationDocumentSettings": {\n "GroupOpenApiInfos": [\n {\n "Group": "Group1",\n "Order": 1\n },\n {\n "Group": "Group2",\n "Order": 2\n },\n {\n "Group": "Group3",\n "Order": 0\n }\n ]\n }\n }\n}\n')))),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger5.png")}),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u6392\u5e8f\u8bf4\u660e")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5206\u7ec4\u9ed8\u8ba4\u6392\u5e8f ",Object(r.b)("inlineCode",{parentName:"p"},"Order")," \u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"0"),"\u3002\u5982\u679c\u540c\u65f6\u914d\u7f6e\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"@\u6574\u6570")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u914d\u7f6e\u6587\u4ef6\uff0c\u90a3\u4e48\u4f18\u5148\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"Order")))),Object(r.b)("h3",{id:"657-\u591a\u5206\u7ec4\u4fe1\u606f\u914d\u7f6e"},"6.5.7 \u591a\u5206\u7ec4\u4fe1\u606f\u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u53ef\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"appsetting.json")," \u914d\u7f6e\u5206\u7ec4\u4fe1\u606f\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-json",metastring:'{3,4-20} title="Fur.Web.Entry/appsettings.json"',"{3,4-20}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "SpecificationDocumentSettings": {\n "GroupOpenApiInfos": [\n {\n "Group": "Group1",\n "Title": "\u5206\u7ec4\u6807\u9898",\n "Description": "\u8fd9\u91cc\u662f\u5206\u7ec4\u63cf\u8ff0",\n "Version": "\u7248\u672c\u53f7",\n "TermsOfService": "https://chinadot.net",\n "Contact": {\n "Name": "\u767e\u5c0f\u50e7",\n "Url": "https://gitee.com/monksoul",\n "Email": "monksoul@outlook.com"\n },\n "License": {\n "Name": "Apache-2.0",\n "Url": "https://gitee.com/monksoul/Fur/blob/alpha/LICENSE"\n }\n }\n ]\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger5.png")}),Object(r.b)("h3",{id:"658-\u7ec4\u4e2d\u7ec4\uff08\u6807\u7b7e\uff09"},"6.5.8 \u7ec4\u4e2d\u7ec4\uff08\u6807\u7b7e\uff09"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Tag")," \u914d\u7f6e\u4e3b\u8981\u7528\u4e8e\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u6807\u7b7e\u5206\u7ec4\u4fe1\u606f\u53ca\u5408\u5e76\u6807\u7b7e\u3002\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"\u7ec4\u4e2d\u7ec4"),":"),Object(r.b)(l.a,{defaultValue:"tag1",values:[{label:"\u6807\u7b7e\u547d\u540d",value:"tag1"},{label:"\u5408\u5e76\u6807\u7b7e",value:"tag2"}],mdxType:"Tabs"},Object(r.b)(b.a,{value:"tag1",mdxType:"TabItem"},Object(r.b)("h4",{id:"\u672a\u8d34\u6807\u7b7e\u4e4b\u524d"},"\u672a\u8d34\u6807\u7b7e\u4e4b\u524d"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs"}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n")),Object(r.b)("h4",{id:"\u8d34\u6807\u7b7e\u4e4b\u540e"},"\u8d34\u6807\u7b7e\u4e4b\u540e"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,19}","{5,19}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Tag = "\u5206\u7ec4\u4e00")]\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n [ApiDescriptionSettings(Tag = "\u5206\u7ec4\u4e8c")]\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/tag1.png")})),Object(r.b)(b.a,{value:"tag2",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,19}","{5,19}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Tag = "\u5408\u5e76\u6240\u6709\u6807\u7b7e")]\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n [ApiDescriptionSettings(Tag = "\u5408\u5e76\u6240\u6709\u6807\u7b7e")]\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/tag2.png")}))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c ",Object(r.b)("inlineCode",{parentName:"p"},"Tag")," \u540d\u5b57\u4e00\u6837\uff0c\u5219\u4f1a\u81ea\u52a8\u5408\u5e76\uff0c\u5426\u5219\u53ea\u662f\u547d\u540d\u3002"))),Object(r.b)("h3",{id:"659-\u9ed8\u8ba4\u5c55\u5f00\u6240\u6709\u6587\u6863"},"6.5.9 \u9ed8\u8ba4\u5c55\u5f00\u6240\u6709\u6587\u6863"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-json",metastring:'{2-5} title="Fur.Web.Entry/appsettings.json"',"{2-5}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "SpecificationDocumentSettings": {\n "DocExpansionState": "Full"\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger6.gif")}),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"DocExpansionState")," \u914d\u7f6e\u8bf4\u660e\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"List"),"\uff1a\u5217\u8868\u5f0f\uff08\u5c55\u5f00\u5b50\u7c7b\uff09\uff0c",Object(r.b)("strong",{parentName:"li"},"\u9ed8\u8ba4\u503c")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Full"),"\uff1a\u5b8c\u5168\u5c55\u5f00"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"None"),"\uff1a\u5217\u8868\u5f0f\uff08\u4e0d\u5c55\u5f00\u5b50\u7c7b\uff09")),Object(r.b)("h3",{id:"6510-\u914d\u7f6e\u6587\u6863\u6807\u9898"},"6.5.10 \u914d\u7f6e\u6587\u6863\u6807\u9898"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-json",metastring:'{2-5} title="Fur.Web.Entry/appsettings.json"',"{2-5}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "SpecificationDocumentSettings": {\n "DocumentTitle": "\u6211\u662f\u81ea\u5b9a\u4e49\u6807\u9898"\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger7.png")}),Object(r.b)("h3",{id:"6511-\u6388\u6743\u63a7\u5236"},"6.5.11 \u6388\u6743\u63a7\u5236"),Object(r.b)("p",null,"\u5f85\u6574\u7406..."),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-json",metastring:'title="Fur.Web.Entry/appsettings.json"',title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "SpecificationDocumentSettings": {\n "EnableAuthorized": true,\n\n "SecurityDefinitions": [\n {\n "Id": "Bearer",\n "Type": "Http",\n "Name": "Authorization",\n "Description": "JWT Authorization header using the Bearer scheme.",\n "BearerFormat": "JWT",\n "Scheme": "bearer",\n "In": "Header",\n\n "Requirement": {\n "Scheme": {\n "Reference": {\n "Id": "Bearer",\n "Type": "SecurityScheme"\n },\n "Accesses": null\n }\n }\n }\n ]\n }\n }\n}\n')),Object(r.b)("h3",{id:"6512-\u5728\u7ebf\u6d4b\u8bd5"},"6.5.12 \u5728\u7ebf\u6d4b\u8bd5"),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger8.gif")}),Object(r.b)("h3",{id:"6513-\u6027\u80fd\u76d1\u89c6-miniprofiler"},"6.5.13 \u6027\u80fd\u76d1\u89c6 ",Object(r.b)("inlineCode",{parentName:"h3"},"MiniProfiler")),Object(r.b)("p",null,"\u89c4\u8303\u5316\u6587\u6863\u9ed8\u8ba4\u96c6\u6210\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"MiniProfiler")," \u7b2c\u4e09\u65b9\u6027\u80fd\u7ec4\u4ef6\uff0c\u901a\u8fc7\u8be5\u7ec4\u4ef6\u53ef\u4ee5\u65b9\u4fbf\u67e5\u770b\u8bf7\u6c42\u6027\u80fd\u3001\u5f02\u5e38\u5806\u6808\u3001\u6570\u636e\u5e93\u64cd\u4f5c\u7b49\u4fe1\u606f\u3002\u9ed8\u8ba4\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u9996\u9875\u5de6\u4e0a\u89d2\u663e\u793a\u3002"),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/mipr.png")}),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5c0f\u63d0\u793a")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u4e5f\u53ef\u4ee5\u901a\u8fc7 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"appsetting.json"))," \u4e2d ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"AppSettings:InjectMiniProfiler"))," \u8bbe\u4e3a ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"false"))," \u5173\u95ed\u3002"))),Object(r.b)("h3",{id:"6514-\u5b9a\u4e49\u63a5\u53e3\u8f93\u51fa\u7c7b\u578b"},"6.5.14 \u5b9a\u4e49\u63a5\u53e3\u8f93\u51fa\u7c7b\u578b"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8-9}","{2,8-9}":!0}),"using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [ProducesResponseType(201, Type = typeof(TestDto))]\n [ProducesResponseType(400)]\n public string Get()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/fhzlx.png")}),Object(r.b)("h2",{id:"66-specificationdocumentsettings-\u914d\u7f6e"},"6.6 ",Object(r.b)("inlineCode",{parentName:"h2"},"SpecificationDocumentSettings")," \u914d\u7f6e"),Object(r.b)("p",null,"\u9664\u4e86\u4e0a\u8ff0\u4f8b\u5b50\u5916\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e86\u4e00\u4e9b\u914d\u7f6e\u9009\u9879\uff0c\u5982\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DocumentTitle"),"\uff1a\u6587\u6863\u6807\u9898\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"Specification Api Document")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DefaultGroupName"),"\uff1a\u9ed8\u8ba4\u5206\u7ec4\u540d\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"Default")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"EnableAuthorized"),"\uff1a\u662f\u5426\u542f\u7528\u6743\u9650\u63a7\u5236\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"true")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"FormatAsV2"),"\uff1a\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger 2.0")," \u7248\u672c\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"RoutePrefix"),"\uff1a\u89c4\u8303\u5316\u6587\u6863\u5730\u5740\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"string")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DocExpansionState"),"\uff1a\u6587\u6863\u663e\u793a\u65b9\u5f0f\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"DocExpansion"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"List"),"\uff0c\u53d6\u503c\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"List"),"\uff1a\u5217\u8868\u5f0f\uff08\u5c55\u5f00\u5b50\u7c7b\uff09\uff0c",Object(r.b)("strong",{parentName:"li"},"\u9ed8\u8ba4\u503c")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Full"),"\uff1a\u5b8c\u5168\u5c55\u5f00"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"None"),"\uff1a\u5217\u8868\u5f0f\uff08\u4e0d\u5c55\u5f00\u5b50\u7c7b\uff09"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"XmlComments"),"\uff1a\u7a0b\u5e8f\u96c6\u6ce8\u91ca\u63cf\u8ff0\u6587\u4ef6\u540d\uff08\u53ef\u5e26 ",Object(r.b)("inlineCode",{parentName:"li"},".xml"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"Fur.Application, Fur.Web.Entry, Fur.Web.Core")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"GroupOpenApiInfos"),"\uff1a\u5206\u7ec4\u4fe1\u606f\u914d\u7f6e\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"SpecificationOpenApiInfo[]"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"{ 'Group': 'Default'}")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"SecurityDefinitions"),"\uff1a\u5b89\u5168\u7b56\u7565\u5b9a\u4e49\u914d\u7f6e\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"SpecificationOpenApiSecurityScheme[]"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"[]"))),Object(r.b)("h2",{id:"67-\u7edf\u4e00\u8fd4\u56de\u503c\u6a21\u578b"},"6.7 \u7edf\u4e00\u8fd4\u56de\u503c\u6a21\u578b"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b ",Object(r.b)("inlineCode",{parentName:"p"},"\u89c4\u8303\u5316\u7ed3\u679c")," \u529f\u80fd\uff0c\u53ef\u4ee5\u901a\u8fc7\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"IUnifyResultProvider")," \u63d0\u4f9b\u5668\u5b9e\u73b0\u7edf\u4e00\u89c4\u8303\u5316\u8fd4\u56de\u503c\u5b9a\u5236\uff0c\u5982\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"RESTfulResultProvider"),"\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs"}),'using Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.AspNetCore.Mvc.Filters;\nusing Microsoft.AspNetCore.Mvc.ModelBinding;\nusing System.Collections.Generic;\n\nnamespace Fur.UnifyResult\n{\n /// \n /// RESTful \u98ce\u683c\u8fd4\u56de\u503c\n /// \n public class RESTfulResultProvider : IUnifyResultProvider\n {\n /// \n /// \u5f02\u5e38\u8fd4\u56de\u503c\n /// \n /// \n /// \n public IActionResult OnException(ExceptionContext context)\n {\n return new JsonResult(new RESTfulResult\n {\n StatusCode = StatusCodes.Status500InternalServerError,\n Successed = false,\n Data = null,\n Errors = context.Exception.Message\n });\n }\n\n /// \n /// \u6210\u529f\u8fd4\u56de\u503c\n /// \n /// \n /// \n public IActionResult OnSuccessed(ActionExecutedContext context)\n {\n object data;\n // \u5904\u7406\u5185\u5bb9\u7ed3\u679c\n if (context.Result is ContentResult contentResult) data = contentResult.Content;\n // \u5904\u7406\u5bf9\u8c61\u7ed3\u679c\n else if (context.Result is ObjectResult objectResult) data = objectResult.Value;\n else return null;\n\n return new JsonResult(new RESTfulResult\n {\n StatusCode = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK,\n Successed = true,\n Data = data,\n Errors = null\n });\n }\n\n /// \n /// \u9a8c\u8bc1\u5931\u8d25\u8fd4\u56de\u503c\n /// \n /// \n /// \n /// \n /// \n /// \n public IActionResult OnValidateFailed(ActionExecutingContext context, ModelStateDictionary modelStates, Dictionary> validationResults, string validateFaildMessage)\n {\n return new JsonResult(new RESTfulResult\n {\n StatusCode = StatusCodes.Status400BadRequest,\n Successed = false,\n Data = null,\n Errors = validationResults\n });\n }\n }\n}\n')),Object(r.b)("p",null,"\u4e4b\u540e\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Startup.cs")," \u4e2d\u6ce8\u518c\u5373\u53ef\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(i.a)({parentName:"pre"},{className:"language-cs"}),"services.AddControllers().AddUnifyResult();\n")),Object(r.b)("h2",{id:"68-\u53cd\u9988\u4e0e\u5efa\u8bae"},"6.8 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(i.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(i.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(i.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(i.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(i.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}m.isMDXComponent=!0},142:function(e,n,t){"use strict";t.d(n,"a",(function(){return s})),t.d(n,"b",(function(){return d}));var i=t(0),a=t.n(i);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function l(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var o=a.a.createContext({}),p=function(e){var n=a.a.useContext(o),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},s=function(e){var n=p(e.components);return a.a.createElement(o.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.a.createElement(a.a.Fragment,{},n)}},m=a.a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,r=e.originalType,c=e.parentName,o=b(e,["components","mdxType","originalType","parentName"]),s=p(t),m=i,d=s["".concat(c,".").concat(m)]||s[m]||u[m]||r;return t?a.a.createElement(d,l(l({ref:n},o),{},{components:t})):a.a.createElement(d,l({ref:n},o))}));function d(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=t.length,c=new Array(r);c[0]=m;var l={};for(var b in n)hasOwnProperty.call(n,b)&&(l[b]=n[b]);l.originalType=e,l.mdxType="string"==typeof e?e:i,c[1]=l;for(var o=2;oMiniProfiler",id:"6513-\u6027\u80fd\u76d1\u89c6-miniprofiler",children:[]},{value:"6.5.14 \u5b9a\u4e49\u63a5\u53e3\u8f93\u51fa\u7c7b\u578b",id:"6514-\u5b9a\u4e49\u63a5\u53e3\u8f93\u51fa\u7c7b\u578b",children:[]}]},{value:"6.6 SpecificationDocumentSettings \u914d\u7f6e",id:"66-specificationdocumentsettings-\u914d\u7f6e",children:[]},{value:"6.7 \u7edf\u4e00\u8fd4\u56de\u503c\u6a21\u578b",id:"67-\u7edf\u4e00\u8fd4\u56de\u503c\u6a21\u578b",children:[]},{value:"6.8 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"68-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],u={rightToc:s};function m(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},u,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("h2",{id:"61-\u4ec0\u4e48\u662f\u63a5\u53e3\u6587\u6863"},"6.1 \u4ec0\u4e48\u662f\u63a5\u53e3\u6587\u6863"),Object(r.b)("p",null,"\u5728\u73b0\u5728\u79fb\u52a8\u4e3a\u738b\u3001\u591a\u7aef\u4e92\u8f85\u3001\u524d\u7aef\u767e\u82b1\u9f50\u653e\u7684\u5f00\u653e\u65f6\u4ee3\uff0c\u4e0d\u518d\u662f\u4e00\u4eba\u5305\u63fd\u5f0f\u5f00\u53d1\uff0c\u5927\u5bb6\u5404\u53f8\u5176\u804c\uff0c\u540e\u7aef\u5de5\u7a0b\u5e08\u8d1f\u8d23\u63a5\u53e3\u5f00\u53d1\uff0c\u524d\u7aef\u8d1f\u8d23\u63a5\u53e3\u8054\u8c03\uff0c\u4e5f\u5c31\u662f\u4e92\u8054\u7f51\u73b0\u5728\u6d41\u884c\u7684\u524d\u540e\u7aef\u5206\u79bb\u67b6\u6784\u3002"),Object(r.b)("p",null,"\u6240\u4ee5\u5c31\u9700\u8981\u7531\u524d\u540e\u7aef\u5de5\u7a0b\u5e08\u5171\u540c\u5b9a\u4e49\u63a5\u53e3\uff0c\u7f16\u5199\u63a5\u53e3\u6587\u6863\uff0c\u4e4b\u540e\u5927\u5bb6\u6309\u7167\u8fd9\u4e2a\u63a5\u53e3\u6587\u6863\u8fdb\u884c\u5f00\u53d1\u3001\u7ef4\u62a4\u53ca\u5f00\u653e\u7ed9\u7b2c\u4e09\u65b9\u3002"),Object(r.b)("h2",{id:"62-\u4e3a\u4ec0\u4e48\u8981\u5199\u63a5\u53e3\u6587\u6863"},"6.2 \u4e3a\u4ec0\u4e48\u8981\u5199\u63a5\u53e3\u6587\u6863"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u80fd\u591f\u8ba9\u524d\u7aef\u5f00\u53d1\u4e0e\u540e\u53f0\u5f00\u53d1\u4eba\u5458\u66f4\u597d\u7684\u914d\u5408\uff0c\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387"),Object(r.b)("li",{parentName:"ul"},"\u9879\u76ee\u8fed\u4ee3\u6216\u8005\u9879\u76ee\u4eba\u5458\u66f4\u8fed\u65f6\uff0c\u65b9\u4fbf\u540e\u671f\u4eba\u5458\u67e5\u770b\u548c\u7ef4\u62a4"),Object(r.b)("li",{parentName:"ul"},"\u65b9\u4fbf\u6d4b\u8bd5\u4eba\u5458\u8fdb\u884c\u63a5\u53e3\u6d4b\u8bd5")),Object(r.b)("h2",{id:"63-\u4e3a\u4ec0\u4e48\u9700\u8981\u89c4\u8303\u5316\u6587\u6863"},"6.3 \u4e3a\u4ec0\u4e48\u9700\u8981\u89c4\u8303\u5316\u6587\u6863"),Object(r.b)("p",null,"\u7531\u4e8e\u6bcf\u4e2a\u516c\u53f8\u540e\u7aef\u4eba\u5458\u6280\u672f\u53c2\u5dee\u4e0d\u9f50\uff0c\u6280\u672f\u6587\u6863\u80fd\u529b\u4e5f\u4e0d\u4f8b\u5916\uff0c\u5bfc\u81f4\u63a5\u53e3\u5b9a\u4e49\u53ca\u6587\u6863\u4e94\u82b1\u516b\u95e8\uff0c\u4e0d\u540c\u9879\u76ee\u6216\u4e0d\u540c\u516c\u53f8\u5bf9\u63a5\u6781\u5176\u56f0\u96be\uff0c\u800c\u4e14\u4f53\u9a8c\u7cdf\u7cd5\u3002\u6240\u4ee5\uff0c\u65e0\u89c4\u77e9\u4e0d\u6210\u65b9\u5706\uff0c\u4e3a\u4e86\u5f00\u53d1\u4eba\u5458\u95f4\u66f4\u597d\u7684\u914d\u5408\uff0c\u8feb\u5207\u9700\u8981\u6574\u7406\u51fa\u4e00\u5957\u89c4\u8303\u3002"),Object(r.b)("p",null,"\u901a\u5e38\u63a5\u53e3\u89c4\u8303\u5206\u4e3a\u516d\u4e2a\u90e8\u5206\uff1a"),Object(r.b)("h3",{id:"631-\u534f\u8bae\u89c4\u8303"},"6.3.1 \u534f\u8bae\u89c4\u8303"),Object(r.b)("p",null,"\u4e3a\u4e86\u786e\u4fdd\u4e0d\u540c\u7cfb\u7edf/\u6a21\u5757\u95f4\u7684\u6570\u636e\u4ea4\u4e92\uff0c\u9700\u8981\u4e8b\u5148\u7ea6\u5b9a\u597d\u901a\u8baf\u534f\u8bae\uff0c\u5982\uff1aTCP\u3001HTTP\u3001HTTPS \u534f\u8bae\u3002\u4e3a\u4e86\u786e\u4fdd\u6570\u636e\u4ea4\u4e92\u5b89\u5168\uff0c\u5efa\u8bae\u4f7f\u7528 HTTPS \u534f\u8bae"),Object(r.b)("h3",{id:"632-\u63a5\u53e3\u8def\u5f84\u89c4\u8303"},"6.3.2 \u63a5\u53e3\u8def\u5f84\u89c4\u8303"),Object(r.b)("p",null,"\u4f5c\u4e3a\u63a5\u53e3\u8def\u5f84\uff0c\u4e3a\u4e86\u65b9\u4fbf\u6e05\u6670\u7684\u533a\u5206\u6765\u81ea\u4e0d\u540c\u7684\u7cfb\u7edf\uff0c\u53ef\u4ee5\u91c7\u7528\u4e0d\u540c\u7cfb\u7edf/\u6a21\u5757\u540d\u4f5c\u4e3a\u63a5\u53e3\u8def\u5f84\u524d\u7f00\uff0c\u5982\uff1a\u652f\u4ed8\u6a21\u5757\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"/pay/xxx"),"\uff0c\u8ba2\u5355\u6a21\u5757\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"/order/xxx")),Object(r.b)("h3",{id:"633-\u7248\u672c\u63a7\u5236\u89c4\u8303"},"6.3.3 \u7248\u672c\u63a7\u5236\u89c4\u8303"),Object(r.b)("p",null,'\u4e3a\u4e86\u4fbf\u4e8e\u540e\u671f\u63a5\u53e3\u7684\u5347\u7ea7\u548c\u7ef4\u62a4\uff0c\u5efa\u8bae\u5728\u63a5\u53e3\u8def\u5f84\u4e2d\u52a0\u5165\u7248\u672c\u53f7\uff0c\u4fbf\u4e8e\u7ba1\u7406\uff0c\u5b9e\u73b0\u63a5\u53e3\u591a\u7248\u672c\u7684\u53ef\u7ef4\u62a4\u6027\u3002\u5982\uff1a\u63a5\u53e3\u8def\u5f84\u4e2d\u6dfb\u52a0\u7c7b\u4f3c"',Object(r.b)("inlineCode",{parentName:"p"},"v1"),'"\u3001"',Object(r.b)("inlineCode",{parentName:"p"},"v2"),'"\u7b49\u7248\u672c\u53f7'),Object(r.b)("h3",{id:"634-\u63a5\u53e3\u547d\u540d\u89c4\u8303"},"6.3.4 \u63a5\u53e3\u547d\u540d\u89c4\u8303"),Object(r.b)("p",null,'\u548c C# \u547d\u540d\u89c4\u8303\u4e00\u6837\uff0c\u597d\u7684\u3001\u7edf\u4e00\u7684\u63a5\u53e3\u547d\u540d\u89c4\u8303\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u589e\u5f3a\u5176\u53ef\u8bfb\u6027\uff0c\u800c\u4e14\u8fd8\u4f1a\u51cf\u5c11\u5f88\u591a\u4e0d\u5fc5\u8981\u7684\u53e3\u5934/\u4e66\u9762\u4e0a\u7684\u89e3\u91ca\u3002\uff0c\u53ef\u4f7f\u7528"\u9a7c\u5cf0\u547d\u540d\u6cd5"\u6309\u7167\u5b9e\u73b0\u63a5\u53e3\u7684',Object(r.b)("strong",{parentName:"p"},"\u4e1a\u52a1\u7c7b\u578b\u3001\u4e1a\u52a1\u573a\u666f"),"\u7b49\u547d\u540d\uff0c\u6709\u5fc5\u8981\u65f6\u53ef\u91c7\u53d6\u591a\u7ea7\u76ee\u5f55\u547d\u540d\uff0c\u4f46\u76ee\u5f55\u4e0d\u5b9c\u8fc7\u957f\uff0c\u4e24\u7ea7\u76ee\u5f55\u8f83\u4e3a\u9002\u5b9c"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u5e38\u89c1\u547d\u540d\u65b9\u5f0f"),":",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u63a5\u53e3\u540d\u79f0\u52a8\u8bcd\u524d/\u540e\u7f00\u5316"),"\uff1a \u63a5\u53e3\u540d\u79f0\u4ee5\u63a5\u53e3\u6570\u636e\u64cd\u4f5c\u7684\u52a8\u8bcd\u4e3a\u524d/\u540e\u7f00\uff0c\u5e38\u89c1\u52a8\u8bcd\u6709\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"Add\u3001Delete\u3001Update\u3001Query\u3001Get\u3001Send\u3001Save\u3001Detail\u3001List"),"\u7b49\uff0c\u5982\uff1a\u65b0\u5efa\u7528\u6237 ",Object(r.b)("inlineCode",{parentName:"li"},"AddUser"),"\u3001\u67e5\u8be2\u8ba2\u5355\u8be6\u60c5 ",Object(r.b)("inlineCode",{parentName:"li"},"QueryOrderDetail"),"\u3002"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u63a5\u53e3\u540d\u79f0\u52a8\u8bcd + \u8bf7\u6c42\u65b9\u5f0f"),"\uff1a\u63a5\u53e3\u8def\u5f84\u4e2d\u5305\u542b\u5177\u4f53\u63a5\u53e3\u540d\u79f0\u7684\u540d\u8bcd\uff0c\u63a5\u53e3\u6570\u636e\u64cd\u4f5c\u52a8\u4f5c\u4ee5 HTTP \u8bf7\u6c42\u65b9\u5f0f\u6765\u533a\u5206\u3002\u5e38\u7528\u7684 HTTP \u8bf7\u6c42\u65b9\u5f0f\u6709\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"GET"),"\uff1a\u4ece\u670d\u52a1\u5668\u53d6\u51fa\u8d44\u6e90\uff08\u4e00\u9879\u6216\u591a\u9879\uff09"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"POST"),"\uff1a\u5728\u670d\u52a1\u5668\u65b0\u5efa\u4e00\u4e2a\u8d44\u6e90"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"PUT"),"\uff1a\u5728\u670d\u52a1\u5668\u66f4\u65b0\u8d44\u6e90\uff08\u5ba2\u6237\u7aef\u63d0\u4f9b\u6539\u53d8\u540e\u7684\u5b8c\u6574\u8d44\u6e90\uff09"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"PATCH"),"\uff1a\u5728\u670d\u52a1\u5668\u66f4\u65b0\u8d44\u6e90\uff08\u5ba2\u6237\u7aef\u63d0\u4f9b\u6539\u53d8\u7684\u5c5e\u6027\uff09"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DELETE"),"\uff1a\u4ece\u670d\u52a1\u5668\u5220\u9664\u8d44\u6e90")))))),Object(r.b)("h3",{id:"635-\u8bf7\u6c42\u53c2\u6570\u89c4\u8303"},"6.3.5 \u8bf7\u6c42\u53c2\u6570\u89c4\u8303"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u8bf7\u6c42\u65b9\u5f0f"),"\uff1a\u6309\u7167 ",Object(r.b)("inlineCode",{parentName:"li"},"GET\u3001POST\u3001PUT")," \u7b49\u542b\u4e49\u5b9a\u4e49\uff0c\u907f\u514d\u51fa\u73b0\u4e0d\u4e00\u81f4\u73b0\u8c61\uff0c\u5bf9\u4eba\u9020\u6210\u8bef\u89e3\u3001\u6b67\u4e49",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u8bf7\u6c42\u5934"),"\uff1a\u8bf7\u6c42\u5934\u6839\u636e\u9879\u76ee\u9700\u6c42\u6dfb\u52a0\u914d\u7f6e\u53c2\u6570\u3002\u5982\uff1a\u8bf7\u6c42\u6570\u636e\u683c\u5f0f\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"accept=application/json")," \u7b49\u3002\u5982\u6709\u9700\u8981\uff0c\u8bf7\u6c42\u5934\u53ef\u6839\u636e\u9879\u76ee\u9700\u6c42\u8981\u6c42\u4f20\u5165\u7528\u6237 token\u3001\u552f\u4e00\u9a8c\u7b7e\u7801\u7b49\u52a0\u5bc6\u6570\u636e"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"\u8bf7\u6c42\u53c2\u6570/\u8bf7\u6c42\u4f53"),"\uff1a \u8bf7\u6c42\u53c2\u6570\u5b57\u6bb5\uff0c\u5c3d\u53ef\u80fd\u4e0e\u6570\u636e\u5e93\u8868\u5b57\u6bb5\u3001\u5bf9\u8c61\u5c5e\u6027\u540d\u7b49\u4fdd\u6301\u4e00\u81f4\uff0c\u56e0\u4e3a\u4fdd\u6301\u4e00\u81f4\u6700\u7701\u4e8b\uff0c\u6700\u8212\u670d\u7684\u4e00\u4ef6\u4e8b")))),Object(r.b)("h3",{id:"636-\u8fd4\u56de\u6570\u636e\u89c4\u8303"},"6.3.6 \u8fd4\u56de\u6570\u636e\u89c4\u8303"),Object(r.b)("p",null,"\u7edf\u4e00\u89c4\u8303\u8fd4\u56de\u6570\u636e\u7684\u683c\u5f0f\uff0c\u5bf9\u5df1\u5bf9\u5f7c\u90fd\u6709\u597d\u5904\uff0c\u6b64\u5904\u4ee5 json \u683c\u5f0f\u4e3a\u4f8b\u3002\u8fd4\u56de\u6570\u636e\u5e94\u5305\u542b\uff1a",Object(r.b)("strong",{parentName:"p"},"\u8fd4\u56de\u72b6\u6001\u7801\u3001\u8fd4\u56de\u72b6\u6001\u4fe1\u606f\u3001\u5177\u4f53\u6570\u636e"),"\u3002",Object(r.b)("strong",{parentName:"p"},"\u8fd4\u56de\u6570\u636e\u4e2d\u7684\u72b6\u6001\u7801\u3001\u72b6\u6001\u4fe1\u606f\uff0c\u5e38\u6307\u5177\u4f53\u7684\u4e1a\u52a1\u72b6\u6001\uff0c\u4e0d\u5efa\u8bae\u548c HTTP \u72b6\u6001\u7801\u6df7\u5728\u4e00\u8d77"),"\u3002HTTP \u72b6\u6001\uff0c\u662f\u7528\u6765\u4f53\u73b0 HTTP \u94fe\u8def\u72b6\u6001\u60c5\u51b5\uff0c\u5982\uff1a404-Not Found\u3002HTTP \u72b6\u6001\u7801\u548c json \u7ed3\u679c\u4e2d\u7684\u72b6\u6001\u7801\uff0c\u5e76\u5b58\u5c1a\u53ef\uff0c\u7528\u4e8e\u4f53\u73b0\u4e0d\u540c\u7ef4\u5ea6\u7684\u72b6\u6001\u3002"),Object(r.b)("h2",{id:"64-\u4ec0\u4e48\u662f-swagger"},"6.4 \u4ec0\u4e48\u662f Swagger"),Object(r.b)("p",null,"\u76f8\u4fe1\u65e0\u8bba\u662f\u524d\u7aef\u8fd8\u662f\u540e\u7aef\u5f00\u53d1\uff0c\u90fd\u6216\u591a\u6216\u5c11\u5730\u88ab\u63a5\u53e3\u6587\u6863\u6298\u78e8\u8fc7\u3002\u524d\u7aef\u7ecf\u5e38\u62b1\u6028\u540e\u7aef\u7ed9\u7684\u63a5\u53e3\u6587\u6863\u4e0e\u5b9e\u9645\u60c5\u51b5\u4e0d\u4e00\u81f4\u3002\u540e\u7aef\u53c8\u89c9\u5f97\u7f16\u5199\u53ca\u7ef4\u62a4\u63a5\u53e3\u6587\u6863\u4f1a\u8017\u8d39\u4e0d\u5c11\u7cbe\u529b\uff0c\u7ecf\u5e38\u6765\u4e0d\u53ca\u66f4\u65b0\u3002"),Object(r.b)("p",null,"\u5176\u5b9e\u65e0\u8bba\u662f\u524d\u7aef\u8c03\u7528\u540e\u7aef\uff0c\u8fd8\u662f\u540e\u7aef\u8c03\u7528\u540e\u7aef\uff0c\u90fd\u671f\u671b\u6709\u4e00\u4e2a\u597d\u7684\u63a5\u53e3\u6587\u6863\u3002\u4f46\u662f\u8fd9\u4e2a\u63a5\u53e3\u6587\u6863\u5bf9\u4e8e\u7a0b\u5e8f\u5458\u6765\u8bf4\uff0c\u5c31\u8ddf\u6ce8\u91ca\u4e00\u6837\uff0c\u7ecf\u5e38\u4f1a\u62b1\u6028\u522b\u4eba\u5199\u7684\u4ee3\u7801\u6ca1\u6709\u5199\u6ce8\u91ca\uff0c\u7136\u800c\u81ea\u5df1\u5199\u8d77\u4ee3\u7801\u8d77\u6765\uff0c\u6700\u8ba8\u538c\u7684\uff0c\u4e5f\u662f\u5199\u6ce8\u91ca\u3002\u6240\u4ee5\u4ec5\u4ec5\u53ea\u901a\u8fc7\u5f3a\u5236\u6765\u89c4\u8303\u5927\u5bb6\u662f\u4e0d\u591f\u7684\uff0c\u968f\u7740\u65f6\u95f4\u63a8\u79fb\uff0c\u7248\u672c\u8fed\u4ee3\uff0c\u63a5\u53e3\u6587\u6863\u5f80\u5f80\u5f88\u5bb9\u6613\u5c31\u8ddf\u4e0d\u4e0a\u4ee3\u7801\u4e86\u3002"),Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u53d1\u73b0\u4e86\u75db\u70b9\u5c31\u8981\u53bb\u627e\u89e3\u51b3\u65b9\u6848\u3002\u89e3\u51b3\u65b9\u6848\u7528\u7684\u4eba\u591a\u4e86\uff0c\u5c31\u6210\u4e86\u6807\u51c6\u7684\u89c4\u8303\uff0c\u8fd9\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"strong"},"Swagger")," \u7684\u7531\u6765"),"\u3002"),Object(r.b)("p",null,"\u901a\u8fc7\u8fd9\u5957\u89c4\u8303\uff0c\u4f60\u53ea\u9700\u8981\u6309\u7167\u5b83\u7684\u89c4\u8303\u53bb\u5b9a\u4e49\u63a5\u53e3\u53ca\u63a5\u53e3\u76f8\u5173\u7684\u4fe1\u606f\u3002\u518d\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u884d\u751f\u51fa\u6765\u7684\u4e00\u7cfb\u5217\u9879\u76ee\u548c\u5de5\u5177\uff0c\u5c31\u53ef\u4ee5\u505a\u5230\u751f\u6210\u5404\u79cd\u683c\u5f0f\u7684\u63a5\u53e3\u6587\u6863\uff0c\u751f\u6210\u591a\u79cd\u8bed\u8a00\u7684\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u7684\u4ee3\u7801\uff0c\u4ee5\u53ca\u5728\u7ebf\u63a5\u53e3\u8c03\u8bd5\u9875\u9762\u7b49\u7b49\u3002"),Object(r.b)("p",null,"\u8fd9\u6837\uff0c\u5982\u679c\u6309\u7167\u65b0\u7684\u5f00\u53d1\u6a21\u5f0f\uff0c\u5728\u5f00\u53d1\u65b0\u7248\u672c\u6216\u8005\u8fed\u4ee3\u7248\u672c\u7684\u65f6\u5019\uff0c\u53ea\u9700\u8981\u66f4\u65b0 ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u63cf\u8ff0\u6587\u4ef6\uff0c\u5c31\u53ef\u4ee5\u81ea\u52a8\u751f\u6210\u63a5\u53e3\u6587\u6863\u548c\u5ba2\u6237\u7aef\u670d\u52a1\u7aef\u4ee3\u7801\uff0c\u505a\u5230\u8c03\u7528\u7aef\u4ee3\u7801\u3001\u670d\u52a1\u7aef\u4ee3\u7801\u4ee5\u53ca\u63a5\u53e3\u6587\u6863\u7684\u4e00\u81f4\u6027\u3002"),Object(r.b)("p",null,"\u6240\u4ee5\uff0cSwagger \u662f\u4e00\u4e2a\u89c4\u8303\u548c\u5b8c\u6574\u7684\u6846\u67b6\uff0c\u7528\u4e8e\u751f\u6210\u3001\u63cf\u8ff0\u3001\u8c03\u7528\u548c\u53ef\u89c6\u5316",Object(r.b)("inlineCode",{parentName:"p"},"RESTful")," \u98ce\u683c\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"Web")," \u670d\u52a1\u3002"),Object(r.b)("p",null,"\u603b\u4f53\u76ee\u6807\u662f\u4f7f\u5ba2\u6237\u7aef\u548c\u6587\u4ef6\u7cfb\u7edf\u4f5c\u4e3a\u670d\u52a1\u5668\u4ee5\u540c\u6837\u7684\u901f\u5ea6\u6765\u66f4\u65b0\u3002\u6587\u4ef6\u7684\u65b9\u6cd5\u3001\u53c2\u6570\u548c\u6a21\u578b\u7d27\u5bc6\u96c6\u6210\u5230\u670d\u52a1\u5668\u7aef\u7684\u4ee3\u7801\uff0c\u5141\u8bb8 API \u6765\u59cb\u7ec8\u4fdd\u6301\u540c\u6b65\u3002",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u8ba9\u90e8\u7f72\u7ba1\u7406\u548c\u4f7f\u7528\u529f\u80fd\u5f3a\u5927\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"API")," \u4ece\u672a\u5982\u6b64\u7b80\u5355\u3002"),Object(r.b)("h2",{id:"65-swagger-\u4f7f\u7528"},"6.5 Swagger \u4f7f\u7528"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u65b9\u4fbf\u4e14\u7075\u6d3b\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u914d\u7f6e\uff0c\u65e0\u9700\u589e\u52a0\u989d\u5916\u5b66\u4e60\u6210\u672c\u3002"),Object(r.b)("h3",{id:"651-\u6ce8\u518c\u670d\u52a1"},"6.5.1 \u6ce8\u518c\u670d\u52a1"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{11,21} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{11,21}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddSpecificationDocuments();\n services.AddControllers();\n }\n\n public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n {\n // Other Codes\n\n app.UseSpecificationDocuments();\n\n app.UseEndpoints(endpoints =>\n {\n endpoints.MapControllers();\n });\n }\n }\n}\n")),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"services.AddSpecificationDocuments()")," \u901a\u5e38\u548c ",Object(r.b)("inlineCode",{parentName:"p"},".AddDynamicApiControllers()")," \u6210\u5bf9\u51fa\u73b0\u3002"))),Object(r.b)("h3",{id:"652-\u9ed8\u8ba4\u5730\u5740"},"6.5.2 \u9ed8\u8ba4\u5730\u5740"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"p"},"\u89c4\u8303\u5316\u6587\u6863")," \u5730\u5740\u4e3a\u4e3b\u673a\u6839\u76ee\u5f55\uff0c",Object(r.b)("strong",{parentName:"p"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"),"\u3002"),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger1.png")}),Object(r.b)("h3",{id:"653-\u9ed8\u8ba4\u5206\u7ec4"},"6.5.3 \u9ed8\u8ba4\u5206\u7ec4"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\u9ed8\u8ba4\u5206\u7ec4\u540d\u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"Default"),"\uff0c",Object(r.b)("strong",{parentName:"p"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"),"\u3002"),Object(r.b)("h3",{id:"654-\u6587\u6863\u6ce8\u91ca"},"6.5.4 \u6587\u6863\u6ce8\u91ca"),Object(r.b)("p",null,"\u89c4\u8303\u5316\u6587\u6863\u9ed8\u8ba4\u626b\u63cf ",Object(r.b)("inlineCode",{parentName:"p"},"Fur.Application"),"\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur.Web.Core"),"\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur.Web.Entry")," \u4e09\u4e2a\u7a0b\u5e8f\u96c6",Object(r.b)("inlineCode",{parentName:"p"},".xml")," \u6ce8\u91ca\u6587\u4ef6\uff0c",Object(r.b)("strong",{parentName:"p"},"\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e"),"\u3002"),Object(r.b)("p",null,"\u53ea\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},"///")," \u6807\u8bc6\u7684\u6ce8\u91ca\u8bed\u6cd5\uff0c\u5982\uff1a",Object(r.b)("strong",{parentName:"p"},"\u7c7b\u3001\u65b9\u6cd5\u3001\u5c5e\u6027\u3001\u53c2\u6570\u3001\u8fd4\u56de\u503c\u3001\u9a8c\u8bc1\u7279\u6027"),"\u3002"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5-7,10-13,19-23}","{5-7,10-13,19-23}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n /// \n /// \u7c7b\u6ce8\u91ca\n /// \n public class FurAppService : IDynamicApiController\n {\n /// \n /// \u65b9\u6cd5\u6ce8\u91ca\n /// \n /// \n public string Get()\n {\n return nameof(Fur);\n }\n\n /// \n /// \u5e26 ID \u53c2\u6570\u7684\u65b9\u6cd5\u6ce8\u91ca\n /// \n /// \n /// \n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger2.png")}),Object(r.b)("h3",{id:"655-\u591a\u5206\u7ec4\u652f\u6301"},"6.5.5 \u591a\u5206\u7ec4\u652f\u6301"),Object(r.b)("p",null,"\u591a\u5206\u7ec4\u662f\u4e00\u4e2a\u7cfb\u7edf\u4e2d\u5fc5\u5907\u529f\u80fd\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u7cfb\u7edf\u5212\u5206\u4e3a\u591a\u4e2a\u6a21\u5757\uff0c\u6bcf\u4e2a\u6a21\u5757\u90fd\u72ec\u7acb\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"api")," \u914d\u7f6e\u3002\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u5b9e\u73b0\u591a\u5206\u7ec4\u975e\u5e38\u7b80\u5355\u3002\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,21,32}","{5,21,32}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings("Group1")]\n public class FurAppService : IDynamicApiController\n {\n /// \n /// \u968f\u7236\u7c7b Group1 \u5206\u7ec4\n /// \n /// \n public string Post()\n {\n return nameof(Fur);\n }\n\n /// \n /// \u5728 Group1\u3001Group3 \u90fd\u6709\u6211\n /// \n /// \n [ApiDescriptionSettings("Group1", "Group3")]\n public string Get()\n {\n return nameof(Fur);\n }\n\n /// \n /// \u6211\u53ea\u5728 Group2 \u51fa\u73b0\n /// \n /// \n /// \n [ApiDescriptionSettings("Group2")]\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger3.gif")}),Object(r.b)("h3",{id:"656-\u591a\u5206\u7ec4\u6392\u5e8f"},"6.5.6 \u591a\u5206\u7ec4\u6392\u5e8f"),Object(r.b)(l.a,{defaultValue:"fz1",values:[{label:"\u65b9\u5f0f\u4e00",value:"fz1"},{label:"\u65b9\u5f0f\u4e8c",value:"fz2"}],mdxType:"Tabs"},Object(r.b)(b.a,{value:"fz1",mdxType:"TabItem"},Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u901a\u8fc7\u5206\u7ec4\u540d\u79f0\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"strong"},"@\u6574\u6570")," \u8fdb\u884c\u6392\u5e8f")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,19}","{5,19}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings("Group1@1")]\n public class FurAppService : IDynamicApiController\n {\n public string Post()\n {\n return nameof(Fur);\n }\n\n [ApiDescriptionSettings("Group1", "Group3")]\n public string Get()\n {\n return nameof(Fur);\n }\n\n [ApiDescriptionSettings("Group@2")]\n public int Get(int id),19\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u53ef\u4ee5\u901a\u8fc7\u5728\u5206\u7ec4\u540d\u540e\u9762\u6dfb\u52a0 ",Object(r.b)("inlineCode",{parentName:"p"},"@\u6574\u6570")," \u8fdb\u884c\u6392\u5e8f\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"\u6574\u6570")," \u8d8a\u5927\u6392\u524d\u9762\u3002\u5982\u679c\u5206\u7ec4\u540d\u79f0\u591a\u6b21\u6307\u5b9a\u4e14\u591a\u6b21\u6307\u5b9a\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"@\u6574\u6570")," \uff0c\u5219\u81ea\u52a8",Object(r.b)("strong",{parentName:"p"},"\u53d6\u8be5\u5206\u7ec4\u6700\u5927\u7684\u6574\u6570"),"\u8fdb\u884c\u6392\u5e8f\u3002")),Object(r.b)(b.a,{value:"fz2",mdxType:"TabItem"},Object(r.b)("p",null,Object(r.b)("strong",{parentName:"p"},"\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u914d\u7f6e\u6392\u5e8f")),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2,3,4-17} title="Fur.Web.Entry/appsettings.json"',"{2,3,4-17}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "SpecificationDocumentSettings": {\n "GroupOpenApiInfos": [\n {\n "Group": "Group1",\n "Order": 1\n },\n {\n "Group": "Group2",\n "Order": 2\n },\n {\n "Group": "Group3",\n "Order": 0\n }\n ]\n }\n }\n}\n')))),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger5.png")}),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u6392\u5e8f\u8bf4\u660e")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5206\u7ec4\u9ed8\u8ba4\u6392\u5e8f ",Object(r.b)("inlineCode",{parentName:"p"},"Order")," \u4e3a ",Object(r.b)("inlineCode",{parentName:"p"},"0"),"\u3002\u5982\u679c\u540c\u65f6\u914d\u7f6e\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"@\u6574\u6570")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u914d\u7f6e\u6587\u4ef6\uff0c\u90a3\u4e48\u4f18\u5148\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"Order")))),Object(r.b)("h3",{id:"657-\u591a\u5206\u7ec4\u4fe1\u606f\u914d\u7f6e"},"6.5.7 \u591a\u5206\u7ec4\u4fe1\u606f\u914d\u7f6e"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u53ef\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},"appsetting.json")," \u914d\u7f6e\u5206\u7ec4\u4fe1\u606f\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{3,4-20} title="Fur.Web.Entry/appsettings.json"',"{3,4-20}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "SpecificationDocumentSettings": {\n "GroupOpenApiInfos": [\n {\n "Group": "Group1",\n "Title": "\u5206\u7ec4\u6807\u9898",\n "Description": "\u8fd9\u91cc\u662f\u5206\u7ec4\u63cf\u8ff0",\n "Version": "\u7248\u672c\u53f7",\n "TermsOfService": "https://chinadot.net",\n "Contact": {\n "Name": "\u767e\u5c0f\u50e7",\n "Url": "https://gitee.com/monksoul",\n "Email": "monksoul@outlook.com"\n },\n "License": {\n "Name": "Apache-2.0",\n "Url": "https://gitee.com/monksoul/Fur/blob/alpha/LICENSE"\n }\n }\n ]\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger5.png")}),Object(r.b)("h3",{id:"658-\u7ec4\u4e2d\u7ec4\uff08\u6807\u7b7e\uff09"},"6.5.8 \u7ec4\u4e2d\u7ec4\uff08\u6807\u7b7e\uff09"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Tag")," \u914d\u7f6e\u4e3b\u8981\u7528\u4e8e\u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u6807\u7b7e\u5206\u7ec4\u4fe1\u606f\u53ca\u5408\u5e76\u6807\u7b7e\u3002\u4e5f\u5c31\u662f ",Object(r.b)("inlineCode",{parentName:"p"},"\u7ec4\u4e2d\u7ec4"),":"),Object(r.b)(l.a,{defaultValue:"tag1",values:[{label:"\u6807\u7b7e\u547d\u540d",value:"tag1"},{label:"\u5408\u5e76\u6807\u7b7e",value:"tag2"}],mdxType:"Tabs"},Object(r.b)(b.a,{value:"tag1",mdxType:"TabItem"},Object(r.b)("h4",{id:"\u672a\u8d34\u6807\u7b7e\u4e4b\u524d"},"\u672a\u8d34\u6807\u7b7e\u4e4b\u524d"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n")),Object(r.b)("h4",{id:"\u8d34\u6807\u7b7e\u4e4b\u540e"},"\u8d34\u6807\u7b7e\u4e4b\u540e"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,19}","{5,19}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Tag = "\u5206\u7ec4\u4e00")]\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n [ApiDescriptionSettings(Tag = "\u5206\u7ec4\u4e8c")]\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/tag1.png")})),Object(r.b)(b.a,{value:"tag2",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,19}","{5,19}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [ApiDescriptionSettings(Tag = "\u5408\u5e76\u6240\u6709\u6807\u7b7e")]\n public class FurAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n\n [ApiDescriptionSettings(Tag = "\u5408\u5e76\u6240\u6709\u6807\u7b7e")]\n public class TestAppService : IDynamicApiController\n {\n public string Get()\n {\n return nameof(Fur);\n }\n\n public int Get(int id)\n {\n return id;\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/tag2.png")}))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u5c0f\u77e5\u8bc6")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c ",Object(r.b)("inlineCode",{parentName:"p"},"Tag")," \u540d\u5b57\u4e00\u6837\uff0c\u5219\u4f1a\u81ea\u52a8\u5408\u5e76\uff0c\u5426\u5219\u53ea\u662f\u547d\u540d\u3002"))),Object(r.b)("h3",{id:"659-\u9ed8\u8ba4\u5c55\u5f00\u6240\u6709\u6587\u6863"},"6.5.9 \u9ed8\u8ba4\u5c55\u5f00\u6240\u6709\u6587\u6863"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-5} title="Fur.Web.Entry/appsettings.json"',"{2-5}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "SpecificationDocumentSettings": {\n "DocExpansionState": "Full"\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger6.gif")}),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"DocExpansionState")," \u914d\u7f6e\u8bf4\u660e\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"List"),"\uff1a\u5217\u8868\u5f0f\uff08\u5c55\u5f00\u5b50\u7c7b\uff09\uff0c",Object(r.b)("strong",{parentName:"li"},"\u9ed8\u8ba4\u503c")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Full"),"\uff1a\u5b8c\u5168\u5c55\u5f00"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"None"),"\uff1a\u5217\u8868\u5f0f\uff08\u4e0d\u5c55\u5f00\u5b50\u7c7b\uff09")),Object(r.b)("h3",{id:"6510-\u914d\u7f6e\u6587\u6863\u6807\u9898"},"6.5.10 \u914d\u7f6e\u6587\u6863\u6807\u9898"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-5} title="Fur.Web.Entry/appsettings.json"',"{2-5}":!0,title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "SpecificationDocumentSettings": {\n "DocumentTitle": "\u6211\u662f\u81ea\u5b9a\u4e49\u6807\u9898"\n }\n }\n}\n')),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger7.png")}),Object(r.b)("h3",{id:"6511-\u6388\u6743\u63a7\u5236"},"6.5.11 \u6388\u6743\u63a7\u5236"),Object(r.b)("p",null,"\u5f85\u6574\u7406..."),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'title="Fur.Web.Entry/appsettings.json"',title:'"Fur.Web.Entry/appsettings.json"'}),'{\n "AppSettings": {\n "SpecificationDocumentSettings": {\n "EnableAuthorized": true,\n\n "SecurityDefinitions": [\n {\n "Id": "Bearer",\n "Type": "Http",\n "Name": "Authorization",\n "Description": "JWT Authorization header using the Bearer scheme.",\n "BearerFormat": "JWT",\n "Scheme": "bearer",\n "In": "Header",\n\n "Requirement": {\n "Scheme": {\n "Reference": {\n "Id": "Bearer",\n "Type": "SecurityScheme"\n },\n "Accesses": null\n }\n }\n }\n ]\n }\n }\n}\n')),Object(r.b)("h3",{id:"6512-\u5728\u7ebf\u6d4b\u8bd5"},"6.5.12 \u5728\u7ebf\u6d4b\u8bd5"),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/swagger8.gif")}),Object(r.b)("h3",{id:"6513-\u6027\u80fd\u76d1\u89c6-miniprofiler"},"6.5.13 \u6027\u80fd\u76d1\u89c6 ",Object(r.b)("inlineCode",{parentName:"h3"},"MiniProfiler")),Object(r.b)("p",null,"\u89c4\u8303\u5316\u6587\u6863\u9ed8\u8ba4\u96c6\u6210\u4e86 ",Object(r.b)("inlineCode",{parentName:"p"},"MiniProfiler")," \u7b2c\u4e09\u65b9\u6027\u80fd\u7ec4\u4ef6\uff0c\u901a\u8fc7\u8be5\u7ec4\u4ef6\u53ef\u4ee5\u65b9\u4fbf\u67e5\u770b\u8bf7\u6c42\u6027\u80fd\u3001\u5f02\u5e38\u5806\u6808\u3001\u6570\u636e\u5e93\u64cd\u4f5c\u7b49\u4fe1\u606f\u3002\u9ed8\u8ba4\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Swagger")," \u9996\u9875\u5de6\u4e0a\u89d2\u663e\u793a\u3002"),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/mipr.png")}),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u5c0f\u63d0\u793a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u4e5f\u53ef\u4ee5\u901a\u8fc7 ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"appsetting.json"))," \u4e2d ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"AppSettings:InjectMiniProfiler"))," \u8bbe\u4e3a ",Object(r.b)("strong",{parentName:"p"},Object(r.b)("inlineCode",{parentName:"strong"},"false"))," \u5173\u95ed\u3002"))),Object(r.b)("h3",{id:"6514-\u5b9a\u4e49\u63a5\u53e3\u8f93\u51fa\u7c7b\u578b"},"6.5.14 \u5b9a\u4e49\u63a5\u53e3\u8f93\u51fa\u7c7b\u578b"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8-9}","{2,8-9}":!0}),"using Fur.DynamicApiController;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Application\n{\n public class FurAppService : IDynamicApiController\n {\n [ProducesResponseType(201, Type = typeof(TestDto))]\n [ProducesResponseType(400)]\n public string Get()\n {\n return nameof(Fur);\n }\n }\n}\n")),Object(r.b)("p",null,"\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(r.b)("img",{src:Object(c.a)("img/fhzlx.png")}),Object(r.b)("h2",{id:"66-specificationdocumentsettings-\u914d\u7f6e"},"6.6 ",Object(r.b)("inlineCode",{parentName:"h2"},"SpecificationDocumentSettings")," \u914d\u7f6e"),Object(r.b)("p",null,"\u9664\u4e86\u4e0a\u8ff0\u4f8b\u5b50\u5916\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e86\u4e00\u4e9b\u914d\u7f6e\u9009\u9879\uff0c\u5982\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DocumentTitle"),"\uff1a\u6587\u6863\u6807\u9898\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"Specification Api Document")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DefaultGroupName"),"\uff1a\u9ed8\u8ba4\u5206\u7ec4\u540d\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"Default")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"EnableAuthorized"),"\uff1a\u662f\u5426\u542f\u7528\u6743\u9650\u63a7\u5236\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"true")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"FormatAsV2"),"\uff1a\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"li"},"Swagger 2.0")," \u7248\u672c\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"bool"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"false")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"RoutePrefix"),"\uff1a\u89c4\u8303\u5316\u6587\u6863\u5730\u5740\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"string")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"DocExpansionState"),"\uff1a\u6587\u6863\u663e\u793a\u65b9\u5f0f\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"DocExpansion"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"List"),"\uff0c\u53d6\u503c\uff1a",Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"List"),"\uff1a\u5217\u8868\u5f0f\uff08\u5c55\u5f00\u5b50\u7c7b\uff09\uff0c",Object(r.b)("strong",{parentName:"li"},"\u9ed8\u8ba4\u503c")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Full"),"\uff1a\u5b8c\u5168\u5c55\u5f00"),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"None"),"\uff1a\u5217\u8868\u5f0f\uff08\u4e0d\u5c55\u5f00\u5b50\u7c7b\uff09"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"XmlComments"),"\uff1a\u7a0b\u5e8f\u96c6\u6ce8\u91ca\u63cf\u8ff0\u6587\u4ef6\u540d\uff08\u53ef\u5e26 ",Object(r.b)("inlineCode",{parentName:"li"},".xml"),"\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"string"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"Fur.Application, Fur.Web.Entry, Fur.Web.Core")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"GroupOpenApiInfos"),"\uff1a\u5206\u7ec4\u4fe1\u606f\u914d\u7f6e\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"SpecificationOpenApiInfo[]"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"{ 'Group': 'Default'}")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"SecurityDefinitions"),"\uff1a\u5b89\u5168\u7b56\u7565\u5b9a\u4e49\u914d\u7f6e\uff0c",Object(r.b)("inlineCode",{parentName:"li"},"SpecificationOpenApiSecurityScheme[]"),"\uff0c\u9ed8\u8ba4 ",Object(r.b)("inlineCode",{parentName:"li"},"[]"))),Object(r.b)("h2",{id:"67-\u7edf\u4e00\u8fd4\u56de\u503c\u6a21\u578b"},"6.7 \u7edf\u4e00\u8fd4\u56de\u503c\u6a21\u578b"),Object(r.b)("p",null,Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b ",Object(r.b)("inlineCode",{parentName:"p"},"\u89c4\u8303\u5316\u7ed3\u679c")," \u529f\u80fd\uff0c\u53ef\u4ee5\u901a\u8fc7\u5b9e\u73b0 ",Object(r.b)("inlineCode",{parentName:"p"},"IUnifyResultProvider")," \u63d0\u4f9b\u5668\u5b9e\u73b0\u7edf\u4e00\u89c4\u8303\u5316\u8fd4\u56de\u503c\u5b9a\u5236\uff0c\u5982\uff1a",Object(r.b)("inlineCode",{parentName:"p"},"RESTfulResultProvider"),"\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'using Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.AspNetCore.Mvc.Filters;\nusing Microsoft.AspNetCore.Mvc.ModelBinding;\nusing System.Collections.Generic;\n\nnamespace Fur.UnifyResult\n{\n /// \n /// RESTful \u98ce\u683c\u8fd4\u56de\u503c\n /// \n public class RESTfulResultProvider : IUnifyResultProvider\n {\n /// \n /// \u5f02\u5e38\u8fd4\u56de\u503c\n /// \n /// \n /// \n public IActionResult OnException(ExceptionContext context)\n {\n return new JsonResult(new RESTfulResult\n {\n StatusCode = StatusCodes.Status500InternalServerError,\n Successed = false,\n Data = null,\n Errors = context.Exception.Message\n });\n }\n\n /// \n /// \u6210\u529f\u8fd4\u56de\u503c\n /// \n /// \n /// \n public IActionResult OnSuccessed(ActionExecutedContext context)\n {\n object data;\n // \u5904\u7406\u5185\u5bb9\u7ed3\u679c\n if (context.Result is ContentResult contentResult) data = contentResult.Content;\n // \u5904\u7406\u5bf9\u8c61\u7ed3\u679c\n else if (context.Result is ObjectResult objectResult) data = objectResult.Value;\n else return null;\n\n return new JsonResult(new RESTfulResult\n {\n StatusCode = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK,\n Successed = true,\n Data = data,\n Errors = null\n });\n }\n\n /// \n /// \u9a8c\u8bc1\u5931\u8d25\u8fd4\u56de\u503c\n /// \n /// \n /// \n /// \n /// \n /// \n public IActionResult OnValidateFailed(ActionExecutingContext context, ModelStateDictionary modelStates, Dictionary> validationResults, string validateFaildMessage)\n {\n return new JsonResult(new RESTfulResult\n {\n StatusCode = StatusCodes.Status400BadRequest,\n Successed = false,\n Data = null,\n Errors = validationResults\n });\n }\n }\n}\n')),Object(r.b)("p",null,"\u4e4b\u540e\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Startup.cs")," \u4e2d\u6ce8\u518c\u5373\u53ef\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),"services.AddControllers().AddUnifyResult();\n")),Object(r.b)("h2",{id:"68-\u53cd\u9988\u4e0e\u5efa\u8bae"},"6.8 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))))}m.isMDXComponent=!0},142:function(e,n,t){"use strict";t.d(n,"a",(function(){return s})),t.d(n,"b",(function(){return d}));var a=t(0),i=t.n(a);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function c(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var o=i.a.createContext({}),p=function(e){var n=i.a.useContext(o),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},s=function(e){var n=p(e.components);return i.a.createElement(o.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},m=i.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,c=e.parentName,o=b(e,["components","mdxType","originalType","parentName"]),s=p(t),m=a,d=s["".concat(c,".").concat(m)]||s[m]||u[m]||r;return t?i.a.createElement(d,l(l({ref:n},o),{},{components:t})):i.a.createElement(d,l({ref:n},o))}));function d(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,c=new Array(r);c[0]=m;var l={};for(var b in n)hasOwnProperty.call(n,b)&&(l[b]=n[b]);l.originalType=e,l.mdxType="string"==typeof e?e:a,c[1]=l;for(var o=2;ofunction(e,n,t,{forcePrependBaseUrl:a=!1,absolute:r=!1}={}){if(!t)return t;if(t.startsWith("#"))return t;if(Object(i.b)(t))return t;if(a)return n+t;const c=t.startsWith(n)?t:n+t.replace(/^\//,"");return r?e+c:c}(n,e,t,a)}}function c(e,n={}){const{withBaseUrl:t}=r();return t(e,n)}},145:function(e,n,t){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function i(e){return void 0!==e&&!a(e)}t.d(n,"b",(function(){return a})),t.d(n,"a",(function(){return i}))},146:function(e,n,t){"use strict";function a(e){var n,t,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;nn.value===e)&&j(e)}const f=e=>{j(e),null!=u&&d(u,e)},v=[],C=e=>{e.metaKey||e.altKey||e.ctrlKey||N(!0)},h=()=>{N(!1)};return Object(a.useEffect)(()=>{window.addEventListener("keydown",C),window.addEventListener("mousedown",h)},[]),i.a.createElement("div",null,i.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(c.a)("tabs",{"tabs--block":n})},s.map(({value:e,label:n})=>i.a.createElement("li",{role:"tab",tabIndex:0,"aria-selected":O===e,className:Object(c.a)("tabs__item",b.a.tabItem,{"tabs__item--active":O===e}),style:g?{}:{outline:"none"},key:e,ref:e=>v.push(e),onKeyDown:e=>{((e,n,t)=>{switch(t.keyCode){case p:((e,n)=>{const t=e.indexOf(n)+1;e[t]?e[t].focus():e[0].focus()})(e,n);break;case o:((e,n)=>{const t=e.indexOf(n)-1;e[t]?e[t].focus():e[e.length-1].focus()})(e,n)}})(v,e.target,e),C(e)},onFocus:()=>f(e),onClick:()=>{f(e),N(!1)},onPointerDown:()=>N(!1)},n))),i.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(t).filter(e=>e.props.value===O)[0]))}},150:function(e,n,t){"use strict";var a=t(0),i=t.n(a);n.a=function(e){return i.a.createElement("div",null,e.children)}}}]); \ No newline at end of file diff --git a/docs/e1713ffa.f1e4e3c8.js b/docs/e1713ffa.f86c14eb.js similarity index 91% rename from docs/e1713ffa.f1e4e3c8.js rename to docs/e1713ffa.f86c14eb.js index aeb85ee45d9..6279b40d8e7 100644 --- a/docs/e1713ffa.f1e4e3c8.js +++ b/docs/e1713ffa.f86c14eb.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[74],{128:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return s})),t.d(n,"metadata",(function(){return c})),t.d(n,"rightToc",(function(){return b})),t.d(n,"default",(function(){return O}));var a=t(2),i=t(6),o=(t(0),t(142)),p=(t(144),t(149)),r=t(150),s={id:"options",title:"4.2 \u9009\u9879",sidebar_label:"4.2 \u9009\u9879"},c={unversionedId:"options",id:"options",isDocsHomePage:!1,title:"4.2 \u9009\u9879",description:"4.2.1 \u4ec0\u4e48\u662f\u9009\u9879",source:"@site/docs\\options.mdx",slug:"/options",permalink:"/docs/options",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/options.mdx",version:"current",sidebar_label:"4.2 \u9009\u9879",sidebar:"docs",previous:{title:"4.1 \u914d\u7f6e",permalink:"/docs/configuration"},next:{title:"5. \u52a8\u6001 WebAPI",permalink:"/docs/dynamic-api-controller"}},b=[{value:"4.2.1 \u4ec0\u4e48\u662f\u9009\u9879",id:"421-\u4ec0\u4e48\u662f\u9009\u9879",children:[]},{value:"4.2.2 \u4e0e\u914d\u7f6e\u7684\u533a\u522b",id:"422-\u4e0e\u914d\u7f6e\u7684\u533a\u522b",children:[]},{value:"4.2.3 \u9009\u9879\u7684\u4f7f\u7528",id:"423-\u9009\u9879\u7684\u4f7f\u7528",children:[{value:"4.2.3.1 \u914d\u7f6e appsettings.json \u4fe1\u606f",id:"4231-\u914d\u7f6e-appsettingsjson-\u4fe1\u606f",children:[]},{value:"4.2.3.2 \u521b\u5efa AppInfoOptions \u5f3a\u7c7b\u578b\u7c7b",id:"4232-\u521b\u5efa-appinfooptions-\u5f3a\u7c7b\u578b\u7c7b",children:[]},{value:"4.2.3.3 \u6ce8\u518c AppInfoOptions \u670d\u52a1",id:"4233-\u6ce8\u518c-appinfooptions-\u670d\u52a1",children:[]},{value:"4.2.3.4 \u8bfb\u53d6 AppInfoOptions \u4fe1\u606f",id:"4234-\u8bfb\u53d6-appinfooptions-\u4fe1\u606f",children:[]},{value:"4.2.3.5 \u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f",id:"4235-\u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f",children:[]}]},{value:"4.2.4 \u9009\u9879\u63a5\u53e3\u8bf4\u660e",id:"424-\u9009\u9879\u63a5\u53e3\u8bf4\u660e",children:[]},{value:"4.2.5 \u9009\u9879\u81ea\u5b9a\u4e49\u914d\u7f6e",id:"425-\u9009\u9879\u81ea\u5b9a\u4e49\u914d\u7f6e",children:[{value:"4.2.5.1 \u9009\u9879\u67e5\u627e\u952e\u6d41\u7a0b",id:"4251-\u9009\u9879\u67e5\u627e\u952e\u6d41\u7a0b",children:[]}]},{value:"4.2.6 [OptionsSettings] \u8bf4\u660e",id:"426-optionssettings-\u8bf4\u660e",children:[]},{value:"4.2.7 \u9009\u9879\u9a8c\u8bc1",id:"427-\u9009\u9879\u9a8c\u8bc1",children:[]},{value:"4.2.8 \u9009\u9879\u540e\u671f\u914d\u7f6e",id:"428-\u9009\u9879\u540e\u671f\u914d\u7f6e",children:[]},{value:"4.2.9 \u9009\u9879\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09",id:"429-\u9009\u9879\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09",children:[]},{value:"4.2.10 \u9009\u9879\u7684\u4f18\u7f3a\u70b9",id:"4210-\u9009\u9879\u7684\u4f18\u7f3a\u70b9",children:[]},{value:"4.2.11 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"4211-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],l={rightToc:b};function O(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(o.b)("wrapper",Object(a.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(o.b)("h2",{id:"421-\u4ec0\u4e48\u662f\u9009\u9879"},"4.2.1 \u4ec0\u4e48\u662f\u9009\u9879"),Object(o.b)("p",null,"\u9009\u9879\u662f ",Object(o.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u63a8\u8350\u7684\u52a8\u6001\u8bfb\u53d6\u914d\u7f6e\u7684\u65b9\u5f0f\uff0c\u8fd9\u79cd\u65b9\u5f0f\u5c06\u914d\u7f6e\u6587\u4ef6\u6570\u636e\u7528\u4e00\u4e2a",Object(o.b)("strong",{parentName:"p"},"\u5f3a\u7c7b\u578b"),"\u6765\u6258\u7ba1\uff0c\u80fd\u591f\u5b9e\u73b0\u914d\u7f6e\u9a8c\u8bc1\u3001\u9ed8\u8ba4\u503c\u914d\u7f6e\u3001\u5b9e\u65f6\u8bfb\u53d6\u7b49\u529f\u80fd\u3002"),Object(o.b)("h2",{id:"422-\u4e0e\u914d\u7f6e\u7684\u533a\u522b"},"4.2.2 \u4e0e\u914d\u7f6e\u7684\u533a\u522b"),Object(o.b)("p",null,"\u9009\u9879\u5b9e\u9645\u4e0a\u4e5f\u662f\u914d\u7f6e\uff0c\u4f46\u5728\u540e\u8005\u7684\u57fa\u7840\u4e0a\u6dfb\u52a0\u4e86\u914d\u7f6e\u9a8c\u8bc1\u3001\u9ed8\u8ba4\u503c/\u540e\u671f\u914d\u7f6e\u8bbe\u5b9a\u53ca\u63d0\u4f9b\u4e86\u591a\u79cd\u63a5\u53e3\u8bfb\u53d6\u914d\u7f6e\u4fe1\u606f\uff0c\u540c\u65f6\u8fd8\u652f\u6301\u4f9b\u914d\u7f6e\u66f4\u6539\u901a\u77e5\u7b49\u5f3a\u5927\u7075\u6d3b\u529f\u80fd\u3002"),Object(o.b)("p",null,"\u6240\u4ee5\uff0c\u9664\u4e86\u4e00\u6b21\u6027\u8bfb\u53d6\u4f7f\u7528\u7684\u914d\u7f6e\u4ee5\u5916\uff0c\u90fd\u5e94\u8be5\u9009\u7528 ",Object(o.b)("strong",{parentName:"p"},"\u9009\u9879")," \u66ff\u6362 ",Object(o.b)("strong",{parentName:"p"},"\u914d\u7f6e"),"\u3002"),Object(o.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u77e5\u8bc6\u5bfc\u822a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u6709\u5173\u914d\u7f6e\u8bf4\u660e\u53ef\u67e5\u770b\u300a",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"/docs/configuration"}),"4.1 \u914d\u7f6e"),"\u300b \u7ae0\u8282\u3002"))),Object(o.b)("h2",{id:"423-\u9009\u9879\u7684\u4f7f\u7528"},"4.2.3 \u9009\u9879\u7684\u4f7f\u7528"),Object(o.b)("p",null,"\u5047\u8bbe\u6211\u4eec\u9700\u8981\u5728\u7cfb\u7edf\u8fd0\u884c\u65f6\u83b7\u53d6",Object(o.b)("strong",{parentName:"p"},"\u7cfb\u7edf\u540d\u79f0\u3001\u7248\u672c\u53f7\u53ca\u7248\u6743\u4fe1\u606f"),"\uff0c\u8fd9\u4e9b\u4fe1\u606f\u53ef\u80fd\u968f\u65f6\u53d8\u5316\u800c\u4e14\u9700\u8981\u5728\u591a\u4e2a\u5730\u65b9\u4f7f\u7528\u3002\u8fd9\u65f6\u5c31\u9700\u8981\u5c06\u8fd9\u4e9b\u4fe1\u606f\u914d\u7f6e\u8d77\u6765\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a"),Object(o.b)("h3",{id:"4231-\u914d\u7f6e-appsettingsjson-\u4fe1\u606f"},"4.2.3.1 \u914d\u7f6e ",Object(o.b)("inlineCode",{parentName:"h3"},"appsettings.json")," \u4fe1\u606f"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:"{2-6}","{2-6}":!0}),'{\n "AppInfo": {\n "Name": "Fur",\n "Version": "1.0.0",\n "Company": "Baiqian"\n }\n}\n')),Object(o.b)("h3",{id:"4232-\u521b\u5efa-appinfooptions-\u5f3a\u7c7b\u578b\u7c7b"},"4.2.3.2 \u521b\u5efa ",Object(o.b)("inlineCode",{parentName:"h3"},"AppInfoOptions")," \u5f3a\u7c7b\u578b\u7c7b"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5}","{1,5}":!0}),"using Fur.ConfigurableOptions;\n\nnamespace Fur.Application\n{\n public class AppInfoOptions : IConfigurableOptions\n {\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n }\n}\n")),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u6e29\u99a8\u63d0\u793a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u5efa\u8bae\u6240\u6709\u9009\u9879\u7c7b\u90fd\u5e94\u8be5\u4ee5 ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"Options"))," \u547d\u540d\u7ed3\u5c3e\u3002"),Object(o.b)("p",{parentName:"div"},"\u53e6\u5916\uff0c",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u6ce8\u518c\u9009\u9879\u670d\u52a1\u7684\u65b9\u6cd5\uff0c\u53ea\u9700\u8981\u7ee7\u627f ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions"))," \u63a5\u53e3\u5373\u53ef\uff0c\u8be5\u63a5\u53e3\u4f4d\u4e8e ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"Fur.ConfigurableOptions"))," \u547d\u540d\u7a7a\u95f4\u4e0b\u3002"))),Object(o.b)("h3",{id:"4233-\u6ce8\u518c-appinfooptions-\u670d\u52a1"},"4.2.3.3 \u6ce8\u518c ",Object(o.b)("inlineCode",{parentName:"h3"},"AppInfoOptions")," \u670d\u52a1"),Object(o.b)("p",null,Object(o.b)("strong",{parentName:"p"},"\u9009\u9879\u4e0d\u540c\u4e8e\u914d\u7f6e\uff0c\u9700\u5728\u5e94\u7528\u542f\u52a8\u65f6\u6ce8\u518c")),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{12} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{12}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddConfigurableOptions();\n }\n }\n}\n")),Object(o.b)("h3",{id:"4234-\u8bfb\u53d6-appinfooptions-\u4fe1\u606f"},"4.2.3.4 \u8bfb\u53d6 ",Object(o.b)("inlineCode",{parentName:"h3"},"AppInfoOptions")," \u4fe1\u606f"),Object(o.b)("p",null,"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u63d0\u4f9b\u4e86\u591a\u79cd\u8bfb\u53d6\u65b9\u5f0f\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u901a\u8fc7 ",Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptions(jsonKey)")," \u8bfb\u53d6\uff08",Object(o.b)("strong",{parentName:"li"},"\u4e0d\u63a8\u8350"),"\uff09"),Object(o.b)("li",{parentName:"ul"},"\u901a\u8fc7\u4f9d\u8d56\u6ce8\u5165\u4ee5\u4e0b\u5b9e\u4f8b\u8bfb\u53d6\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptions")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptionsSnapshot")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptionsMonitor")))),Object(o.b)("li",{parentName:"ul"},"\u901a\u8fc7 ",Object(o.b)("inlineCode",{parentName:"li"},"App")," \u9759\u6001\u7c7b\u63d0\u4f9b\u7684\u9759\u6001\u65b9\u6cd5\u83b7\u53d6\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptions()")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptionsMonitor()")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptionsSnapshot()"))))),Object(o.b)(p.a,{defaultValue:"App.GetOptions(jsonKey)",values:[{label:"App.GetOptions(jsonKey)",value:"App.GetOptions(jsonKey)"},{label:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",value:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f"},{label:"App.GetOptions()",value:"App.GetOptions()"}],mdxType:"Tabs"},Object(o.b)(r.a,{value:"App.GetOptions(jsonKey)",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{13-16}","{13-16}":!0}),'using Fur.Application;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class DefaultController : ControllerBase\n {\n [HttpGet]\n public string Get()\n {\n // \u4e0d\u63a8\u8350\u91c7\u7528\u6b64\u65b9\u5f0f\u8bfb\u53d6\n var appInfo = App.GetOptions("AppInfo");\n return $@"\u540d\u79f0\uff1a{appInfo.Name}\uff0c\n \u7248\u672c\uff1a{appInfo.Version}\uff0c\n \u516c\u53f8\uff1a{appInfo.Company}";\n }\n }\n}\n'))),Object(o.b)(r.a,{value:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{3,15-17,27-29,31-33,35-37}","{3,15-17,27-29,31-33,35-37}":!0}),'using Fur.Application;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.Extensions.Options;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class DefaultController : ControllerBase\n {\n private readonly AppInfoOptions options1;\n private readonly AppInfoOptions options2;\n private readonly AppInfoOptions options3;\n\n public DefaultController(\n IOptions options\n , IOptionsSnapshot optionsSnapshot\n , IOptionsMonitor optionsMonitor)\n {\n options1 = options.Value;\n options2 = optionsSnapshot.Value;\n options3 = optionsMonitor.CurrentValue;\n }\n\n [HttpGet]\n public string Get()\n {\n var info1 = $@"\u540d\u79f0\uff1a{options1.Name}\uff0c\n \u7248\u672c\uff1a{options1.Version}\uff0c\n \u516c\u53f8\uff1a{options1.Company}";\n\n var info2 = $@"\u540d\u79f0\uff1a{options3.Name}\uff0c\n \u7248\u672c\uff1a{options3.Version}\uff0c\n \u516c\u53f8\uff1a{options3.Company}";\n\n var info3 = $@"\u540d\u79f0\uff1a{options3.Name}\uff0c\n \u7248\u672c\uff1a{options3.Version}\uff0c\n \u516c\u53f8\uff1a{options3.Company}";\n\n return $"{info1}-{info2}-{info3}";\n }\n }\n}\n'))),Object(o.b)(r.a,{value:"App.GetOptions()",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{12-15,17-20,22-25}","{12-15,17-20,22-25}":!0}),'using Fur.Application;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class DefaultController : ControllerBase\n {\n [HttpGet]\n public string Get()\n {\n var options1 = App.GetOptions();\n var info1 = $@"\u540d\u79f0\uff1a{options1.Name}\uff0c\n \u7248\u672c\uff1a{options1.Version}\uff0c\n \u516c\u53f8\uff1a{options1.Company}";\n\n var options2 = App.GetOptionsSnapshot();\n var info2 = $@"\u540d\u79f0\uff1a{options3.Name}\uff0c\n \u7248\u672c\uff1a{options3.Version}\uff0c\n \u516c\u53f8\uff1a{options3.Company}";\n\n var options3 = App.GetOptionsMonitor();\n var info3 = $@"\u540d\u79f0\uff1a{options3.Name}\uff0c\n \u7248\u672c\uff1a{options3.Version}\uff0c\n \u516c\u53f8\uff1a{options3.Company}";\n\n return $"{info1}-{info2}-{info3}";\n }\n }\n}\n')))),Object(o.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},Object(o.b)("inlineCode",{parentName:"p"},"App.GetOptions(jsonKey)")," \u9759\u6001\u65b9\u6cd5 \u533a\u522b\u4e8e\u6ca1\u6709\u53c2\u6570\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"App.GetOptions()")," \u9759\u6001\u65b9\u6cd5\uff0c\u524d\u8005\u5b9e\u9645\u4e0a\u8fd8\u662f ",Object(o.b)("strong",{parentName:"p"},"\u914d\u7f6e"),"\uff0c\u53ea\u4e0d\u8fc7\u505a\u4e86\u5f3a\u7c7b\u578b\u89e3\u6790\uff0c\u540e\u8005\u5219\u901a\u8fc7 ",Object(o.b)("inlineCode",{parentName:"p"},"IOptions")," \u89e3\u6790\u3002"),Object(o.b)("p",{parentName:"div"},"\u4e24\u8005\u6e90\u7801\u5982\u4e0b\uff1a"),Object(o.b)("pre",{parentName:"div"},Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{18-20,27-29} title="Fur/App/App.cs"',"{18-20,27-29}":!0,title:'"Fur/App/App.cs"'}),'using Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Options;\n\nnamespace Fur\n{\n /// \n /// \u5168\u5c40\u5e94\u7528\u7c7b\n /// \n public static class App\n {\n /// \n /// \u83b7\u53d6\u9009\u9879\n /// \n /// \u5f3a\u7c7b\u578b\u9009\u9879\u7c7b\n /// \u914d\u7f6e\u4e2d\u5bf9\u5e94\u7684Key\n /// \n public static TOptions GetOptions(string jsonKey)\n where TOptions : class\n => Configuration.GetSection(jsonKey).Get();\n\n /// \n /// \u83b7\u53d6\u9009\u9879\n /// \n /// \u5f3a\u7c7b\u578b\u9009\u9879\u7c7b\n /// \n public static TOptions GetOptions()\n where TOptions : class\n => ServiceProvider.GetService>().Value;\n\n // Other Codes...\n }\n}\n')),Object(o.b)("p",{parentName:"div"},"\u901a\u8fc7\u4e0a\u8ff0\u4ee3\u7801\u5f97\u77e5\uff0c\u4e3a\u4ec0\u4e48\u4e0d\u63a8\u8350\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"App.GetOptions(jsonKey)")," \u8bfb\u53d6\uff0c\u56e0\u4e3a\u8fd9\u79cd\u65b9\u5f0f\u65e0\u6cd5\u5e94\u7528\u9009\u9879\u9a8c\u8bc1\u3001\u9ed8\u8ba4\u914d\u7f6e\u3001\u66f4\u6539\u901a\u77e5\u7b49\u529f\u80fd\u3002"))),Object(o.b)("h3",{id:"4235-\u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f"},"4.2.3.5 \u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u5982\u679c\u9009\u9879\u9700\u8981\u5728\u591a\u4e2a\u5730\u65b9\u4f7f\u7528\uff0c\u5219\u65e0\u8bba\u4efb\u4f55\u65f6\u5019\u90fd\u4e0d\u63a8\u8350\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptions(jsonKey)")),Object(o.b)("li",{parentName:"ul"},"\u5728\u53ef\u4f9d\u8d56\u6ce8\u5165\u7c7b\u4e2d\uff0c\u4f9d\u8d56\u6ce8\u5165 ",Object(o.b)("inlineCode",{parentName:"li"},"IOptions[Snapshot|Monitor]")," \u8bfb\u53d6"),Object(o.b)("li",{parentName:"ul"},"\u5728\u9759\u6001\u7c7b/\u975e\u4f9d\u8d56\u6ce8\u5165\u7c7b\u4e2d\uff0c\u9009\u62e9 ",Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptions[Snapshot|Monitor]()")," \u8bfb\u53d6")),Object(o.b)("h2",{id:"424-\u9009\u9879\u63a5\u53e3\u8bf4\u660e"},"4.2.4 \u9009\u9879\u63a5\u53e3\u8bf4\u660e"),Object(o.b)("p",null,Object(o.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u5e94\u7528\u63d0\u4f9b\u4e86\u591a\u79cd\u8bfb\u53d6\u9009\u9879\u7684\u63a5\u53e3\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptions"),"\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u5728\u5e94\u7528\u542f\u52a8\u540e\u8bfb\u53d6\u914d\u7f6e\u6570\u636e"),Object(o.b)("li",{parentName:"ul"},"\u547d\u540d\u9009\u9879"))),Object(o.b)("li",{parentName:"ul"},"\u6ce8\u518c\u4e3a\u5355\u4e00\u5b9e\u4f8b\u4e14\u53ef\u4ee5\u6ce8\u5165\u5230\u4efb\u4f55\u670d\u52a1\u751f\u5b58\u671f"))),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptionsSnapshot"),"\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u5728\u6bcf\u6b21\u8bf7\u6c42\u65f6\u5e94\u91cd\u65b0\u8ba1\u7b97\u9009\u9879\u7684\u65b9\u6848\u4e2d\u6709\u7528"),Object(o.b)("li",{parentName:"ul"},"\u6ce8\u518c\u4e3a\u8303\u56f4\u5185\uff0c\u56e0\u6b64\u65e0\u6cd5\u6ce8\u5165\u5230\u5355\u4e00\u5b9e\u4f8b\u670d\u52a1"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u547d\u540d\u9009\u9879"))),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptionsMonitor"),"\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u7528\u4e8e\u68c0\u7d22\u9009\u9879\u5e76\u7ba1\u7406 TOptions \u5b9e\u4f8b\u7684\u9009\u9879\u901a\u77e5\u3002"),Object(o.b)("li",{parentName:"ul"},"\u6ce8\u518c\u4e3a\u5355\u4e00\u5b9e\u4f8b\u4e14\u53ef\u4ee5\u6ce8\u5165\u5230\u4efb\u4f55\u670d\u52a1\u751f\u5b58\u671f\u3002"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u66f4\u6539\u901a\u77e5"),Object(o.b)("li",{parentName:"ul"},"\u547d\u540d\u9009\u9879"),Object(o.b)("li",{parentName:"ul"},"\u53ef\u91cd\u8f7d\u914d\u7f6e"),Object(o.b)("li",{parentName:"ul"},"\u9009\u62e9\u6027\u9009\u9879\u5931\u6548 ",Object(o.b)("inlineCode",{parentName:"li"},"(IOptionsMonitorCache)"))))))),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(o.b)("inlineCode",{parentName:"p"},"\u9009\u9879\u63a5\u53e3")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/options?view=aspnetcore-5.0#options-interfaces"}),"ASP.NET Core - \u9009\u9879 - \u9009\u9879\u63a5\u53e3")," \u5c0f\u8282\u3002"))),Object(o.b)("h2",{id:"425-\u9009\u9879\u81ea\u5b9a\u4e49\u914d\u7f6e"},"4.2.5 \u9009\u9879\u81ea\u5b9a\u4e49\u914d\u7f6e"),Object(o.b)("p",null,"\u6211\u4eec\u77e5\u9053\uff0c\u9009\u9879\u5b9e\u9645\u4e0a\u9700\u8981\u548c\u914d\u7f6e\u6587\u4ef6\u7279\u5b9a\u952e\u503c\u6302\u94a9\uff0c\u90a3 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u662f\u5982\u4f55\u51c6\u786e\u7684\u627e\u5230\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u952e\u503c\u7684\u5462\uff1f"),Object(o.b)("h3",{id:"4251-\u9009\u9879\u67e5\u627e\u952e\u6d41\u7a0b"},"4.2.5.1 \u9009\u9879\u67e5\u627e\u952e\u6d41\u7a0b"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("strong",{parentName:"li"},"\u6ca1\u6709\u8d34 ",Object(o.b)("inlineCode",{parentName:"strong"},"[OptionsSettings]")," \u7279\u6027"),Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u4ee5 ",Object(o.b)("inlineCode",{parentName:"li"},"Options")," \u7ed3\u5c3e\uff0c\u5219\u53bb\u9664 ",Object(o.b)("inlineCode",{parentName:"li"},"Options")," \u5b57\u7b26\u4e32"),Object(o.b)("li",{parentName:"ul"},"\u5426\u5219\u8fd4\u56de ",Object(o.b)("inlineCode",{parentName:"li"},"\u7c7b\u540d\u79f0")))),Object(o.b)("li",{parentName:"ul"},Object(o.b)("strong",{parentName:"li"},"\u8d34\u4e86 ",Object(o.b)("inlineCode",{parentName:"strong"},"[OptionsSettings]")," \u7279\u6027"),Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u5982\u679c\u914d\u7f6e\u4e86 ",Object(o.b)("inlineCode",{parentName:"li"},"JsonKey")," \u5c5e\u6027\uff0c\u5219\u8fd4\u56de ",Object(o.b)("inlineCode",{parentName:"li"},"JsonKey")," \u7684\u503c"),Object(o.b)("li",{parentName:"ul"},"\u5426\u5219\u8fd4\u56de ",Object(o.b)("inlineCode",{parentName:"li"},"\u7c7b\u540d\u79f0"))))),Object(o.b)(p.a,{defaultValue:"non-optionsettings",values:[{label:"\u65e0[OptionsSettings]",value:"non-optionsettings"},{label:"\u6709[OptionsSettings]",value:"has-optionsettings"}],mdxType:"Tabs"},Object(o.b)(r.a,{value:"non-optionsettings",mdxType:"TabItem"},Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u4ee5 ",Object(o.b)("inlineCode",{parentName:"li"},"Options")," \u7ed3\u5c3e\uff0c\u5219\u952e\u540d\u4e3a\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"AppInfo"))),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),"public class AppInfoOptions : IConfigurableOptions\n{\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n}\n")),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u4e0d\u4ee5 ",Object(o.b)("inlineCode",{parentName:"li"},"Options")," \u7ed3\u5c3e\uff0c\u5219\u952e\u540d\u4e3a\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"AppInfoSettings"))),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),"public class AppInfoSettings : IConfigurableOptions\n{\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n}\n"))),Object(o.b)(r.a,{value:"has-optionsettings",mdxType:"TabItem"},Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u914d\u7f6e\u4e86 ",Object(o.b)("inlineCode",{parentName:"li"},"JsonKey")," \u5c5e\u6027\uff0c\uff0c\u5219\u952e\u540d\u4e3a\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"AppSettings:AppInfo"))),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),'[OptionsSettings("AppSettings:AppInfo")]\npublic class AppInfoOptions : IConfigurableOptions\n{\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n}\n')),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u6ca1\u6709\u914d\u7f6e ",Object(o.b)("inlineCode",{parentName:"li"},"JsonKey")," \u5c5e\u6027\uff0c\uff0c\u5219\u952e\u540d\u4e3a\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"AppInfoSettings"))),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),"[OptionsSettings]\npublic class AppInfoSettings : IConfigurableOptions\n{\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n}\n")))),Object(o.b)("h2",{id:"426-optionssettings-\u8bf4\u660e"},"4.2.6 ",Object(o.b)("inlineCode",{parentName:"h2"},"[OptionsSettings]")," \u8bf4\u660e"),Object(o.b)("p",null,"\u9009\u9879\u7c7b\u53ef\u4ee5\u901a\u8fc7 ",Object(o.b)("inlineCode",{parentName:"p"},"[OptionsSettings]")," \u6765\u914d\u7f6e\u67e5\u627e\u8def\u5f84\u503c\u3002"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"JsonKey"),"\uff1a\u5bf9\u5e94\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u952e\uff0c\u652f\u6301 ",Object(o.b)("strong",{parentName:"li"},"\u5206\u5c42\u952e")," \u5b57\u7b26\u4e32\uff0c\u53c2\u89c1\uff1a\u300a",Object(o.b)("a",Object(a.a)({parentName:"li"},{href:"configuration#%E5%A6%82%E4%BD%95%E9%80%89%E6%8B%A9%E8%AF%BB%E5%8F%96%E6%96%B9%E5%BC%8F"}),"4.2 \u914d\u7f6e - 3.1.3 \u5206\u5c42\u8bfb\u53d6\u6570\u636e"),"\u300b"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"PostConfigureAll"),"\uff1a\u9009\u9879\u540e\u671f\u914d\u7f6e\uff0c\u9ed8\u8ba4 ",Object(o.b)("inlineCode",{parentName:"li"},"false"),"\u3002",Object(o.b)("a",Object(a.a)({parentName:"li"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/options?view=aspnetcore-3.1#options-post-configuration"}),"ASP.NET Core - \u9009\u9879 - \u9009\u9879\u540e\u671f\u914d\u7f6e"))),Object(o.b)("h2",{id:"427-\u9009\u9879\u9a8c\u8bc1"},"4.2.7 \u9009\u9879\u9a8c\u8bc1"),Object(o.b)("p",null,"\u9009\u9879\u652f\u6301\u9a8c\u8bc1\u914d\u7f6e\u6709\u6548\u6027\uff0c\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u901a\u8fc7 ",Object(o.b)("inlineCode",{parentName:"p"},"services.AddConfigurableOptions()")," \u6ce8\u518c\u9009\u9879\u9ed8\u8ba4\u542f\u7528\u4e86\u9a8c\u8bc1\u652f\u6301\u3002"),Object(o.b)("p",null,"\u5305\u62ec\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u7279\u6027\u65b9\u5f0f ",Object(o.b)("inlineCode",{parentName:"li"},"DataAnnotations")),Object(o.b)("li",{parentName:"ul"},"\u81ea\u5b9a\u4e49\u590d\u6742\u9a8c\u8bc1 ",Object(o.b)("inlineCode",{parentName:"li"},"IValidateOptions"))),Object(o.b)(p.a,{defaultValue:"texin",values:[{label:"\u7279\u6027\u65b9\u5f0f",value:"texin"},{label:"\u590d\u6742\u9a8c\u8bc1",value:"fuza"}],mdxType:"Tabs"},Object(o.b)(r.a,{value:"texin",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8,10,12}","{2,8,10,12}":!0}),'using Fur.ConfigurableOptions;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Application\n{\n public class AppInfoOptions : IConfigurableOptions\n {\n [Required(ErrorMessage = "\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a")]\n public string Name { get; set; }\n [Required, RegularExpression(@"^[0-9][0-9\\.]+[0-9]$", ErrorMessage = "\u4e0d\u662f\u6709\u6548\u7684\u7248\u672c\u53f7")]\n public string Version { get; set; }\n [Required, MaxLength(100)]\n public string Company { get; set; }\n }\n}\n'))),Object(o.b)(r.a,{value:"fuza",mdxType:"TabItem"},Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b ",Object(o.b)("inlineCode",{parentName:"li"},"AppInfoValidation")," \u5e76\u7ee7\u627f ",Object(o.b)("inlineCode",{parentName:"li"},"IValidateOptions")," \u63a5\u53e3\uff0c\u540c\u65f6\u5b9e\u73b0 ",Object(o.b)("inlineCode",{parentName:"li"},"Validate")," \u65b9\u6cd5\u3002")),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,8,12,15}","{1,6,8,12,15}":!0}),'using Microsoft.Extensions.Options;\nusing System.Text.RegularExpressions;\n\nnamespace Fur.Application\n{\n public class AppInfoValidation : IValidateOptions\n {\n public ValidateOptionsResult Validate(string name, AppInfoOptions options)\n {\n if (!Regex.IsMatch(options.Version, @"^[0-9][0-9\\.]+[0-9]$"))\n {\n return ValidateOptionsResult.Fail("\u4e0d\u662f\u6709\u6548\u7684\u7248\u672c\u53f7");\n }\n\n return ValidateOptionsResult.Success;\n }\n }\n}\n')),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u9009\u9879\u7c7b\u7ee7\u627f ",Object(o.b)("inlineCode",{parentName:"li"},"IConfigurableOptions")," \u63a5\u53e3\uff0c\u5e76\u5b9e\u73b0\u8be5\u63a5\u53e3\u3002")),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6,16-18}","{6,16-18}":!0}),'using Fur.ConfigurableOptions;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Application\n{\n public class AppInfoOptions : IConfigurableOptions\n {\n [Required(ErrorMessage = "\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a")]\n public string Name { get; set; }\n [Required]\n public string Version { get; set; }\n [Required, MaxLength(100)]\n public string Company { get; set; }\n\n // \u9009\u9879\u540e\u671f\u914d\u7f6e\n public void PostConfigure(AppInfoOptions options)\n {\n }\n }\n}\n')),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u5b8c\u6574\u4ee3\u7801\u5982\u4e0b\uff1a")),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{4,9,19,25,27,31,34}","{4,9,19,25,27,31,34}":!0}),'using Fur.ConfigurableOptions;\nusing Microsoft.Extensions.Options;\nusing System.ComponentModel.DataAnnotations;\nusing System.Text.RegularExpressions;\n\nnamespace Fur.Application\n{\n // \u7ee7\u627f IConfigurableOptions \u63a5\u53e3\n public class AppInfoOptions : IConfigurableOptions\n {\n [Required(ErrorMessage = "\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a")]\n public string Name { get; set; }\n [Required]\n public string Version { get; set; }\n [Required, MaxLength(100)]\n public string Company { get; set; }\n\n // \u9009\u9879\u540e\u671f\u914d\u7f6e\n public void PostConfigure(AppInfoOptions options)\n {\n }\n }\n\n // \u521b\u5efa\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b\n public class AppInfoValidation : IValidateOptions\n {\n public ValidateOptionsResult Validate(string name, AppInfoOptions options)\n {\n if (!Regex.IsMatch(options.Version, @"^[0-9][0-9\\.]+[0-9]$"))\n {\n return ValidateOptionsResult.Fail("\u4e0d\u662f\u6709\u6548\u7684\u7248\u672c\u53f7");\n }\n\n return ValidateOptionsResult.Success;\n }\n }\n}\n')))),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions"))," \u7ee7\u627f\u81ea ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions")),"\uff0c\u4e5f\u5c31\u662f\u81ea\u5b9a\u4e49\u590d\u6742\u9a8c\u8bc1\u9ed8\u8ba4\u5177\u6709 ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"PostConfigure(TOptions options)"))," \u9009\u9879\u540e\u671f\u914d\u7f6e\u65b9\u6cd5\u3002\u5173\u4e8e\u300a",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"#227-%E9%80%89%E9%A1%B9%E5%90%8E%E6%9C%9F%E9%85%8D%E7%BD%AE"}),"4.3.7 \u9009\u9879\u540e\u671f\u914d\u7f6e"),"\u300b\u5c06\u5728\u4e0b\u4e00\u5c0f\u8282\u8bf4\u660e\u3002"))),Object(o.b)("h2",{id:"428-\u9009\u9879\u540e\u671f\u914d\u7f6e"},"4.2.8 \u9009\u9879\u540e\u671f\u914d\u7f6e"),Object(o.b)("p",null,"\u9009\u9879\u540e\u671f\u914d\u7f6e\u901a\u4fd7\u4e00\u70b9\u6765\u8bf4\uff0c\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u89e3\u6790\u503c\u6216\u8bbe\u5b9a\u9ed8\u8ba4\u503c/\u540e\u671f\u914d\u7f6e\u7b49\u3002"),Object(o.b)("p",null,"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u914d\u7f6e\u9009\u9879\u540e\u671f\u914d\u7f6e\u5f88\u7b80\u5355\uff0c\u53ea\u9700\u8981\u7ee7\u627f ",Object(o.b)("inlineCode",{parentName:"p"},"IConfigurableOptions\n {\n [Required(ErrorMessage = "\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a")]\n public string Name { get; set; }\n [Required]\n public string Version { get; set; }\n [Required, MaxLength(100)]\n public string Company { get; set; }\n\n public void PostConfigure(AppInfoOptions options, IConfiguration configuration)\n {\n options.Name ??= "Fur";\n options.Version ??= "1.0.0";\n options.Version ??= "Baiqian";\n }\n }\n}\n')),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions"))," \u7ee7\u627f\u81ea ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions")),"\uff0c\u4e5f\u5c31\u662f\u81ea\u5b9a\u4e49\u590d\u6742\u9a8c\u8bc1\u9ed8\u8ba4\u5177\u6709 ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"PostConfigure(TOptions options, IConfiguration configuration)"))," \u9009\u9879\u540e\u671f\u914d\u7f6e\u65b9\u6cd5\u3002"))),Object(o.b)("h2",{id:"429-\u9009\u9879\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09"},"4.2.9 \u9009\u9879\u66f4\u6539\u901a\u77e5\uff08",Object(o.b)("inlineCode",{parentName:"h2"},"\u70ed\u66f4\u65b0"),"\uff09"),Object(o.b)("p",null,Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u7b80\u5355\u4e14\u7075\u6d3b\u7684\u65b9\u5f0f\u76d1\u542c\u9009\u9879\u66f4\u6539\uff0c\u4e5f\u5c31\u662f ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"appsettings.json")," \u6216 \u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u53d1\u751f\u4efb\u4f55\u66f4\u6539\u90fd\u4f1a\u89e6\u53d1\u5904\u7406\u65b9\u6cd5"),"\u3002"),Object(o.b)("p",null,"\u4f7f\u7528\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u7ee7\u627f ",Object(o.b)("inlineCode",{parentName:"p"},"IConfigurableOptionsListener")," \u63a5\u53e3\u5e76\u5b9e\u73b0 ",Object(o.b)("inlineCode",{parentName:"p"},"void OnListener(TOptions options, IConfiguration configuration)")," \u65b9\u6cd5\u5373\u53ef\u3002"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,12-16}","{5,12-16}":!0}),"using Fur.ConfigurableOptions;\n\nnamespace Fur.Application\n{\n public class AppInfoOptions : IConfigurableOptionsListener\n {\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n }\n\n public void OnListener(AppInfoOptions options, IConfiguration configuration)\n {\n var name = options.Name; // \u5b9e\u65f6\u7684\u6700\u65b0\u503c\n var version = options.Version; // \u5b9e\u65f6\u7684\u6700\u65b0\u503c\n }\n\n public void PostConfigure(AppInfoOptions options, IConfiguration configuration)\n {\n }\n}\n")),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptionsListener"))," \u7ee7\u627f\u81ea ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions")),"\u3002"))),Object(o.b)("h2",{id:"4210-\u9009\u9879\u7684\u4f18\u7f3a\u70b9"},"4.2.10 \u9009\u9879\u7684\u4f18\u7f3a\u70b9"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u5f3a\u7c7b\u578b\u914d\u7f6e"),Object(o.b)("li",{parentName:"ul"},"\u63d0\u4f9b\u591a\u79cd\u8bfb\u53d6\u65b9\u5f0f"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u70ed\u52a0\u8f7d"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u8bbe\u7f6e\u9ed8\u8ba4\u503c/\u540e\u671f\u914d\u7f6e"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u5728\u8fd0\u884c\u73af\u5883\u4e2d\u52a8\u6001\u914d\u7f6e"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u9a8c\u8bc1\u914d\u7f6e\u6709\u6548\u6027"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u66f4\u6539\u901a\u77e5"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u547d\u540d\u9009\u9879"))),Object(o.b)("li",{parentName:"ul"},Object(o.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u9700\u8981\u5b9a\u4e49\u5bf9\u5e94\u7c7b\u578b"),Object(o.b)("li",{parentName:"ul"},"\u9700\u8981\u5728\u542f\u52a8\u65f6\u6ce8\u518c")))),Object(o.b)("h2",{id:"4211-\u53cd\u9988\u4e0e\u5efa\u8bae"},"4.2.11 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(o.b)("hr",null),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(o.b)("inlineCode",{parentName:"p"},"\u9009\u9879")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/options?view=aspnetcore-5.0"}),"ASP.NET Core - \u9009\u9879")," \u7ae0\u8282\u3002"))))}O.isMDXComponent=!0},142:function(e,n,t){"use strict";t.d(n,"a",(function(){return l})),t.d(n,"b",(function(){return m}));var a=t(0),i=t.n(a);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function p(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function r(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var c=i.a.createContext({}),b=function(e){var n=i.a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},l=function(e){var n=b(e.components);return i.a.createElement(c.Provider,{value:n},e.children)},O={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},u=i.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),l=b(t),u=a,m=l["".concat(p,".").concat(u)]||l[u]||O[u]||o;return t?i.a.createElement(m,r(r({ref:n},c),{},{components:t})):i.a.createElement(m,r({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,p=new Array(o);p[0]=u;var r={};for(var s in n)hasOwnProperty.call(n,s)&&(r[s]=n[s]);r.originalType=e,r.mdxType="string"==typeof e?e:a,p[1]=r;for(var c=2;cappsettings.json \u4fe1\u606f",id:"4231-\u914d\u7f6e-appsettingsjson-\u4fe1\u606f",children:[]},{value:"4.2.3.2 \u521b\u5efa AppInfoOptions \u5f3a\u7c7b\u578b\u7c7b",id:"4232-\u521b\u5efa-appinfooptions-\u5f3a\u7c7b\u578b\u7c7b",children:[]},{value:"4.2.3.3 \u6ce8\u518c AppInfoOptions \u670d\u52a1",id:"4233-\u6ce8\u518c-appinfooptions-\u670d\u52a1",children:[]},{value:"4.2.3.4 \u8bfb\u53d6 AppInfoOptions \u4fe1\u606f",id:"4234-\u8bfb\u53d6-appinfooptions-\u4fe1\u606f",children:[]},{value:"4.2.3.5 \u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f",id:"4235-\u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f",children:[]}]},{value:"4.2.4 \u9009\u9879\u63a5\u53e3\u8bf4\u660e",id:"424-\u9009\u9879\u63a5\u53e3\u8bf4\u660e",children:[]},{value:"4.2.5 \u9009\u9879\u81ea\u5b9a\u4e49\u914d\u7f6e",id:"425-\u9009\u9879\u81ea\u5b9a\u4e49\u914d\u7f6e",children:[{value:"4.2.5.1 \u9009\u9879\u67e5\u627e\u952e\u6d41\u7a0b",id:"4251-\u9009\u9879\u67e5\u627e\u952e\u6d41\u7a0b",children:[]}]},{value:"4.2.6 [OptionsSettings] \u8bf4\u660e",id:"426-optionssettings-\u8bf4\u660e",children:[]},{value:"4.2.7 \u9009\u9879\u9a8c\u8bc1",id:"427-\u9009\u9879\u9a8c\u8bc1",children:[]},{value:"4.2.8 \u9009\u9879\u540e\u671f\u914d\u7f6e",id:"428-\u9009\u9879\u540e\u671f\u914d\u7f6e",children:[]},{value:"4.2.9 \u9009\u9879\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09",id:"429-\u9009\u9879\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09",children:[]},{value:"4.2.10 \u9009\u9879\u7684\u4f18\u7f3a\u70b9",id:"4210-\u9009\u9879\u7684\u4f18\u7f3a\u70b9",children:[]},{value:"4.2.11 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"4211-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],l={rightToc:b};function O(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(o.b)("wrapper",Object(a.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(o.b)("h2",{id:"421-\u4ec0\u4e48\u662f\u9009\u9879"},"4.2.1 \u4ec0\u4e48\u662f\u9009\u9879"),Object(o.b)("p",null,"\u9009\u9879\u662f ",Object(o.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u63a8\u8350\u7684\u52a8\u6001\u8bfb\u53d6\u914d\u7f6e\u7684\u65b9\u5f0f\uff0c\u8fd9\u79cd\u65b9\u5f0f\u5c06\u914d\u7f6e\u6587\u4ef6\u6570\u636e\u7528\u4e00\u4e2a",Object(o.b)("strong",{parentName:"p"},"\u5f3a\u7c7b\u578b"),"\u6765\u6258\u7ba1\uff0c\u80fd\u591f\u5b9e\u73b0\u914d\u7f6e\u9a8c\u8bc1\u3001\u9ed8\u8ba4\u503c\u914d\u7f6e\u3001\u5b9e\u65f6\u8bfb\u53d6\u7b49\u529f\u80fd\u3002"),Object(o.b)("h2",{id:"422-\u4e0e\u914d\u7f6e\u7684\u533a\u522b"},"4.2.2 \u4e0e\u914d\u7f6e\u7684\u533a\u522b"),Object(o.b)("p",null,"\u9009\u9879\u5b9e\u9645\u4e0a\u4e5f\u662f\u914d\u7f6e\uff0c\u4f46\u5728\u540e\u8005\u7684\u57fa\u7840\u4e0a\u6dfb\u52a0\u4e86\u914d\u7f6e\u9a8c\u8bc1\u3001\u9ed8\u8ba4\u503c/\u540e\u671f\u914d\u7f6e\u8bbe\u5b9a\u53ca\u63d0\u4f9b\u4e86\u591a\u79cd\u63a5\u53e3\u8bfb\u53d6\u914d\u7f6e\u4fe1\u606f\uff0c\u540c\u65f6\u8fd8\u652f\u6301\u4f9b\u914d\u7f6e\u66f4\u6539\u901a\u77e5\u7b49\u5f3a\u5927\u7075\u6d3b\u529f\u80fd\u3002"),Object(o.b)("p",null,"\u6240\u4ee5\uff0c\u9664\u4e86\u4e00\u6b21\u6027\u8bfb\u53d6\u4f7f\u7528\u7684\u914d\u7f6e\u4ee5\u5916\uff0c\u90fd\u5e94\u8be5\u9009\u7528 ",Object(o.b)("strong",{parentName:"p"},"\u9009\u9879")," \u66ff\u6362 ",Object(o.b)("strong",{parentName:"p"},"\u914d\u7f6e"),"\u3002"),Object(o.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u77e5\u8bc6\u5bfc\u822a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u6709\u5173\u914d\u7f6e\u8bf4\u660e\u53ef\u67e5\u770b\u300a",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"/docs/configuration"}),"4.1 \u914d\u7f6e"),"\u300b \u7ae0\u8282\u3002"))),Object(o.b)("h2",{id:"423-\u9009\u9879\u7684\u4f7f\u7528"},"4.2.3 \u9009\u9879\u7684\u4f7f\u7528"),Object(o.b)("p",null,"\u5047\u8bbe\u6211\u4eec\u9700\u8981\u5728\u7cfb\u7edf\u8fd0\u884c\u65f6\u83b7\u53d6",Object(o.b)("strong",{parentName:"p"},"\u7cfb\u7edf\u540d\u79f0\u3001\u7248\u672c\u53f7\u53ca\u7248\u6743\u4fe1\u606f"),"\uff0c\u8fd9\u4e9b\u4fe1\u606f\u53ef\u80fd\u968f\u65f6\u53d8\u5316\u800c\u4e14\u9700\u8981\u5728\u591a\u4e2a\u5730\u65b9\u4f7f\u7528\u3002\u8fd9\u65f6\u5c31\u9700\u8981\u5c06\u8fd9\u4e9b\u4fe1\u606f\u914d\u7f6e\u8d77\u6765\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a"),Object(o.b)("h3",{id:"4231-\u914d\u7f6e-appsettingsjson-\u4fe1\u606f"},"4.2.3.1 \u914d\u7f6e ",Object(o.b)("inlineCode",{parentName:"h3"},"appsettings.json")," \u4fe1\u606f"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:"{2-6}","{2-6}":!0}),'{\n "AppInfo": {\n "Name": "Fur",\n "Version": "1.0.0",\n "Company": "Baiqian"\n }\n}\n')),Object(o.b)("h3",{id:"4232-\u521b\u5efa-appinfooptions-\u5f3a\u7c7b\u578b\u7c7b"},"4.2.3.2 \u521b\u5efa ",Object(o.b)("inlineCode",{parentName:"h3"},"AppInfoOptions")," \u5f3a\u7c7b\u578b\u7c7b"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5}","{1,5}":!0}),"using Fur.ConfigurableOptions;\n\nnamespace Fur.Application\n{\n public class AppInfoOptions : IConfigurableOptions\n {\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n }\n}\n")),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u6e29\u99a8\u63d0\u793a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u5efa\u8bae\u6240\u6709\u9009\u9879\u7c7b\u90fd\u5e94\u8be5\u4ee5 ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"Options"))," \u547d\u540d\u7ed3\u5c3e\u3002"),Object(o.b)("p",{parentName:"div"},"\u53e6\u5916\uff0c",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u6ce8\u518c\u9009\u9879\u670d\u52a1\u7684\u65b9\u6cd5\uff0c\u53ea\u9700\u8981\u7ee7\u627f ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions"))," \u63a5\u53e3\u5373\u53ef\uff0c\u8be5\u63a5\u53e3\u4f4d\u4e8e ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"Fur.ConfigurableOptions"))," \u547d\u540d\u7a7a\u95f4\u4e0b\u3002"))),Object(o.b)("h3",{id:"4233-\u6ce8\u518c-appinfooptions-\u670d\u52a1"},"4.2.3.3 \u6ce8\u518c ",Object(o.b)("inlineCode",{parentName:"h3"},"AppInfoOptions")," \u670d\u52a1"),Object(o.b)("p",null,Object(o.b)("strong",{parentName:"p"},"\u9009\u9879\u4e0d\u540c\u4e8e\u914d\u7f6e\uff0c\u9700\u5728\u5e94\u7528\u542f\u52a8\u65f6\u6ce8\u518c")),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{12} title="Fur.Web.Core\\FurWebCoreStartup.cs"',"{12}":!0,title:'"Fur.Web.Core\\FurWebCoreStartup.cs"'}),"using Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.Web.Core\n{\n [AppStartup(800)]\n public sealed class FurWebCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddConfigurableOptions();\n }\n }\n}\n")),Object(o.b)("h3",{id:"4234-\u8bfb\u53d6-appinfooptions-\u4fe1\u606f"},"4.2.3.4 \u8bfb\u53d6 ",Object(o.b)("inlineCode",{parentName:"h3"},"AppInfoOptions")," \u4fe1\u606f"),Object(o.b)("p",null,"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u63d0\u4f9b\u4e86\u591a\u79cd\u8bfb\u53d6\u65b9\u5f0f\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u901a\u8fc7 ",Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptions(jsonKey)")," \u8bfb\u53d6\uff08",Object(o.b)("strong",{parentName:"li"},"\u4e0d\u63a8\u8350"),"\uff09"),Object(o.b)("li",{parentName:"ul"},"\u901a\u8fc7\u4f9d\u8d56\u6ce8\u5165\u4ee5\u4e0b\u5b9e\u4f8b\u8bfb\u53d6\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptions")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptionsSnapshot")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptionsMonitor")))),Object(o.b)("li",{parentName:"ul"},"\u901a\u8fc7 ",Object(o.b)("inlineCode",{parentName:"li"},"App")," \u9759\u6001\u7c7b\u63d0\u4f9b\u7684\u9759\u6001\u65b9\u6cd5\u83b7\u53d6\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptions()")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptionsMonitor()")),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptionsSnapshot()"))))),Object(o.b)(p.a,{defaultValue:"App.GetOptions(jsonKey)",values:[{label:"App.GetOptions(jsonKey)",value:"App.GetOptions(jsonKey)"},{label:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",value:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f"},{label:"App.GetOptions()",value:"App.GetOptions()"}],mdxType:"Tabs"},Object(o.b)(s.a,{value:"App.GetOptions(jsonKey)",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{13-16}","{13-16}":!0}),'using Fur.Application;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class DefaultController : ControllerBase\n {\n [HttpGet]\n public string Get()\n {\n // \u4e0d\u63a8\u8350\u91c7\u7528\u6b64\u65b9\u5f0f\u8bfb\u53d6\n var appInfo = App.GetOptions("AppInfo");\n return $@"\u540d\u79f0\uff1a{appInfo.Name}\uff0c\n \u7248\u672c\uff1a{appInfo.Version}\uff0c\n \u516c\u53f8\uff1a{appInfo.Company}";\n }\n }\n}\n'))),Object(o.b)(s.a,{value:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{3,15-17,27-29,31-33,35-37}","{3,15-17,27-29,31-33,35-37}":!0}),'using Fur.Application;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.Extensions.Options;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class DefaultController : ControllerBase\n {\n private readonly AppInfoOptions options1;\n private readonly AppInfoOptions options2;\n private readonly AppInfoOptions options3;\n\n public DefaultController(\n IOptions options\n , IOptionsSnapshot optionsSnapshot\n , IOptionsMonitor optionsMonitor)\n {\n options1 = options.Value;\n options2 = optionsSnapshot.Value;\n options3 = optionsMonitor.CurrentValue;\n }\n\n [HttpGet]\n public string Get()\n {\n var info1 = $@"\u540d\u79f0\uff1a{options1.Name}\uff0c\n \u7248\u672c\uff1a{options1.Version}\uff0c\n \u516c\u53f8\uff1a{options1.Company}";\n\n var info2 = $@"\u540d\u79f0\uff1a{options3.Name}\uff0c\n \u7248\u672c\uff1a{options3.Version}\uff0c\n \u516c\u53f8\uff1a{options3.Company}";\n\n var info3 = $@"\u540d\u79f0\uff1a{options3.Name}\uff0c\n \u7248\u672c\uff1a{options3.Version}\uff0c\n \u516c\u53f8\uff1a{options3.Company}";\n\n return $"{info1}-{info2}-{info3}";\n }\n }\n}\n'))),Object(o.b)(s.a,{value:"App.GetOptions()",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{12-15,17-20,22-25}","{12-15,17-20,22-25}":!0}),'using Fur.Application;\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class DefaultController : ControllerBase\n {\n [HttpGet]\n public string Get()\n {\n var options1 = App.GetOptions();\n var info1 = $@"\u540d\u79f0\uff1a{options1.Name}\uff0c\n \u7248\u672c\uff1a{options1.Version}\uff0c\n \u516c\u53f8\uff1a{options1.Company}";\n\n var options2 = App.GetOptionsSnapshot();\n var info2 = $@"\u540d\u79f0\uff1a{options3.Name}\uff0c\n \u7248\u672c\uff1a{options3.Version}\uff0c\n \u516c\u53f8\uff1a{options3.Company}";\n\n var options3 = App.GetOptionsMonitor();\n var info3 = $@"\u540d\u79f0\uff1a{options3.Name}\uff0c\n \u7248\u672c\uff1a{options3.Version}\uff0c\n \u516c\u53f8\uff1a{options3.Company}";\n\n return $"{info1}-{info2}-{info3}";\n }\n }\n}\n')))),Object(o.b)("div",{className:"admonition admonition-caution alert alert--warning"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})))),"\u7279\u522b\u6ce8\u610f")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},Object(o.b)("inlineCode",{parentName:"p"},"App.GetOptions(jsonKey)")," \u9759\u6001\u65b9\u6cd5 \u533a\u522b\u4e8e\u6ca1\u6709\u53c2\u6570\u7684 ",Object(o.b)("inlineCode",{parentName:"p"},"App.GetOptions()")," \u9759\u6001\u65b9\u6cd5\uff0c\u524d\u8005\u5b9e\u9645\u4e0a\u8fd8\u662f ",Object(o.b)("strong",{parentName:"p"},"\u914d\u7f6e"),"\uff0c\u53ea\u4e0d\u8fc7\u505a\u4e86\u5f3a\u7c7b\u578b\u89e3\u6790\uff0c\u540e\u8005\u5219\u901a\u8fc7 ",Object(o.b)("inlineCode",{parentName:"p"},"IOptions")," \u89e3\u6790\u3002"),Object(o.b)("p",{parentName:"div"},"\u4e24\u8005\u6e90\u7801\u5982\u4e0b\uff1a"),Object(o.b)("pre",{parentName:"div"},Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:'{18-20,27-29} title="Fur/App/App.cs"',"{18-20,27-29}":!0,title:'"Fur/App/App.cs"'}),'using Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Options;\n\nnamespace Fur\n{\n /// \n /// \u5168\u5c40\u5e94\u7528\u7c7b\n /// \n public static class App\n {\n /// \n /// \u83b7\u53d6\u9009\u9879\n /// \n /// \u5f3a\u7c7b\u578b\u9009\u9879\u7c7b\n /// \u914d\u7f6e\u4e2d\u5bf9\u5e94\u7684Key\n /// \n public static TOptions GetOptions(string jsonKey)\n where TOptions : class\n => Configuration.GetSection(jsonKey).Get();\n\n /// \n /// \u83b7\u53d6\u9009\u9879\n /// \n /// \u5f3a\u7c7b\u578b\u9009\u9879\u7c7b\n /// \n public static TOptions GetOptions()\n where TOptions : class\n => ServiceProvider.GetService>().Value;\n\n // Other Codes...\n }\n}\n')),Object(o.b)("p",{parentName:"div"},"\u901a\u8fc7\u4e0a\u8ff0\u4ee3\u7801\u5f97\u77e5\uff0c\u4e3a\u4ec0\u4e48\u4e0d\u63a8\u8350\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"p"},"App.GetOptions(jsonKey)")," \u8bfb\u53d6\uff0c\u56e0\u4e3a\u8fd9\u79cd\u65b9\u5f0f\u65e0\u6cd5\u5e94\u7528\u9009\u9879\u9a8c\u8bc1\u3001\u9ed8\u8ba4\u914d\u7f6e\u3001\u66f4\u6539\u901a\u77e5\u7b49\u529f\u80fd\u3002"))),Object(o.b)("h3",{id:"4235-\u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f"},"4.2.3.5 \u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u5982\u679c\u9009\u9879\u9700\u8981\u5728\u591a\u4e2a\u5730\u65b9\u4f7f\u7528\uff0c\u5219\u65e0\u8bba\u4efb\u4f55\u65f6\u5019\u90fd\u4e0d\u63a8\u8350\u4f7f\u7528 ",Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptions(jsonKey)")),Object(o.b)("li",{parentName:"ul"},"\u5728\u53ef\u4f9d\u8d56\u6ce8\u5165\u7c7b\u4e2d\uff0c\u4f9d\u8d56\u6ce8\u5165 ",Object(o.b)("inlineCode",{parentName:"li"},"IOptions[Snapshot|Monitor]")," \u8bfb\u53d6"),Object(o.b)("li",{parentName:"ul"},"\u5728\u9759\u6001\u7c7b/\u975e\u4f9d\u8d56\u6ce8\u5165\u7c7b\u4e2d\uff0c\u9009\u62e9 ",Object(o.b)("inlineCode",{parentName:"li"},"App.GetOptions[Snapshot|Monitor]()")," \u8bfb\u53d6")),Object(o.b)("h2",{id:"424-\u9009\u9879\u63a5\u53e3\u8bf4\u660e"},"4.2.4 \u9009\u9879\u63a5\u53e3\u8bf4\u660e"),Object(o.b)("p",null,Object(o.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u5e94\u7528\u63d0\u4f9b\u4e86\u591a\u79cd\u8bfb\u53d6\u9009\u9879\u7684\u63a5\u53e3\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptions"),"\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u5728\u5e94\u7528\u542f\u52a8\u540e\u8bfb\u53d6\u914d\u7f6e\u6570\u636e"),Object(o.b)("li",{parentName:"ul"},"\u547d\u540d\u9009\u9879"))),Object(o.b)("li",{parentName:"ul"},"\u6ce8\u518c\u4e3a\u5355\u4e00\u5b9e\u4f8b\u4e14\u53ef\u4ee5\u6ce8\u5165\u5230\u4efb\u4f55\u670d\u52a1\u751f\u5b58\u671f"))),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptionsSnapshot"),"\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u5728\u6bcf\u6b21\u8bf7\u6c42\u65f6\u5e94\u91cd\u65b0\u8ba1\u7b97\u9009\u9879\u7684\u65b9\u6848\u4e2d\u6709\u7528"),Object(o.b)("li",{parentName:"ul"},"\u6ce8\u518c\u4e3a\u8303\u56f4\u5185\uff0c\u56e0\u6b64\u65e0\u6cd5\u6ce8\u5165\u5230\u5355\u4e00\u5b9e\u4f8b\u670d\u52a1"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u547d\u540d\u9009\u9879"))),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"IOptionsMonitor"),"\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u7528\u4e8e\u68c0\u7d22\u9009\u9879\u5e76\u7ba1\u7406 TOptions \u5b9e\u4f8b\u7684\u9009\u9879\u901a\u77e5\u3002"),Object(o.b)("li",{parentName:"ul"},"\u6ce8\u518c\u4e3a\u5355\u4e00\u5b9e\u4f8b\u4e14\u53ef\u4ee5\u6ce8\u5165\u5230\u4efb\u4f55\u670d\u52a1\u751f\u5b58\u671f\u3002"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\uff1a",Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u66f4\u6539\u901a\u77e5"),Object(o.b)("li",{parentName:"ul"},"\u547d\u540d\u9009\u9879"),Object(o.b)("li",{parentName:"ul"},"\u53ef\u91cd\u8f7d\u914d\u7f6e"),Object(o.b)("li",{parentName:"ul"},"\u9009\u62e9\u6027\u9009\u9879\u5931\u6548 ",Object(o.b)("inlineCode",{parentName:"li"},"(IOptionsMonitorCache)"))))))),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(o.b)("inlineCode",{parentName:"p"},"\u9009\u9879\u63a5\u53e3")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/options?view=aspnetcore-5.0#options-interfaces"}),"ASP.NET Core - \u9009\u9879 - \u9009\u9879\u63a5\u53e3")," \u5c0f\u8282\u3002"))),Object(o.b)("h2",{id:"425-\u9009\u9879\u81ea\u5b9a\u4e49\u914d\u7f6e"},"4.2.5 \u9009\u9879\u81ea\u5b9a\u4e49\u914d\u7f6e"),Object(o.b)("p",null,"\u6211\u4eec\u77e5\u9053\uff0c\u9009\u9879\u5b9e\u9645\u4e0a\u9700\u8981\u548c\u914d\u7f6e\u6587\u4ef6\u7279\u5b9a\u952e\u503c\u6302\u94a9\uff0c\u90a3 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u662f\u5982\u4f55\u51c6\u786e\u7684\u627e\u5230\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u952e\u503c\u7684\u5462\uff1f"),Object(o.b)("h3",{id:"4251-\u9009\u9879\u67e5\u627e\u952e\u6d41\u7a0b"},"4.2.5.1 \u9009\u9879\u67e5\u627e\u952e\u6d41\u7a0b"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("strong",{parentName:"li"},"\u6ca1\u6709\u8d34 ",Object(o.b)("inlineCode",{parentName:"strong"},"[OptionsSettings]")," \u7279\u6027"),Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u4ee5 ",Object(o.b)("inlineCode",{parentName:"li"},"Options")," \u7ed3\u5c3e\uff0c\u5219\u53bb\u9664 ",Object(o.b)("inlineCode",{parentName:"li"},"Options")," \u5b57\u7b26\u4e32"),Object(o.b)("li",{parentName:"ul"},"\u5426\u5219\u8fd4\u56de ",Object(o.b)("inlineCode",{parentName:"li"},"\u7c7b\u540d\u79f0")))),Object(o.b)("li",{parentName:"ul"},Object(o.b)("strong",{parentName:"li"},"\u8d34\u4e86 ",Object(o.b)("inlineCode",{parentName:"strong"},"[OptionsSettings]")," \u7279\u6027"),Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u5982\u679c\u914d\u7f6e\u4e86 ",Object(o.b)("inlineCode",{parentName:"li"},"JsonKey")," \u5c5e\u6027\uff0c\u5219\u8fd4\u56de ",Object(o.b)("inlineCode",{parentName:"li"},"JsonKey")," \u7684\u503c"),Object(o.b)("li",{parentName:"ul"},"\u5426\u5219\u8fd4\u56de ",Object(o.b)("inlineCode",{parentName:"li"},"\u7c7b\u540d\u79f0"))))),Object(o.b)(p.a,{defaultValue:"non-optionsettings",values:[{label:"\u65e0[OptionsSettings]",value:"non-optionsettings"},{label:"\u6709[OptionsSettings]",value:"has-optionsettings"}],mdxType:"Tabs"},Object(o.b)(s.a,{value:"non-optionsettings",mdxType:"TabItem"},Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u4ee5 ",Object(o.b)("inlineCode",{parentName:"li"},"Options")," \u7ed3\u5c3e\uff0c\u5219\u952e\u540d\u4e3a\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"AppInfo"))),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),"public class AppInfoOptions : IConfigurableOptions\n{\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n}\n")),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u4e0d\u4ee5 ",Object(o.b)("inlineCode",{parentName:"li"},"Options")," \u7ed3\u5c3e\uff0c\u5219\u952e\u540d\u4e3a\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"AppInfoSettings"))),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),"public class AppInfoSettings : IConfigurableOptions\n{\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n}\n"))),Object(o.b)(s.a,{value:"has-optionsettings",mdxType:"TabItem"},Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u914d\u7f6e\u4e86 ",Object(o.b)("inlineCode",{parentName:"li"},"JsonKey")," \u5c5e\u6027\uff0c\uff0c\u5219\u952e\u540d\u4e3a\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"AppSettings:AppInfo"))),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),'[OptionsSettings("AppSettings:AppInfo")]\npublic class AppInfoOptions : IConfigurableOptions\n{\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n}\n')),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u6ca1\u6709\u914d\u7f6e ",Object(o.b)("inlineCode",{parentName:"li"},"JsonKey")," \u5c5e\u6027\uff0c\uff0c\u5219\u952e\u540d\u4e3a\uff1a",Object(o.b)("inlineCode",{parentName:"li"},"AppInfoSettings"))),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),"[OptionsSettings]\npublic class AppInfoSettings : IConfigurableOptions\n{\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n}\n")))),Object(o.b)("h2",{id:"426-optionssettings-\u8bf4\u660e"},"4.2.6 ",Object(o.b)("inlineCode",{parentName:"h2"},"[OptionsSettings]")," \u8bf4\u660e"),Object(o.b)("p",null,"\u9009\u9879\u7c7b\u53ef\u4ee5\u901a\u8fc7 ",Object(o.b)("inlineCode",{parentName:"p"},"[OptionsSettings]")," \u6765\u914d\u7f6e\u67e5\u627e\u8def\u5f84\u503c\u3002"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"JsonKey"),"\uff1a\u5bf9\u5e94\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u952e\uff0c\u652f\u6301 ",Object(o.b)("strong",{parentName:"li"},"\u5206\u5c42\u952e")," \u5b57\u7b26\u4e32\uff0c\u53c2\u89c1\uff1a\u300a",Object(o.b)("a",Object(a.a)({parentName:"li"},{href:"configuration#%E5%A6%82%E4%BD%95%E9%80%89%E6%8B%A9%E8%AF%BB%E5%8F%96%E6%96%B9%E5%BC%8F"}),"4.2 \u914d\u7f6e - 3.1.3 \u5206\u5c42\u8bfb\u53d6\u6570\u636e"),"\u300b"),Object(o.b)("li",{parentName:"ul"},Object(o.b)("inlineCode",{parentName:"li"},"PostConfigureAll"),"\uff1a\u9009\u9879\u540e\u671f\u914d\u7f6e\uff0c\u9ed8\u8ba4 ",Object(o.b)("inlineCode",{parentName:"li"},"false"),"\u3002",Object(o.b)("a",Object(a.a)({parentName:"li"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/options?view=aspnetcore-3.1#options-post-configuration"}),"ASP.NET Core - \u9009\u9879 - \u9009\u9879\u540e\u671f\u914d\u7f6e"))),Object(o.b)("h2",{id:"427-\u9009\u9879\u9a8c\u8bc1"},"4.2.7 \u9009\u9879\u9a8c\u8bc1"),Object(o.b)("p",null,"\u9009\u9879\u652f\u6301\u9a8c\u8bc1\u914d\u7f6e\u6709\u6548\u6027\uff0c\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u901a\u8fc7 ",Object(o.b)("inlineCode",{parentName:"p"},"services.AddConfigurableOptions()")," \u6ce8\u518c\u9009\u9879\u9ed8\u8ba4\u542f\u7528\u4e86\u9a8c\u8bc1\u652f\u6301\u3002"),Object(o.b)("p",null,"\u5305\u62ec\uff1a"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u7279\u6027\u65b9\u5f0f ",Object(o.b)("inlineCode",{parentName:"li"},"DataAnnotations")),Object(o.b)("li",{parentName:"ul"},"\u81ea\u5b9a\u4e49\u590d\u6742\u9a8c\u8bc1 ",Object(o.b)("inlineCode",{parentName:"li"},"IValidateOptions"))),Object(o.b)(p.a,{defaultValue:"texin",values:[{label:"\u7279\u6027\u65b9\u5f0f",value:"texin"},{label:"\u590d\u6742\u9a8c\u8bc1",value:"fuza"}],mdxType:"Tabs"},Object(o.b)(s.a,{value:"texin",mdxType:"TabItem"},Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,8,10,12}","{2,8,10,12}":!0}),'using Fur.ConfigurableOptions;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Application\n{\n public class AppInfoOptions : IConfigurableOptions\n {\n [Required(ErrorMessage = "\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a")]\n public string Name { get; set; }\n [Required, RegularExpression(@"^[0-9][0-9\\.]+[0-9]$", ErrorMessage = "\u4e0d\u662f\u6709\u6548\u7684\u7248\u672c\u53f7")]\n public string Version { get; set; }\n [Required, MaxLength(100)]\n public string Company { get; set; }\n }\n}\n'))),Object(o.b)(s.a,{value:"fuza",mdxType:"TabItem"},Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b ",Object(o.b)("inlineCode",{parentName:"li"},"AppInfoValidation")," \u5e76\u7ee7\u627f ",Object(o.b)("inlineCode",{parentName:"li"},"IValidateOptions")," \u63a5\u53e3\uff0c\u540c\u65f6\u5b9e\u73b0 ",Object(o.b)("inlineCode",{parentName:"li"},"Validate")," \u65b9\u6cd5\u3002")),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,6,8,12,15}","{1,6,8,12,15}":!0}),'using Microsoft.Extensions.Options;\nusing System.Text.RegularExpressions;\n\nnamespace Fur.Application\n{\n public class AppInfoValidation : IValidateOptions\n {\n public ValidateOptionsResult Validate(string name, AppInfoOptions options)\n {\n if (!Regex.IsMatch(options.Version, @"^[0-9][0-9\\.]+[0-9]$"))\n {\n return ValidateOptionsResult.Fail("\u4e0d\u662f\u6709\u6548\u7684\u7248\u672c\u53f7");\n }\n\n return ValidateOptionsResult.Success;\n }\n }\n}\n')),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u9009\u9879\u7c7b\u7ee7\u627f ",Object(o.b)("inlineCode",{parentName:"li"},"IConfigurableOptions")," \u63a5\u53e3\uff0c\u5e76\u5b9e\u73b0\u8be5\u63a5\u53e3\u3002")),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{6,16-18}","{6,16-18}":!0}),'using Fur.ConfigurableOptions;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Application\n{\n public class AppInfoOptions : IConfigurableOptions\n {\n [Required(ErrorMessage = "\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a")]\n public string Name { get; set; }\n [Required]\n public string Version { get; set; }\n [Required, MaxLength(100)]\n public string Company { get; set; }\n\n // \u9009\u9879\u540e\u671f\u914d\u7f6e\n public void PostConfigure(AppInfoOptions options)\n {\n }\n }\n}\n')),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},"\u5b8c\u6574\u4ee3\u7801\u5982\u4e0b\uff1a")),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{4,9,19,25,27,31,34}","{4,9,19,25,27,31,34}":!0}),'using Fur.ConfigurableOptions;\nusing Microsoft.Extensions.Options;\nusing System.ComponentModel.DataAnnotations;\nusing System.Text.RegularExpressions;\n\nnamespace Fur.Application\n{\n // \u7ee7\u627f IConfigurableOptions \u63a5\u53e3\n public class AppInfoOptions : IConfigurableOptions\n {\n [Required(ErrorMessage = "\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a")]\n public string Name { get; set; }\n [Required]\n public string Version { get; set; }\n [Required, MaxLength(100)]\n public string Company { get; set; }\n\n // \u9009\u9879\u540e\u671f\u914d\u7f6e\n public void PostConfigure(AppInfoOptions options)\n {\n }\n }\n\n // \u521b\u5efa\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u7c7b\n public class AppInfoValidation : IValidateOptions\n {\n public ValidateOptionsResult Validate(string name, AppInfoOptions options)\n {\n if (!Regex.IsMatch(options.Version, @"^[0-9][0-9\\.]+[0-9]$"))\n {\n return ValidateOptionsResult.Fail("\u4e0d\u662f\u6709\u6548\u7684\u7248\u672c\u53f7");\n }\n\n return ValidateOptionsResult.Success;\n }\n }\n}\n')))),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions"))," \u7ee7\u627f\u81ea ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions")),"\uff0c\u4e5f\u5c31\u662f\u81ea\u5b9a\u4e49\u590d\u6742\u9a8c\u8bc1\u9ed8\u8ba4\u5177\u6709 ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"PostConfigure(TOptions options)"))," \u9009\u9879\u540e\u671f\u914d\u7f6e\u65b9\u6cd5\u3002\u5173\u4e8e\u300a",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"#227-%E9%80%89%E9%A1%B9%E5%90%8E%E6%9C%9F%E9%85%8D%E7%BD%AE"}),"4.3.7 \u9009\u9879\u540e\u671f\u914d\u7f6e"),"\u300b\u5c06\u5728\u4e0b\u4e00\u5c0f\u8282\u8bf4\u660e\u3002"))),Object(o.b)("h2",{id:"428-\u9009\u9879\u540e\u671f\u914d\u7f6e"},"4.2.8 \u9009\u9879\u540e\u671f\u914d\u7f6e"),Object(o.b)("p",null,"\u9009\u9879\u540e\u671f\u914d\u7f6e\u901a\u4fd7\u4e00\u70b9\u6765\u8bf4\uff0c\u53ef\u4ee5\u5728\u8fd0\u884c\u65f6\u89e3\u6790\u503c\u6216\u8bbe\u5b9a\u9ed8\u8ba4\u503c/\u540e\u671f\u914d\u7f6e\u7b49\u3002"),Object(o.b)("p",null,"\u5728 ",Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u914d\u7f6e\u9009\u9879\u540e\u671f\u914d\u7f6e\u5f88\u7b80\u5355\uff0c\u53ea\u9700\u8981\u7ee7\u627f ",Object(o.b)("inlineCode",{parentName:"p"},"IConfigurableOptions\n {\n [Required(ErrorMessage = "\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a")]\n public string Name { get; set; }\n [Required]\n public string Version { get; set; }\n [Required, MaxLength(100)]\n public string Company { get; set; }\n\n public void PostConfigure(AppInfoOptions options, IConfiguration configuration)\n {\n options.Name ??= "Fur";\n options.Version ??= "1.0.0";\n options.Version ??= "Baiqian";\n }\n }\n}\n')),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions"))," \u7ee7\u627f\u81ea ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions")),"\uff0c\u4e5f\u5c31\u662f\u81ea\u5b9a\u4e49\u590d\u6742\u9a8c\u8bc1\u9ed8\u8ba4\u5177\u6709 ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"PostConfigure(TOptions options, IConfiguration configuration)"))," \u9009\u9879\u540e\u671f\u914d\u7f6e\u65b9\u6cd5\u3002"))),Object(o.b)("h2",{id:"429-\u9009\u9879\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09"},"4.2.9 \u9009\u9879\u66f4\u6539\u901a\u77e5\uff08",Object(o.b)("inlineCode",{parentName:"h2"},"\u70ed\u66f4\u65b0"),"\uff09"),Object(o.b)("p",null,Object(o.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u63d0\u4f9b\u4e86\u975e\u5e38\u7b80\u5355\u4e14\u7075\u6d3b\u7684\u65b9\u5f0f\u76d1\u542c\u9009\u9879\u66f4\u6539\uff0c\u4e5f\u5c31\u662f ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"appsettings.json")," \u6216 \u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u53d1\u751f\u4efb\u4f55\u66f4\u6539\u90fd\u4f1a\u89e6\u53d1\u5904\u7406\u65b9\u6cd5"),"\u3002"),Object(o.b)("p",null,"\u4f7f\u7528\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u8981\u7ee7\u627f ",Object(o.b)("inlineCode",{parentName:"p"},"IConfigurableOptionsListener")," \u63a5\u53e3\u5e76\u5b9e\u73b0 ",Object(o.b)("inlineCode",{parentName:"p"},"void OnListener(TOptions options, IConfiguration configuration)")," \u65b9\u6cd5\u5373\u53ef\u3002"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{5,12-16}","{5,12-16}":!0}),"using Fur.ConfigurableOptions;\n\nnamespace Fur.Application\n{\n public class AppInfoOptions : IConfigurableOptionsListener\n {\n public string Name { get; set; }\n public string Version { get; set; }\n public string Company { get; set; }\n }\n\n public void OnListener(AppInfoOptions options, IConfiguration configuration)\n {\n var name = options.Name; // \u5b9e\u65f6\u7684\u6700\u65b0\u503c\n var version = options.Version; // \u5b9e\u65f6\u7684\u6700\u65b0\u503c\n }\n\n public void PostConfigure(AppInfoOptions options, IConfiguration configuration)\n {\n }\n}\n")),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u7279\u522b\u8bf4\u660e")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptionsListener"))," \u7ee7\u627f\u81ea ",Object(o.b)("strong",{parentName:"p"},Object(o.b)("inlineCode",{parentName:"strong"},"IConfigurableOptions")),"\u3002"))),Object(o.b)("h2",{id:"4210-\u9009\u9879\u7684\u4f18\u7f3a\u70b9"},"4.2.10 \u9009\u9879\u7684\u4f18\u7f3a\u70b9"),Object(o.b)("ul",null,Object(o.b)("li",{parentName:"ul"},Object(o.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u5f3a\u7c7b\u578b\u914d\u7f6e"),Object(o.b)("li",{parentName:"ul"},"\u63d0\u4f9b\u591a\u79cd\u8bfb\u53d6\u65b9\u5f0f"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u70ed\u52a0\u8f7d"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u8bbe\u7f6e\u9ed8\u8ba4\u503c/\u540e\u671f\u914d\u7f6e"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u5728\u8fd0\u884c\u73af\u5883\u4e2d\u52a8\u6001\u914d\u7f6e"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u9a8c\u8bc1\u914d\u7f6e\u6709\u6548\u6027"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u66f4\u6539\u901a\u77e5"),Object(o.b)("li",{parentName:"ul"},"\u652f\u6301\u547d\u540d\u9009\u9879"))),Object(o.b)("li",{parentName:"ul"},Object(o.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(o.b)("ul",{parentName:"li"},Object(o.b)("li",{parentName:"ul"},"\u9700\u8981\u5b9a\u4e49\u5bf9\u5e94\u7c7b\u578b"),Object(o.b)("li",{parentName:"ul"},"\u9700\u8981\u5728\u542f\u52a8\u65f6\u6ce8\u518c")))),Object(o.b)("h2",{id:"4211-\u53cd\u9988\u4e0e\u5efa\u8bae"},"4.2.11 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(o.b)("hr",null),Object(o.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(o.b)("h5",{parentName:"div"},Object(o.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(o.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(o.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(o.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(o.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(o.b)("inlineCode",{parentName:"p"},"\u9009\u9879")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/options?view=aspnetcore-5.0"}),"ASP.NET Core - \u9009\u9879")," \u7ae0\u8282\u3002"))))}O.isMDXComponent=!0},142:function(e,n,t){"use strict";t.d(n,"a",(function(){return l})),t.d(n,"b",(function(){return m}));var a=t(0),i=t.n(a);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function p(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function s(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var c=i.a.createContext({}),b=function(e){var n=i.a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},l=function(e){var n=b(e.components);return i.a.createElement(c.Provider,{value:n},e.children)},O={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},u=i.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=r(e,["components","mdxType","originalType","parentName"]),l=b(t),u=a,m=l["".concat(p,".").concat(u)]||l[u]||O[u]||o;return t?i.a.createElement(m,s(s({ref:n},c),{},{components:t})):i.a.createElement(m,s({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var o=t.length,p=new Array(o);p[0]=u;var s={};for(var r in n)hasOwnProperty.call(n,r)&&(s[r]=n[r]);s.originalType=e,s.mdxType="string"==typeof e?e:a,p[1]=s;for(var c=2;cfunction(e,n,t,{forcePrependBaseUrl:a=!1,absolute:o=!1}={}){if(!t)return t;if(t.startsWith("#"))return t;if(Object(i.b)(t))return t;if(a)return n+t;const p=t.startsWith(n)?t:n+t.replace(/^\//,"");return o?e+p:p}(n,e,t,a)}}function p(e,n={}){const{withBaseUrl:t}=o();return t(e,n)}},145:function(e,n,t){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function i(e){return void 0!==e&&!a(e)}t.d(n,"b",(function(){return a})),t.d(n,"a",(function(){return i}))},146:function(e,n,t){"use strict";function a(e){var n,t,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;nn.value===e)&&j(e)}const f=e=>{j(e),null!=O&&m(O,e)},v=[],h=e=>{e.metaKey||e.altKey||e.ctrlKey||N(!0)},C=()=>{N(!1)};return Object(a.useEffect)(()=>{window.addEventListener("keydown",h),window.addEventListener("mousedown",C)},[]),i.a.createElement("div",null,i.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(p.a)("tabs",{"tabs--block":n})},l.map(({value:e,label:n})=>i.a.createElement("li",{role:"tab",tabIndex:0,"aria-selected":d===e,className:Object(p.a)("tabs__item",r.a.tabItem,{"tabs__item--active":d===e}),style:g?{}:{outline:"none"},key:e,ref:e=>v.push(e),onKeyDown:e=>{((e,n,t)=>{switch(t.keyCode){case b:((e,n)=>{const t=e.indexOf(n)+1;e[t]?e[t].focus():e[0].focus()})(e,n);break;case c:((e,n)=>{const t=e.indexOf(n)-1;e[t]?e[t].focus():e[e.length-1].focus()})(e,n)}})(v,e.target,e),h(e)},onFocus:()=>f(e),onClick:()=>{f(e),N(!1)},onPointerDown:()=>N(!1)},n))),i.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(t).filter(e=>e.props.value===d)[0]))}},150:function(e,n,t){"use strict";var a=t(0),i=t.n(a);n.a=function(e){return i.a.createElement("div",null,e.children)}}}]); \ No newline at end of file diff --git a/docs/e50e61ad.088b77e2.js b/docs/e50e61ad.d35151ac.js similarity index 100% rename from docs/e50e61ad.088b77e2.js rename to docs/e50e61ad.d35151ac.js diff --git a/docs/e6346b20.50623fe1.js b/docs/e6346b20.65714baf.js similarity index 100% rename from docs/e6346b20.50623fe1.js rename to docs/e6346b20.65714baf.js diff --git a/docs/e6c62f29.d44ea22f.js b/docs/e6c62f29.10beb0c1.js similarity index 88% rename from docs/e6c62f29.d44ea22f.js rename to docs/e6c62f29.10beb0c1.js index eab789c8d76..e0ef85c99de 100644 --- a/docs/e6c62f29.d44ea22f.js +++ b/docs/e6c62f29.10beb0c1.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[77],{131:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return b})),t.d(n,"metadata",(function(){return l})),t.d(n,"rightToc",(function(){return p})),t.d(n,"default",(function(){return u}));var a=t(2),i=t(6),r=(t(0),t(142)),o=(t(144),t(149)),c=t(150),b={id:"configuration",title:"4.1 \u914d\u7f6e",sidebar_label:"4.1 \u914d\u7f6e"},l={unversionedId:"configuration",id:"configuration",isDocsHomePage:!1,title:"4.1 \u914d\u7f6e",description:"\u63a8\u8350\u4f7f\u7528 \u300a4.2 \u9009\u9879\u300b\u4ee3\u66ff\u672c\u7ae0\u8282\u529f\u80fd\u3002\uff08\u4e3a\u4ec0\u4e48\uff09\uff1f",source:"@site/docs\\configuration.mdx",slug:"/configuration",permalink:"/docs/configuration",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/configuration.mdx",version:"current",sidebar_label:"4.1 \u914d\u7f6e",sidebar:"docs",previous:{title:"3. \u5e94\u7528\u542f\u52a8",permalink:"/docs/appstartup"},next:{title:"4.2 \u9009\u9879",permalink:"/docs/options"}},p=[{value:"4.1.1 \u4ec0\u4e48\u662f\u914d\u7f6e",id:"411-\u4ec0\u4e48\u662f\u914d\u7f6e",children:[]},{value:"4.1.2 \u914d\u7f6e\u7684\u4f7f\u7528",id:"412-\u914d\u7f6e\u7684\u4f7f\u7528",children:[{value:"4.1.2.1 \u914d\u7f6e appsettings.json \u4fe1\u606f",id:"4121-\u914d\u7f6e-appsettingsjson-\u4fe1\u606f",children:[]},{value:"4.1.2.2 \u8bfb\u53d6 appsettings.json \u4fe1\u606f",id:"4122-\u8bfb\u53d6-appsettingsjson-\u4fe1\u606f",children:[]},{value:"4.1.2.3 \u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f",id:"4123-\u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f",children:[]}]},{value:"4.1.3 \u8def\u5f84\u7b26 \u67e5\u627e\u8282\u70b9",id:"413-\u8def\u5f84\u7b26-\u67e5\u627e\u8282\u70b9",children:[]},{value:"4.1.4 \u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6",id:"414-\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6",children:[{value:"4.1.4.1 \u8bfb\u53d6 emailsetting.json \u914d\u7f6e",id:"4141-\u8bfb\u53d6-emailsettingjson-\u914d\u7f6e",children:[]}]},{value:"4.1.5 \u4e0d\u540c\u73af\u5883\u8bfb\u53d6",id:"415-\u4e0d\u540c\u73af\u5883\u8bfb\u53d6",children:[]},{value:"4.1.6 \u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09",id:"416-\u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09",children:[]},{value:"4.1.7 \u914d\u7f6e\u7684\u4f18\u7f3a\u70b9",id:"417-\u914d\u7f6e\u7684\u4f18\u7f3a\u70b9",children:[]},{value:"4.1.8 \u914d\u7f6e\u4f7f\u7528\u573a\u666f",id:"418-\u914d\u7f6e\u4f7f\u7528\u573a\u666f",children:[]},{value:"4.1.9 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"419-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],s={rightToc:p};function u(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},s,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u6e29\u99a8\u63d0\u793a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u63a8\u8350\u4f7f\u7528 \u300a",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"/docs/options"}),"4.2 \u9009\u9879"),"\u300b\u4ee3\u66ff\u672c\u7ae0\u8282\u529f\u80fd\u3002\uff08",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"#417-%E9%85%8D%E7%BD%AE%E7%9A%84%E4%BC%98%E7%BC%BA%E7%82%B9"}),"\u4e3a\u4ec0\u4e48"),"\uff09\uff1f"))),Object(r.b)("h2",{id:"411-\u4ec0\u4e48\u662f\u914d\u7f6e"},"4.1.1 \u4ec0\u4e48\u662f\u914d\u7f6e"),Object(r.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u914d\u7f6e\u5c06\u7cfb\u7edf\u5e94\u7528\u53ef\u52a8\u6001\u8c03\u914d\u7684\u9009\u9879\u653e\u5728\u7edf\u4e00\u5730\u65b9\u7ba1\u7406\uff0c\u901a\u8fc7\u4e0d\u540c\u7684\u914d\u7f6e\u8ba9\u7cfb\u7edf\u505a\u51fa\u52a8\u6001\u8c03\u6574\u3002"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u65f6\u9ed8\u8ba4\u52a0\u8f7d ",Object(r.b)("inlineCode",{parentName:"p"},"\u542f\u52a8\u9879\u76ee")," \u4e0b\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4f5c\u4e3a\u5e94\u7528\u914d\u7f6e\u3002\u540c\u65f6\u8fd8\u652f\u6301",Object(r.b)("strong",{parentName:"p"},"\u4e0d\u540c\u7684\u8fd0\u884c\u73af\u5883"),"\u52a0\u8f7d\u5bf9\u5e94\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5982\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Development"),"\uff1a\u52a0\u8f7d ",Object(r.b)("inlineCode",{parentName:"li"},"appsettings.Development.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Staging"),"\uff1a\u52a0\u8f7d ",Object(r.b)("inlineCode",{parentName:"li"},"appsettings.Staging.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"{Environment}"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"appsettings.{Environment}.json"))),Object(r.b)("h2",{id:"412-\u914d\u7f6e\u7684\u4f7f\u7528"},"4.1.2 \u914d\u7f6e\u7684\u4f7f\u7528"),Object(r.b)("p",null,"\u5047\u8bbe\u6211\u4eec\u9700\u8981\u5728\u7cfb\u7edf\u8fd0\u884c\u65f6\u83b7\u53d6",Object(r.b)("strong",{parentName:"p"},"\u7cfb\u7edf\u540d\u79f0\u3001\u7248\u672c\u53f7\u53ca\u7248\u6743\u4fe1\u606f"),"\uff0c\u8fd9\u4e9b\u4fe1\u606f\u53ef\u80fd\u968f\u65f6\u53d8\u5316\u800c\u4e14\u9700\u8981\u5728\u591a\u4e2a\u5730\u65b9\u4f7f\u7528\u3002\u8fd9\u65f6\u5c31\u9700\u8981\u5c06\u8fd9\u4e9b\u4fe1\u606f\u914d\u7f6e\u8d77\u6765\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a"),Object(r.b)("h3",{id:"4121-\u914d\u7f6e-appsettingsjson-\u4fe1\u606f"},"4.1.2.1 \u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"h3"},"appsettings.json")," \u4fe1\u606f"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:"{2-6}","{2-6}":!0}),'{\n "AppInfo": {\n "Name": "Fur",\n "Version": "1.0.0",\n "Company": "Baiqian"\n }\n}\n')),Object(r.b)("h3",{id:"4122-\u8bfb\u53d6-appsettingsjson-\u4fe1\u606f"},"4.1.2.2 \u8bfb\u53d6 ",Object(r.b)("inlineCode",{parentName:"h3"},"appsettings.json")," \u4fe1\u606f"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u63d0\u4f9b\u4e86\u4e24\u79cd\u8bfb\u53d6\u65b9\u5f0f\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u4f9d\u8d56\u6ce8\u5165 ",Object(r.b)("inlineCode",{parentName:"li"},"IConfiguration")," \u5bf9\u8c61\u8bfb\u53d6"),Object(r.b)("li",{parentName:"ul"},"\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"li"},"App.Configuration[jsonKey]")," \u8bfb\u53d6")),Object(r.b)(o.a,{defaultValue:"App.Configuration[jsonKey]",values:[{label:"App.Configuration[jsonKey]",value:"App.Configuration[jsonKey]"},{label:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",value:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f"}],mdxType:"Tabs"},Object(r.b)(c.a,{value:"App.Configuration[jsonKey]",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{11-13}","{11-13}":!0}),'using Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class DefaultController : ControllerBase\n {\n [HttpGet]\n public string Get()\n {\n return $@"\u540d\u79f0\uff1a{App.Configuration["AppInfo:Name"]}\uff0c\n \u7248\u672c\uff1a{App.Configuration["AppInfo:Version"]}\uff0c\n \u516c\u53f8\uff1a{App.Configuration["AppInfo:Company"]}";\n }\n }\n}\n'))),Object(r.b)(c.a,{value:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,10-15}","{2,10-15}":!0}),'using Microsoft.AspNetCore.Mvc;\nusing Microsoft.Extensions.Configuration;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class DefaultController : ControllerBase\n {\n [HttpGet]\n public string Get([FromServices] IConfiguration configuration)\n {\n return $@"\u540d\u79f0\uff1a{configuration["AppInfo:Name"]}\uff0c\n \u7248\u672c\uff1a{configuration["AppInfo:Version"]}\uff0c\n \u516c\u53f8\uff1a{configuration["AppInfo:Company"]}";\n }\n }\n}\n')))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u4f9d\u8d56\u6ce8\u5165\u7684\u65b9\u5f0f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u901a\u8fc7\u4f9d\u8d56\u6ce8\u5165\u6ce8\u5165\u5b9e\u4f8b\u6709\u51e0\u79cd\u65b9\u5f0f\uff1a"),Object(r.b)("ul",{parentName:"div"},Object(r.b)("li",{parentName:"ul"},"\u6784\u9020\u51fd\u6570\u6ce8\u5165\u65b9\u5f0f")),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2}","{2}":!0}),"private readonly IConfiguration _configuration;\npublic DefaultController(IConfiguration configuration)\n{\n _configuration = configuration;\n}\n")),Object(r.b)("ul",{parentName:"div"},Object(r.b)("li",{parentName:"ul"},"\u53c2\u6570\u6ce8\u5165\u65b9\u5f0f ",Object(r.b)("inlineCode",{parentName:"li"},"[FromServices]"))),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),"public string Get([FromServices] IConfiguration configuration)\n{\n}\n")),Object(r.b)("ul",{parentName:"div"},Object(r.b)("li",{parentName:"ul"},"\u5c5e\u6027\u6ce8\u5165\u65b9\u5f0f")),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),"public IConfiguration Configuration { get; set; }\n")),Object(r.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u300a",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-3.1"}),"ASP.NET Core - \u4f9d\u8d56\u6ce8\u5165"),"\u300b \u77e5\u8bc6"))),Object(r.b)("h3",{id:"4123-\u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f"},"4.1.2.3 \u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u5728\u53ef\u4f9d\u8d56\u6ce8\u5165\u7c7b\u4e2d\uff0c\u4f9d\u8d56\u6ce8\u5165 ",Object(r.b)("inlineCode",{parentName:"li"},"IConfiguration")," \u8bfb\u53d6"),Object(r.b)("li",{parentName:"ul"},"\u5728\u9759\u6001\u7c7b/\u975e\u4f9d\u8d56\u6ce8\u5165\u7c7b\u4e2d\uff0c\u9009\u62e9 ",Object(r.b)("inlineCode",{parentName:"li"},"App.Configuration[jsonKey]")," \u8bfb\u53d6")),Object(r.b)("h2",{id:"413-\u8def\u5f84\u7b26-\u67e5\u627e\u8282\u70b9"},"4.1.3 ",Object(r.b)("inlineCode",{parentName:"h2"},"\u8def\u5f84\u7b26")," \u67e5\u627e\u8282\u70b9"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4e2d\uff0c\u914d\u7f6e\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},":")," \u5206\u9694\u7b26\u6765\u8bfb\u53d6\u5206\u5c42\u914d\u7f6e\u6570\u636e\u3002\u5982\u4e0a\u8ff0\u4f8b\u5b50\u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"AppInfo:Name"),"\u3002\u5982\u6709\u66f4\u591a\u5c42\u7ea7\u6570\u636e\u5219\u53ea\u9700\u8981\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},":")," \u8fdb\u5165\u4e0b\u4e00\u5c42\u8282\u70b9\u5373\u53ef\u3002"),Object(r.b)("p",null,"\u5047\u8bbe\u6211\u4eec\u6709\u4ee5\u4e0b\u914d\u7f6e\u4fe1\u606f\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:"{5-12}","{5-12}":!0}),'{\n "AppInfo": {\n "Name": "Fur",\n "Version": "1.0.0",\n "Company": {\n "Name": "Baiqian",\n "Address": {\n "City": "\u4e2d\u56fd",\n "Province": "\u5e7f\u4e1c\u7701",\n "Detail": "\u4e2d\u5c71\u5e02\u4e1c\u533a\u7d2b\u9a6c\u516c\u56ed\u897f\u95e8"\n }\n }\n }\n}\n')),Object(r.b)(o.a,{defaultValue:"two",values:[{label:"\u8bfb\u53d6\u7b2c\u4e8c\u5c42",value:"two"},{label:"\u8bfb\u53d6\u7b2c\u4e09\u5c42",value:"three"},{label:"\u8bfb\u53d6\u7b2c\u56db\u5c42",value:"four"},{label:"\u8bfb\u53d6\u7b2cN\u5c42",value:"n"}],mdxType:"Tabs"},Object(r.b)(c.a,{value:"two",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var companyName = App.Configuration["AppInfo:Name"]; // => Fur\n'))),Object(r.b)(c.a,{value:"three",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var companyName = App.Configuration["AppInfo:Company:Name"]; // => Baiqian\n'))),Object(r.b)(c.a,{value:"four",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var companyName = App.Configuration["AppInfo:Company:Address:Detail"]; // => \u4e2d\u5c71\u5e02\u4e1c\u533a\u7d2b\u9a6c\u516c\u56ed\u897f\u95e8\n'))),Object(r.b)(c.a,{value:"n",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var companyName = App.Configuration["AppInfo:Tier2:Tier3:Tier4...Tiern1:Tiern3..."]; // => \u4e2d\u5c71\u5e02\u4e1c\u533a\u7d2b\u9a6c\u516c\u56ed\u897f\u95e8\n')))),Object(r.b)("h2",{id:"414-\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6"},"4.1.4 \u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6"),Object(r.b)("p",null,"\u5927\u591a\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u7684\u914d\u7f6e\u53ea\u9700\u8981\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u914d\u7f6e\u5373\u53ef\uff0c\u4f46\u4e00\u4e9b\u7279\u6b8a\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5e0c\u671b\u67d0\u4e9b\u7ec4\u4ef6\u6216\u529f\u80fd\u62e5\u6709\u72ec\u7acb\u7684\u914d\u7f6e\uff0c\u8fd9\u4e2a\u65f6\u5019\u5c31\u9700\u8981\u7528\u5230\u81ea\u5b9a\u4e49\u914d\u7f6e\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u76ee\u524d\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},".json")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},".xml")," \u4e24\u79cd\u65b9\u5f0f\u914d\u7f6e\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-13} title="Fur.Web.Entry/emailsetting.json"',"{2-13}":!0,title:'"Fur.Web.Entry/emailsetting.json"'}),'{\n "outlook": {\n "smtp": {\n "server": "smtp.office365.com",\n "port": "587",\n "ssl": "STARTTLS"\n },\n "pop": {\n "server": "outlook.office365.com",\n "port": "995",\n "ssl": "TLS"\n }\n }\n}\n')),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-xml"}),'\n\n MyXMLFile Value\n \n Title from MyXMLFile\n Name from MyXMLFile\n \n \n \n Information\n Warning\n \n \n\n')),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"xml \u914d\u7f6e\u4e8b\u9879")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"xml")," \u914d\u7f6e\uff0c\u90a3\u4e48\u6587\u4ef6\u540d\u5fc5\u987b\u4ee5 ",Object(r.b)("inlineCode",{parentName:"p"},".config.xml")," \u7ed3\u5c3e\uff08\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff09\u3002"))),Object(r.b)("p",null,"\u540c\u65f6 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u65b9\u5f0f\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u8bfb\u53d6\uff0c\u5982\uff1a"),Object(r.b)("h3",{id:"4141-\u8bfb\u53d6-emailsettingjson-\u914d\u7f6e"},"4.1.4.1 \u8bfb\u53d6 ",Object(r.b)("inlineCode",{parentName:"h3"},"emailsetting.json")," \u914d\u7f6e"),Object(r.b)("p",null,"\u8bfb\u53d6\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u548c\u8bfb\u53d6 ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e00\u81f4\uff0c\u7cfb\u7edf\u4f1a\u81ea\u52a8\u4ece\u591a\u4e2a\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5982\uff1a"),Object(r.b)(o.a,{defaultValue:"jtl",values:[{label:"App.Configuration[jsonKey]",value:"jtl"},{label:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",value:"ylzr"}],mdxType:"Tabs"},Object(r.b)(c.a,{value:"jtl",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var smtpServer = App.Configuration["outlook:smtp:server"]; // => smtp.office365.com\n'))),Object(r.b)(c.a,{value:"ylzr",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var smtpServer = _configuration["outlook:smtp:server"]; // => smtp.office365.com\n')))),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u8bf4\u660e")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4f1a\u5728\u542f\u52a8\u65f6\u81ea\u52a8\u626b\u63cf\u6bcf\u4e00\u4e2a\u9879\u76ee\u5c42\u6839\u76ee\u5f55\u4e0b\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"*.json")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"*.xml")," \u6587\u4ef6\u52a0\u5165\u914d\u7f6e\u4e2d\u3002\u6240\u4ee5\u65e0\u9700\u624b\u5de5\u914d\u7f6e\u3002"))),Object(r.b)("h2",{id:"415-\u4e0d\u540c\u73af\u5883\u8bfb\u53d6"},"4.1.5 \u4e0d\u540c\u73af\u5883\u8bfb\u53d6"),Object(r.b)("p",null,"\u5728\u5b9e\u9645\u5e94\u7528\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u53ef\u80fd\u4f1a\u6839\u636e\u4e0d\u540c\u7684\u73af\u5883\u52a0\u8f7d\u4e0d\u540c\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"p"},"\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32"),"\u3002"),Object(r.b)("p",null,"\u8fd9\u65f6\u6211\u4eec\u53ea\u9700\u8981\u9075\u5faa\u7279\u5b9a\u547d\u540d\u89c4\u8303 ",Object(r.b)("inlineCode",{parentName:"p"},"{name}.{Environment}.json")," \u5373\u53ef\u3002\u5982\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"appsettings.Development.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"appsettings.Staging.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"appsettings.Production.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"emailsetting.Development.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"emailsetting.Staging.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"emailsetting.Production.json"))),Object(r.b)("p",null,"\u8fd9\u65f6\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4f1a\u5728\u5e94\u7528\u542f\u52a8\u65f6\u81ea\u52a8\u52a0\u8f7d\u4e0d\u540c\u73af\u5883\u7684\u914d\u7f6e\u6587\u4ef6\u3002"),Object(r.b)("h2",{id:"416-\u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09"},"4.1.6 \u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08",Object(r.b)("inlineCode",{parentName:"h2"},"\u70ed\u66f4\u65b0"),"\uff09"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},".NET Core")," \u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u914d\u7f6e\u652f\u6301\u66f4\u6539\u901a\u77e5\uff0c\u4e5f\u5c31\u662f\u70ed\u66f4\u65b0\u64cd\u4f5c\u3002",Object(r.b)("strong",{parentName:"p"},"\u4e00\u65e6\u76d1\u542c\u5230 ",Object(r.b)("inlineCode",{parentName:"strong"},"appsetting.json")," \u6216\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u53d1\u751f\u53d8\u52a8\uff0c\u5c31\u4f1a\u89e6\u53d1 ",Object(r.b)("inlineCode",{parentName:"strong"},"OnChange")," \u65b9\u6cd5"),"\u3002\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,4-5}","{2,4-5}":!0}),'var appInfoConfiguration = App.Configuration["AppInfo"];\nChangeToken.OnChange(() => appInfoConfiguration.GetReloadToken(), () =>\n{\n var name = appInfoConfiguration["Name"]; // \u5b9e\u65f6\u7684\u6700\u65b0\u503c\n var version = appInfoConfiguration["Version"]; // \u5b9e\u65f6\u7684\u6700\u65b0\u503c\n});\n')),Object(r.b)("h2",{id:"417-\u914d\u7f6e\u7684\u4f18\u7f3a\u70b9"},"4.1.7 \u914d\u7f6e\u7684\u4f18\u7f3a\u70b9"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u80fd\u591f\u5728\u7cfb\u7edf\u8fd0\u884c\u65f6\u5feb\u901f\u8bfb\u53d6"),Object(r.b)("li",{parentName:"ul"},"\u65e0\u9700\u989d\u5916\u914d\u7f6e"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u5b58\u5728\u91cd\u590d\u8bfb\u53d6"),Object(r.b)("li",{parentName:"ul"},"\u901a\u8fc7\u786c\u7f16\u7801\u5b57\u7b26\u4e32\u8bfb\u53d6\uff0c\u5bb9\u6613\u51fa\u9519"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u80fd\u8bbe\u7f6e\u9ed8\u8ba4\u503c"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u80fd\u5728\u8fd0\u884c\u73af\u5883\u4e2d\u52a8\u6001\u914d\u7f6e"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u80fd\u9a8c\u8bc1\u914d\u7f6e\u6709\u6548\u6027"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u66f4\u6539\u901a\u77e5")))),Object(r.b)("h2",{id:"418-\u914d\u7f6e\u4f7f\u7528\u573a\u666f"},"4.1.8 \u914d\u7f6e\u4f7f\u7528\u573a\u666f"),Object(r.b)("p",null,"\u5982\u679c\u53ea\u9700\u8981",Object(r.b)("strong",{parentName:"p"},"\u4e00\u6b21\u6027\u8bfb\u53d6"),"\u914d\u7f6e\u4fe1\u606f\uff0c\u5219\u4f7f\u7528\u914d\u7f6e\uff0c\u5426\u5219\u5e94\u8be5\u4f7f\u7528 \u300a",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"/docs/options"}),"4.2 \u9009\u9879"),"\u300b\u4ee3\u66ff\u3002"),Object(r.b)("h2",{id:"419-\u53cd\u9988\u4e0e\u5efa\u8bae"},"4.1.9 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(r.b)("hr",null),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(r.b)("inlineCode",{parentName:"p"},"\u914d\u7f6e")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/?view=aspnetcore-5.0"}),"ASP.NET Core - \u914d\u7f6e")," \u7ae0\u8282\u3002"))))}u.isMDXComponent=!0},142:function(e,n,t){"use strict";t.d(n,"a",(function(){return s})),t.d(n,"b",(function(){return j}));var a=t(0),i=t.n(a);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function c(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var l=i.a.createContext({}),p=function(e){var n=i.a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},s=function(e){var n=p(e.components);return i.a.createElement(l.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},m=i.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,o=e.parentName,l=b(e,["components","mdxType","originalType","parentName"]),s=p(t),m=a,j=s["".concat(o,".").concat(m)]||s[m]||u[m]||r;return t?i.a.createElement(j,c(c({ref:n},l),{},{components:t})):i.a.createElement(j,c({ref:n},l))}));function j(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,o=new Array(r);o[0]=m;var c={};for(var b in n)hasOwnProperty.call(n,b)&&(c[b]=n[b]);c.originalType=e,c.mdxType="string"==typeof e?e:a,o[1]=c;for(var l=2;lappsettings.json \u4fe1\u606f",id:"4121-\u914d\u7f6e-appsettingsjson-\u4fe1\u606f",children:[]},{value:"4.1.2.2 \u8bfb\u53d6 appsettings.json \u4fe1\u606f",id:"4122-\u8bfb\u53d6-appsettingsjson-\u4fe1\u606f",children:[]},{value:"4.1.2.3 \u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f",id:"4123-\u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f",children:[]}]},{value:"4.1.3 \u8def\u5f84\u7b26 \u67e5\u627e\u8282\u70b9",id:"413-\u8def\u5f84\u7b26-\u67e5\u627e\u8282\u70b9",children:[]},{value:"4.1.4 \u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6",id:"414-\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6",children:[{value:"4.1.4.1 \u8bfb\u53d6 emailsetting.json \u914d\u7f6e",id:"4141-\u8bfb\u53d6-emailsettingjson-\u914d\u7f6e",children:[]}]},{value:"4.1.5 \u4e0d\u540c\u73af\u5883\u8bfb\u53d6",id:"415-\u4e0d\u540c\u73af\u5883\u8bfb\u53d6",children:[]},{value:"4.1.6 \u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09",id:"416-\u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09",children:[]},{value:"4.1.7 \u914d\u7f6e\u7684\u4f18\u7f3a\u70b9",id:"417-\u914d\u7f6e\u7684\u4f18\u7f3a\u70b9",children:[]},{value:"4.1.8 \u914d\u7f6e\u4f7f\u7528\u573a\u666f",id:"418-\u914d\u7f6e\u4f7f\u7528\u573a\u666f",children:[]},{value:"4.1.9 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"419-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],s={rightToc:p};function m(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(r.b)("wrapper",Object(a.a)({},s,t,{components:n,mdxType:"MDXLayout"}),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u6e29\u99a8\u63d0\u793a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u63a8\u8350\u4f7f\u7528 \u300a",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"/docs/options"}),"4.2 \u9009\u9879"),"\u300b\u4ee3\u66ff\u672c\u7ae0\u8282\u529f\u80fd\u3002\uff08",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"#417-%E9%85%8D%E7%BD%AE%E7%9A%84%E4%BC%98%E7%BC%BA%E7%82%B9"}),"\u4e3a\u4ec0\u4e48"),"\uff09\uff1f"))),Object(r.b)("h2",{id:"411-\u4ec0\u4e48\u662f\u914d\u7f6e"},"4.1.1 \u4ec0\u4e48\u662f\u914d\u7f6e"),Object(r.b)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u914d\u7f6e\u5c06\u7cfb\u7edf\u5e94\u7528\u53ef\u52a8\u6001\u8c03\u914d\u7684\u9009\u9879\u653e\u5728\u7edf\u4e00\u5730\u65b9\u7ba1\u7406\uff0c\u901a\u8fc7\u4e0d\u540c\u7684\u914d\u7f6e\u8ba9\u7cfb\u7edf\u505a\u51fa\u52a8\u6001\u8c03\u6574\u3002"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u65f6\u9ed8\u8ba4\u52a0\u8f7d ",Object(r.b)("inlineCode",{parentName:"p"},"\u542f\u52a8\u9879\u76ee")," \u4e0b\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4f5c\u4e3a\u5e94\u7528\u914d\u7f6e\u3002\u540c\u65f6\u8fd8\u652f\u6301",Object(r.b)("strong",{parentName:"p"},"\u4e0d\u540c\u7684\u8fd0\u884c\u73af\u5883"),"\u52a0\u8f7d\u5bf9\u5e94\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5982\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Development"),"\uff1a\u52a0\u8f7d ",Object(r.b)("inlineCode",{parentName:"li"},"appsettings.Development.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"Staging"),"\uff1a\u52a0\u8f7d ",Object(r.b)("inlineCode",{parentName:"li"},"appsettings.Staging.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"{Environment}"),"\uff1a",Object(r.b)("inlineCode",{parentName:"li"},"appsettings.{Environment}.json"))),Object(r.b)("h2",{id:"412-\u914d\u7f6e\u7684\u4f7f\u7528"},"4.1.2 \u914d\u7f6e\u7684\u4f7f\u7528"),Object(r.b)("p",null,"\u5047\u8bbe\u6211\u4eec\u9700\u8981\u5728\u7cfb\u7edf\u8fd0\u884c\u65f6\u83b7\u53d6",Object(r.b)("strong",{parentName:"p"},"\u7cfb\u7edf\u540d\u79f0\u3001\u7248\u672c\u53f7\u53ca\u7248\u6743\u4fe1\u606f"),"\uff0c\u8fd9\u4e9b\u4fe1\u606f\u53ef\u80fd\u968f\u65f6\u53d8\u5316\u800c\u4e14\u9700\u8981\u5728\u591a\u4e2a\u5730\u65b9\u4f7f\u7528\u3002\u8fd9\u65f6\u5c31\u9700\u8981\u5c06\u8fd9\u4e9b\u4fe1\u606f\u914d\u7f6e\u8d77\u6765\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a"),Object(r.b)("h3",{id:"4121-\u914d\u7f6e-appsettingsjson-\u4fe1\u606f"},"4.1.2.1 \u914d\u7f6e ",Object(r.b)("inlineCode",{parentName:"h3"},"appsettings.json")," \u4fe1\u606f"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:"{2-6}","{2-6}":!0}),'{\n "AppInfo": {\n "Name": "Fur",\n "Version": "1.0.0",\n "Company": "Baiqian"\n }\n}\n')),Object(r.b)("h3",{id:"4122-\u8bfb\u53d6-appsettingsjson-\u4fe1\u606f"},"4.1.2.2 \u8bfb\u53d6 ",Object(r.b)("inlineCode",{parentName:"h3"},"appsettings.json")," \u4fe1\u606f"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4e2d\uff0c\u63d0\u4f9b\u4e86\u4e24\u79cd\u8bfb\u53d6\u65b9\u5f0f\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u4f9d\u8d56\u6ce8\u5165 ",Object(r.b)("inlineCode",{parentName:"li"},"IConfiguration")," \u5bf9\u8c61\u8bfb\u53d6"),Object(r.b)("li",{parentName:"ul"},"\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"li"},"App.Configuration[jsonKey]")," \u8bfb\u53d6")),Object(r.b)(o.a,{defaultValue:"App.Configuration[jsonKey]",values:[{label:"App.Configuration[jsonKey]",value:"App.Configuration[jsonKey]"},{label:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",value:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f"}],mdxType:"Tabs"},Object(r.b)(c.a,{value:"App.Configuration[jsonKey]",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{11-13}","{11-13}":!0}),'using Microsoft.AspNetCore.Mvc;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class DefaultController : ControllerBase\n {\n [HttpGet]\n public string Get()\n {\n return $@"\u540d\u79f0\uff1a{App.Configuration["AppInfo:Name"]}\uff0c\n \u7248\u672c\uff1a{App.Configuration["AppInfo:Version"]}\uff0c\n \u516c\u53f8\uff1a{App.Configuration["AppInfo:Company"]}";\n }\n }\n}\n'))),Object(r.b)(c.a,{value:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,10-15}","{2,10-15}":!0}),'using Microsoft.AspNetCore.Mvc;\nusing Microsoft.Extensions.Configuration;\n\nnamespace Fur.Web.Entry.Controllers\n{\n [Route("api/[controller]")]\n public class DefaultController : ControllerBase\n {\n [HttpGet]\n public string Get([FromServices] IConfiguration configuration)\n {\n return $@"\u540d\u79f0\uff1a{configuration["AppInfo:Name"]}\uff0c\n \u7248\u672c\uff1a{configuration["AppInfo:Version"]}\uff0c\n \u516c\u53f8\uff1a{configuration["AppInfo:Company"]}";\n }\n }\n}\n')))),Object(r.b)("div",{className:"admonition admonition-tip alert alert--success"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})))),"\u4f9d\u8d56\u6ce8\u5165\u7684\u65b9\u5f0f")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u901a\u8fc7\u4f9d\u8d56\u6ce8\u5165\u6ce8\u5165\u5b9e\u4f8b\u6709\u51e0\u79cd\u65b9\u5f0f\uff1a"),Object(r.b)("ul",{parentName:"div"},Object(r.b)("li",{parentName:"ul"},"\u6784\u9020\u51fd\u6570\u6ce8\u5165\u65b9\u5f0f")),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2}","{2}":!0}),"private readonly IConfiguration _configuration;\npublic DefaultController(IConfiguration configuration)\n{\n _configuration = configuration;\n}\n")),Object(r.b)("ul",{parentName:"div"},Object(r.b)("li",{parentName:"ul"},"\u53c2\u6570\u6ce8\u5165\u65b9\u5f0f ",Object(r.b)("inlineCode",{parentName:"li"},"[FromServices]"))),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),"public string Get([FromServices] IConfiguration configuration)\n{\n}\n")),Object(r.b)("ul",{parentName:"div"},Object(r.b)("li",{parentName:"ul"},"\u5c5e\u6027\u6ce8\u5165\u65b9\u5f0f")),Object(r.b)("pre",{parentName:"div"},Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{1}","{1}":!0}),"public IConfiguration Configuration { get; set; }\n")),Object(r.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u300a",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-3.1"}),"ASP.NET Core - \u4f9d\u8d56\u6ce8\u5165"),"\u300b \u77e5\u8bc6"))),Object(r.b)("h3",{id:"4123-\u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f"},"4.1.2.3 \u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},"\u5728\u53ef\u4f9d\u8d56\u6ce8\u5165\u7c7b\u4e2d\uff0c\u4f9d\u8d56\u6ce8\u5165 ",Object(r.b)("inlineCode",{parentName:"li"},"IConfiguration")," \u8bfb\u53d6"),Object(r.b)("li",{parentName:"ul"},"\u5728\u9759\u6001\u7c7b/\u975e\u4f9d\u8d56\u6ce8\u5165\u7c7b\u4e2d\uff0c\u9009\u62e9 ",Object(r.b)("inlineCode",{parentName:"li"},"App.Configuration[jsonKey]")," \u8bfb\u53d6")),Object(r.b)("h2",{id:"413-\u8def\u5f84\u7b26-\u67e5\u627e\u8282\u70b9"},"4.1.3 ",Object(r.b)("inlineCode",{parentName:"h2"},"\u8def\u5f84\u7b26")," \u67e5\u627e\u8282\u70b9"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4e2d\uff0c\u914d\u7f6e\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},":")," \u5206\u9694\u7b26\u6765\u8bfb\u53d6\u5206\u5c42\u914d\u7f6e\u6570\u636e\u3002\u5982\u4e0a\u8ff0\u4f8b\u5b50\u4e2d\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"AppInfo:Name"),"\u3002\u5982\u6709\u66f4\u591a\u5c42\u7ea7\u6570\u636e\u5219\u53ea\u9700\u8981\u901a\u8fc7 ",Object(r.b)("inlineCode",{parentName:"p"},":")," \u8fdb\u5165\u4e0b\u4e00\u5c42\u8282\u70b9\u5373\u53ef\u3002"),Object(r.b)("p",null,"\u5047\u8bbe\u6211\u4eec\u6709\u4ee5\u4e0b\u914d\u7f6e\u4fe1\u606f\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:"{5-12}","{5-12}":!0}),'{\n "AppInfo": {\n "Name": "Fur",\n "Version": "1.0.0",\n "Company": {\n "Name": "Baiqian",\n "Address": {\n "City": "\u4e2d\u56fd",\n "Province": "\u5e7f\u4e1c\u7701",\n "Detail": "\u4e2d\u5c71\u5e02\u4e1c\u533a\u7d2b\u9a6c\u516c\u56ed\u897f\u95e8"\n }\n }\n }\n}\n')),Object(r.b)(o.a,{defaultValue:"two",values:[{label:"\u8bfb\u53d6\u7b2c\u4e8c\u5c42",value:"two"},{label:"\u8bfb\u53d6\u7b2c\u4e09\u5c42",value:"three"},{label:"\u8bfb\u53d6\u7b2c\u56db\u5c42",value:"four"},{label:"\u8bfb\u53d6\u7b2cN\u5c42",value:"n"}],mdxType:"Tabs"},Object(r.b)(c.a,{value:"two",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var companyName = App.Configuration["AppInfo:Name"]; // => Fur\n'))),Object(r.b)(c.a,{value:"three",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var companyName = App.Configuration["AppInfo:Company:Name"]; // => Baiqian\n'))),Object(r.b)(c.a,{value:"four",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var companyName = App.Configuration["AppInfo:Company:Address:Detail"]; // => \u4e2d\u5c71\u5e02\u4e1c\u533a\u7d2b\u9a6c\u516c\u56ed\u897f\u95e8\n'))),Object(r.b)(c.a,{value:"n",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var companyName = App.Configuration["AppInfo:Tier2:Tier3:Tier4...Tiern1:Tiern3..."]; // => \u4e2d\u5c71\u5e02\u4e1c\u533a\u7d2b\u9a6c\u516c\u56ed\u897f\u95e8\n')))),Object(r.b)("h2",{id:"414-\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6"},"4.1.4 \u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6"),Object(r.b)("p",null,"\u5927\u591a\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u7684\u914d\u7f6e\u53ea\u9700\u8981\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u914d\u7f6e\u5373\u53ef\uff0c\u4f46\u4e00\u4e9b\u7279\u6b8a\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5e0c\u671b\u67d0\u4e9b\u7ec4\u4ef6\u6216\u529f\u80fd\u62e5\u6709\u72ec\u7acb\u7684\u914d\u7f6e\uff0c\u8fd9\u4e2a\u65f6\u5019\u5c31\u9700\u8981\u7528\u5230\u81ea\u5b9a\u4e49\u914d\u7f6e\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u76ee\u524d\u652f\u6301 ",Object(r.b)("inlineCode",{parentName:"p"},".json")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},".xml")," \u4e24\u79cd\u65b9\u5f0f\u914d\u7f6e\uff0c\u5982\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-json",metastring:'{2-13} title="Fur.Web.Entry/emailsetting.json"',"{2-13}":!0,title:'"Fur.Web.Entry/emailsetting.json"'}),'{\n "outlook": {\n "smtp": {\n "server": "smtp.office365.com",\n "port": "587",\n "ssl": "STARTTLS"\n },\n "pop": {\n "server": "outlook.office365.com",\n "port": "995",\n "ssl": "TLS"\n }\n }\n}\n')),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-xml"}),'\n\n MyXMLFile Value\n \n Title from MyXMLFile\n Name from MyXMLFile\n \n \n \n Information\n Warning\n \n \n\n')),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"xml \u914d\u7f6e\u4e8b\u9879")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u5982\u679c\u91c7\u7528 ",Object(r.b)("inlineCode",{parentName:"p"},"xml")," \u914d\u7f6e\uff0c\u90a3\u4e48\u6587\u4ef6\u540d\u5fc5\u987b\u4ee5 ",Object(r.b)("inlineCode",{parentName:"p"},".config.xml")," \u7ed3\u5c3e\uff08\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff09\u3002"))),Object(r.b)("p",null,"\u540c\u65f6 ",Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u65b9\u5f0f\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u8bfb\u53d6\uff0c\u5982\uff1a"),Object(r.b)("h3",{id:"4141-\u8bfb\u53d6-emailsettingjson-\u914d\u7f6e"},"4.1.4.1 \u8bfb\u53d6 ",Object(r.b)("inlineCode",{parentName:"h3"},"emailsetting.json")," \u914d\u7f6e"),Object(r.b)("p",null,"\u8bfb\u53d6\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u548c\u8bfb\u53d6 ",Object(r.b)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e00\u81f4\uff0c\u7cfb\u7edf\u4f1a\u81ea\u52a8\u4ece\u591a\u4e2a\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5982\uff1a"),Object(r.b)(o.a,{defaultValue:"jtl",values:[{label:"App.Configuration[jsonKey]",value:"jtl"},{label:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",value:"ylzr"}],mdxType:"Tabs"},Object(r.b)(c.a,{value:"jtl",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var smtpServer = App.Configuration["outlook:smtp:server"]; // => smtp.office365.com\n'))),Object(r.b)(c.a,{value:"ylzr",mdxType:"TabItem"},Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs"}),'var smtpServer = _configuration["outlook:smtp:server"]; // => smtp.office365.com\n')))),Object(r.b)("div",{className:"admonition admonition-important alert alert--info"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u8bf4\u660e")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},Object(r.b)("inlineCode",{parentName:"p"},"Fur")," \u6846\u67b6\u4f1a\u5728\u542f\u52a8\u65f6\u81ea\u52a8\u626b\u63cf\u6bcf\u4e00\u4e2a\u9879\u76ee\u5c42\u6839\u76ee\u5f55\u4e0b\u7684 ",Object(r.b)("inlineCode",{parentName:"p"},"*.json")," \u548c ",Object(r.b)("inlineCode",{parentName:"p"},"*.xml")," \u6587\u4ef6\u52a0\u5165\u914d\u7f6e\u4e2d\u3002\u6240\u4ee5\u65e0\u9700\u624b\u5de5\u914d\u7f6e\u3002"))),Object(r.b)("h2",{id:"415-\u4e0d\u540c\u73af\u5883\u8bfb\u53d6"},"4.1.5 \u4e0d\u540c\u73af\u5883\u8bfb\u53d6"),Object(r.b)("p",null,"\u5728\u5b9e\u9645\u5e94\u7528\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u53ef\u80fd\u4f1a\u6839\u636e\u4e0d\u540c\u7684\u73af\u5883\u52a0\u8f7d\u4e0d\u540c\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5982 ",Object(r.b)("inlineCode",{parentName:"p"},"\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32"),"\u3002"),Object(r.b)("p",null,"\u8fd9\u65f6\u6211\u4eec\u53ea\u9700\u8981\u9075\u5faa\u7279\u5b9a\u547d\u540d\u89c4\u8303 ",Object(r.b)("inlineCode",{parentName:"p"},"{name}.{Environment}.json")," \u5373\u53ef\u3002\u5982\uff1a"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"appsettings.Development.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"appsettings.Staging.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"appsettings.Production.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"emailsetting.Development.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"emailsetting.Staging.json")),Object(r.b)("li",{parentName:"ul"},Object(r.b)("inlineCode",{parentName:"li"},"emailsetting.Production.json"))),Object(r.b)("p",null,"\u8fd9\u65f6\uff0c",Object(r.b)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4f1a\u5728\u5e94\u7528\u542f\u52a8\u65f6\u81ea\u52a8\u52a0\u8f7d\u4e0d\u540c\u73af\u5883\u7684\u914d\u7f6e\u6587\u4ef6\u3002"),Object(r.b)("h2",{id:"416-\u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09"},"4.1.6 \u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08",Object(r.b)("inlineCode",{parentName:"h2"},"\u70ed\u66f4\u65b0"),"\uff09"),Object(r.b)("p",null,"\u5728 ",Object(r.b)("inlineCode",{parentName:"p"},".NET Core")," \u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u914d\u7f6e\u652f\u6301\u66f4\u6539\u901a\u77e5\uff0c\u4e5f\u5c31\u662f\u70ed\u66f4\u65b0\u64cd\u4f5c\u3002",Object(r.b)("strong",{parentName:"p"},"\u4e00\u65e6\u76d1\u542c\u5230 ",Object(r.b)("inlineCode",{parentName:"strong"},"appsetting.json")," \u6216\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u53d1\u751f\u53d8\u52a8\uff0c\u5c31\u4f1a\u89e6\u53d1 ",Object(r.b)("inlineCode",{parentName:"strong"},"OnChange")," \u65b9\u6cd5"),"\u3002\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(r.b)("pre",null,Object(r.b)("code",Object(a.a)({parentName:"pre"},{className:"language-cs",metastring:"{2,4-5}","{2,4-5}":!0}),'var appInfoConfiguration = App.Configuration["AppInfo"];\nChangeToken.OnChange(() => appInfoConfiguration.GetReloadToken(), () =>\n{\n var name = appInfoConfiguration["Name"]; // \u5b9e\u65f6\u7684\u6700\u65b0\u503c\n var version = appInfoConfiguration["Version"]; // \u5b9e\u65f6\u7684\u6700\u65b0\u503c\n});\n')),Object(r.b)("h2",{id:"417-\u914d\u7f6e\u7684\u4f18\u7f3a\u70b9"},"4.1.7 \u914d\u7f6e\u7684\u4f18\u7f3a\u70b9"),Object(r.b)("ul",null,Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u4f18\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u80fd\u591f\u5728\u7cfb\u7edf\u8fd0\u884c\u65f6\u5feb\u901f\u8bfb\u53d6"),Object(r.b)("li",{parentName:"ul"},"\u65e0\u9700\u989d\u5916\u914d\u7f6e"))),Object(r.b)("li",{parentName:"ul"},Object(r.b)("p",{parentName:"li"},"\u7f3a\u70b9"),Object(r.b)("ul",{parentName:"li"},Object(r.b)("li",{parentName:"ul"},"\u5b58\u5728\u91cd\u590d\u8bfb\u53d6"),Object(r.b)("li",{parentName:"ul"},"\u901a\u8fc7\u786c\u7f16\u7801\u5b57\u7b26\u4e32\u8bfb\u53d6\uff0c\u5bb9\u6613\u51fa\u9519"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u80fd\u8bbe\u7f6e\u9ed8\u8ba4\u503c"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u80fd\u5728\u8fd0\u884c\u73af\u5883\u4e2d\u52a8\u6001\u914d\u7f6e"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u80fd\u9a8c\u8bc1\u914d\u7f6e\u6709\u6548\u6027"),Object(r.b)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u66f4\u6539\u901a\u77e5")))),Object(r.b)("h2",{id:"418-\u914d\u7f6e\u4f7f\u7528\u573a\u666f"},"4.1.8 \u914d\u7f6e\u4f7f\u7528\u573a\u666f"),Object(r.b)("p",null,"\u5982\u679c\u53ea\u9700\u8981",Object(r.b)("strong",{parentName:"p"},"\u4e00\u6b21\u6027\u8bfb\u53d6"),"\u914d\u7f6e\u4fe1\u606f\uff0c\u5219\u4f7f\u7528\u914d\u7f6e\uff0c\u5426\u5219\u5e94\u8be5\u4f7f\u7528 \u300a",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"/docs/options"}),"4.2 \u9009\u9879"),"\u300b\u4ee3\u66ff\u3002"),Object(r.b)("h2",{id:"419-\u53cd\u9988\u4e0e\u5efa\u8bae"},"4.1.9 \u53cd\u9988\u4e0e\u5efa\u8bae"),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u7ed9 Fur \u63d0 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://gitee.com/monksoul/Fur/issues/new?issue"}),"Issue"),"\u3002"))),Object(r.b)("hr",null),Object(r.b)("div",{className:"admonition admonition-note alert alert--secondary"},Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-heading"}),Object(r.b)("h5",{parentName:"div"},Object(r.b)("span",Object(a.a)({parentName:"h5"},{className:"admonition-icon"}),Object(r.b)("svg",Object(a.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(r.b)("path",Object(a.a)({parentName:"svg"},{fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"})))),"\u4e86\u89e3\u66f4\u591a")),Object(r.b)("div",Object(a.a)({parentName:"div"},{className:"admonition-content"}),Object(r.b)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",Object(r.b)("inlineCode",{parentName:"p"},"\u914d\u7f6e")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",Object(r.b)("a",Object(a.a)({parentName:"p"},{href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/?view=aspnetcore-5.0"}),"ASP.NET Core - \u914d\u7f6e")," \u7ae0\u8282\u3002"))))}m.isMDXComponent=!0},142:function(e,n,t){"use strict";t.d(n,"a",(function(){return s})),t.d(n,"b",(function(){return j}));var a=t(0),i=t.n(a);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function c(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var l=i.a.createContext({}),p=function(e){var n=i.a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):c(c({},n),e)),t},s=function(e){var n=p(e.components);return i.a.createElement(l.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},u=i.a.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,o=e.parentName,l=b(e,["components","mdxType","originalType","parentName"]),s=p(t),u=a,j=s["".concat(o,".").concat(u)]||s[u]||m[u]||r;return t?i.a.createElement(j,c(c({ref:n},l),{},{components:t})):i.a.createElement(j,c({ref:n},l))}));function j(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,o=new Array(r);o[0]=u;var c={};for(var b in n)hasOwnProperty.call(n,b)&&(c[b]=n[b]);c.originalType=e,c.mdxType="string"==typeof e?e:a,o[1]=c;for(var l=2;lfunction(e,n,t,{forcePrependBaseUrl:a=!1,absolute:r=!1}={}){if(!t)return t;if(t.startsWith("#"))return t;if(Object(i.b)(t))return t;if(a)return n+t;const o=t.startsWith(n)?t:n+t.replace(/^\//,"");return r?e+o:o}(n,e,t,a)}}function o(e,n={}){const{withBaseUrl:t}=r();return t(e,n)}},145:function(e,n,t){"use strict";function a(e){return!0===/^(\w*:|\/\/)/.test(e)}function i(e){return void 0!==e&&!a(e)}t.d(n,"b",(function(){return a})),t.d(n,"a",(function(){return i}))},146:function(e,n,t){"use strict";function a(e){var n,t,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;nn.value===e)&&O(e)}const f=e=>{O(e),null!=m&&j(m,e)},v=[],h=e=>{e.metaKey||e.altKey||e.ctrlKey||g(!0)},C=()=>{g(!1)};return Object(a.useEffect)(()=>{window.addEventListener("keydown",h),window.addEventListener("mousedown",C)},[]),i.a.createElement("div",null,i.a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:Object(o.a)("tabs",{"tabs--block":n})},s.map(({value:e,label:n})=>i.a.createElement("li",{role:"tab",tabIndex:0,"aria-selected":d===e,className:Object(o.a)("tabs__item",b.a.tabItem,{"tabs__item--active":d===e}),style:N?{}:{outline:"none"},key:e,ref:e=>v.push(e),onKeyDown:e=>{((e,n,t)=>{switch(t.keyCode){case p:((e,n)=>{const t=e.indexOf(n)+1;e[t]?e[t].focus():e[0].focus()})(e,n);break;case l:((e,n)=>{const t=e.indexOf(n)-1;e[t]?e[t].focus():e[e.length-1].focus()})(e,n)}})(v,e.target,e),h(e)},onFocus:()=>f(e),onClick:()=>{f(e),g(!1)},onPointerDown:()=>g(!1)},n))),i.a.createElement("div",{role:"tabpanel",className:"margin-vert--md"},a.Children.toArray(t).filter(e=>e.props.value===d)[0]))}},150:function(e,n,t){"use strict";var a=t(0),i=t.n(a);n.a=function(e){return i.a.createElement("div",null,e.children)}}}]); \ No newline at end of file diff --git a/docs/ece76bd1.73422ad5.js b/docs/ece76bd1.73422ad5.js deleted file mode 100644 index db7a62c9513..00000000000 --- a/docs/ece76bd1.73422ad5.js +++ /dev/null @@ -1 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[78],{132:function(e,a,t){"use strict";t.r(a);var n=t(2),r=t(0),l=t.n(r),c=t(146),s=t(153),m=t(151),i=t(143),u=t(144),o=t(133),E=t.n(o),g=[{title:l.a.createElement(l.a.Fragment,null,".NET 5 \u65b0\u8d77\u70b9"),imageUrl:"img/undraw_docusaurus_mountain.svg",description:l.a.createElement(l.a.Fragment,null,".NET 5 \u662f .NET \u7684\u91cd\u8981\u4e14\u4ee4\u4eba\u5174\u594b\u7684\u65b0\u65b9\u5411\u3002\u4f60\u4f1a\u770b\u5230 .NET \u53d8\u5f97\u66f4\u52a0\u7b80\u5355\uff0c\u4f46\u4e5f\u6709\u66f4\u5e7f\u6cdb\u7684\u529f\u80fd\u548c\u5b9e\u7528\u7a0b\u5e8f\u3002",l.a.createElement("strong",null,"\u6240\u6709\u65b0\u7684\u5f00\u53d1\u548c\u529f\u80fd\u90fd\u5c06\u662f .NET 5 \u7684\u4e00\u90e8\u5206\uff0c\u5305\u62ec\u65b0\u7684 C# \u7248\u672c"),"\u3002")},{title:l.a.createElement(l.a.Fragment,null,"\u201c\u516d\u7ea7\u201d \u67b6\u6784"),imageUrl:"img/undraw_docusaurus_tree.svg",description:l.a.createElement(l.a.Fragment,null,"Fur \u5728\u8bbe\u8ba1\u4e4b\u521d\u5c31\u79c9\u627f\u7740 \u201c\u516d\u6781\u201d \uff1a",l.a.createElement("strong",null,"\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u3001\u6781\u5c11\u4f9d\u8d56\u3001\u6781\u5c11\u914d\u7f6e\u3001\u6781\u5176\u7075\u6d3b\u3001\u6781\u6613\u7ef4\u62a4")," ","\u7684\u8bbe\u8ba1\u601d\u60f3\uff0c\u5728\u67b6\u6784\u8bbe\u8ba1\u4e0a\u505a\u4e86\u5927\u91cf\u7684\u4f18\u5316\uff0c\u652f\u6301\u5404\u4e2a\u80fd\u529b\u9636\u5c42\u6280\u672f\u5458\u6781\u901f\u4e0a\u624b\u3002")},{title:l.a.createElement(l.a.Fragment,null,"\u51b2\u4e00\u676f\u5496\u5561\u7684\u65f6\u95f4"),imageUrl:"img/undraw_docusaurus_react.svg",description:l.a.createElement(l.a.Fragment,null,"Fur \u9664\u4e86\u72ec\u5177\u521b\u65b0\u7684\u8bbe\u8ba1\u7406\u5ff5\u548c\u7075\u6d3b\u7684\u67b6\u6784\u8bbe\u8ba1\u4ee5\u5916\uff0c\u540c\u65f6\u8fd8\u7ed3\u5408\u4e86\u4e3b\u6d41\u7684\u654f\u6377\u5f00\u53d1\u6a21\u5f0f\u6253\u9020\u7684\u4e00\u6b3e\u6781\u901f\u5f00\u53d1\u6846\u67b6\u3002",l.a.createElement("strong",null,"\u53ea\u9700\u51b2\u5236\u4e00\u676f\u5496\u5561\u7684\u65f6\u95f4\u4fbf\u53ef\u5b8c\u6210\u5de5\u4f5c"),"\u3002")}];function d(e){var a=e.imageUrl,t=e.title,n=e.description,r=Object(u.a)(a);return l.a.createElement("div",{className:Object(c.a)("col col--4",E.a.feature)},r&&l.a.createElement("div",{className:"text--center"},l.a.createElement("img",{className:E.a.featureImage,src:r,alt:t})),l.a.createElement("h3",{className:Object(c.a)(E.a.featureTitle)},t),l.a.createElement("p",null,n))}a.default=function(){var e=Object(i.a)().siteConfig,a=void 0===e?{}:e;return l.a.createElement(s.a,{title:"Fur \u662f .NET 5 \u5e73\u53f0\u4e0b\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u7684 Web \u5e94\u7528\u6846\u67b6\u3002 "+a.title,description:"Fur \u662f .NET 5 \u5e73\u53f0\u4e0b\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u7684 Web \u5e94\u7528\u6846\u67b6\u3002"},l.a.createElement("header",{className:Object(c.a)("hero hero--primary",E.a.heroBanner)},l.a.createElement("div",{className:"container"},l.a.createElement("h1",{className:"hero__title"},l.a.createElement("img",{src:Object(u.a)("img/furlogo.png"),height:"80",style:{margin:"0 auto",display:"block"}})),l.a.createElement("p",{className:Object(c.a)("hero__subtitle",E.a.subtitle)},a.tagline),l.a.createElement("div",{className:E.a.buttons},l.a.createElement(m.a,{className:Object(c.a)("button button--outline button--secondary button--lg",E.a.getStarted),to:Object(u.a)("docs/get-start")},"\u4e00\u5206\u949f\u5165\u95e8")))),l.a.createElement("main",null,g&&g.length>0&&l.a.createElement("section",{className:E.a.features},l.a.createElement("div",{className:"container"},l.a.createElement("div",{className:"row"},g.map((function(e,a){return l.a.createElement(d,Object(n.a)({key:a},e))})))))))}},154:function(e,a,t){"use strict";var n=t(152);t.d(a,"a",(function(){return n.a}))}}]); \ No newline at end of file diff --git a/docs/ece76bd1.9c5d7374.js b/docs/ece76bd1.9c5d7374.js new file mode 100644 index 00000000000..dd1f7720fff --- /dev/null +++ b/docs/ece76bd1.9c5d7374.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[78,11],{132:function(e,a,t){"use strict";t.r(a);var n=t(2),r=t(0),l=t.n(r),c=t(146),s=t(153),m=t(152),i=t(143),u=t(144),o=t(133),E=t.n(o);const g=[{title:l.a.createElement(l.a.Fragment,null,".NET 5 \u65b0\u8d77\u70b9"),imageUrl:"img/undraw_docusaurus_mountain.svg",description:l.a.createElement(l.a.Fragment,null,".NET 5 \u662f .NET \u7684\u91cd\u8981\u4e14\u4ee4\u4eba\u5174\u594b\u7684\u65b0\u65b9\u5411\u3002\u4f60\u4f1a\u770b\u5230 .NET \u53d8\u5f97\u66f4\u52a0\u7b80\u5355\uff0c\u4f46\u4e5f\u6709\u66f4\u5e7f\u6cdb\u7684\u529f\u80fd\u548c\u5b9e\u7528\u7a0b\u5e8f\u3002",l.a.createElement("strong",null,"\u6240\u6709\u65b0\u7684\u5f00\u53d1\u548c\u529f\u80fd\u90fd\u5c06\u662f .NET 5 \u7684\u4e00\u90e8\u5206\uff0c\u5305\u62ec\u65b0\u7684 C# \u7248\u672c"),"\u3002")},{title:l.a.createElement(l.a.Fragment,null,"\u201c\u516d\u7ea7\u201d \u67b6\u6784"),imageUrl:"img/undraw_docusaurus_tree.svg",description:l.a.createElement(l.a.Fragment,null,"Fur \u5728\u8bbe\u8ba1\u4e4b\u521d\u5c31\u79c9\u627f\u7740 \u201c\u516d\u6781\u201d \uff1a",l.a.createElement("strong",null,"\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u3001\u6781\u5c11\u4f9d\u8d56\u3001\u6781\u5c11\u914d\u7f6e\u3001\u6781\u5176\u7075\u6d3b\u3001\u6781\u6613\u7ef4\u62a4")," ","\u7684\u8bbe\u8ba1\u601d\u60f3\uff0c\u5728\u67b6\u6784\u8bbe\u8ba1\u4e0a\u505a\u4e86\u5927\u91cf\u7684\u4f18\u5316\uff0c\u652f\u6301\u5404\u4e2a\u80fd\u529b\u9636\u5c42\u6280\u672f\u5458\u6781\u901f\u4e0a\u624b\u3002")},{title:l.a.createElement(l.a.Fragment,null,"\u51b2\u4e00\u676f\u5496\u5561\u7684\u65f6\u95f4"),imageUrl:"img/undraw_docusaurus_react.svg",description:l.a.createElement(l.a.Fragment,null,"Fur \u9664\u4e86\u72ec\u5177\u521b\u65b0\u7684\u8bbe\u8ba1\u7406\u5ff5\u548c\u7075\u6d3b\u7684\u67b6\u6784\u8bbe\u8ba1\u4ee5\u5916\uff0c\u540c\u65f6\u8fd8\u7ed3\u5408\u4e86\u4e3b\u6d41\u7684\u654f\u6377\u5f00\u53d1\u6a21\u5f0f\u6253\u9020\u7684\u4e00\u6b3e\u6781\u901f\u5f00\u53d1\u6846\u67b6\u3002",l.a.createElement("strong",null,"\u53ea\u9700\u51b2\u5236\u4e00\u676f\u5496\u5561\u7684\u65f6\u95f4\u4fbf\u53ef\u5b8c\u6210\u5de5\u4f5c"),"\u3002")}];function d({imageUrl:e,title:a,description:t}){const n=Object(u.a)(e);return l.a.createElement("div",{className:Object(c.a)("col col--4",E.a.feature)},n&&l.a.createElement("div",{className:"text--center"},l.a.createElement("img",{className:E.a.featureImage,src:n,alt:a})),l.a.createElement("h3",{className:Object(c.a)(E.a.featureTitle)},a),l.a.createElement("p",null,t))}a.default=function(){const e=Object(i.a)(),{siteConfig:a={}}=e;return l.a.createElement(s.a,{title:"Fur \u662f .NET 5 \u5e73\u53f0\u4e0b\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u7684 Web \u5e94\u7528\u6846\u67b6\u3002 "+a.title,description:"Fur \u662f .NET 5 \u5e73\u53f0\u4e0b\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u7684 Web \u5e94\u7528\u6846\u67b6\u3002"},l.a.createElement("header",{className:Object(c.a)("hero hero--primary",E.a.heroBanner)},l.a.createElement("div",{className:"container"},l.a.createElement("h1",{className:"hero__title"},l.a.createElement("img",{src:Object(u.a)("img/furlogo.png"),height:"80",style:{margin:"0 auto",display:"block"}})),l.a.createElement("p",{className:Object(c.a)("hero__subtitle",E.a.subtitle)},a.tagline),l.a.createElement("div",{className:E.a.buttons},l.a.createElement(m.a,{className:Object(c.a)("button button--outline button--secondary button--lg",E.a.getStarted),to:Object(u.a)("docs/get-start")},"\u4e00\u5206\u949f\u5165\u95e8")))),l.a.createElement("main",null,g&&g.length>0&&l.a.createElement("section",{className:E.a.features},l.a.createElement("div",{className:"container"},l.a.createElement("div",{className:"row"},g.map((e,a)=>l.a.createElement(d,Object(n.a)({key:a},e))))))))}},154:function(e,a,t){"use strict";var n=t(151);t.d(a,"a",(function(){return n.a}))}}]); \ No newline at end of file diff --git a/docs/f9353588.bfe4bdd2.js b/docs/f9353588.e30dce03.js similarity index 94% rename from docs/f9353588.bfe4bdd2.js rename to docs/f9353588.e30dce03.js index bdfb4305cc1..7d8dfa766a4 100644 --- a/docs/f9353588.bfe4bdd2.js +++ b/docs/f9353588.e30dce03.js @@ -1 +1 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[79],{134:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return s})),t.d(n,"metadata",(function(){return c})),t.d(n,"rightToc",(function(){return p})),t.d(n,"default",(function(){return b}));var r=t(2),a=t(6),i=(t(0),t(142)),o=t(144),s={id:"get-start",title:"2. \u4e00\u5206\u949f\u5165\u95e8",sidebar_label:"2. \u4e00\u5206\u949f\u5165\u95e8"},c={unversionedId:"get-start",id:"get-start",isDocsHomePage:!1,title:"2. \u4e00\u5206\u949f\u5165\u95e8",description:"2.1 Hello Fur",source:"@site/docs\\get-start.mdx",slug:"/get-start",permalink:"/docs/get-start",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/docs/get-start.mdx",version:"current",sidebar_label:"2. \u4e00\u5206\u949f\u5165\u95e8",sidebar:"docs",previous:{title:"1.4 \u9879\u76ee\u5f15\u7528",permalink:"/docs/reference"},next:{title:"3. \u5e94\u7528\u542f\u52a8",permalink:"/docs/appstartup"}},p=[{value:"2.1 Hello Fur",id:"21-hello-fur",children:[{value:"2.1.1 \u521b\u5efa FurService \u7c7b",id:"211-\u521b\u5efa-furservice-\u7c7b",children:[]},{value:"2.1.2 \u5728\u6d4f\u89c8\u5668\u4e2d\u67e5\u770b\u6548\u679c",id:"212-\u5728\u6d4f\u89c8\u5668\u4e2d\u67e5\u770b\u6548\u679c",children:[]}]},{value:"2.2 \u6dfb\u52a0\u6570\u636e\u5e93\u652f\u6301",id:"22-\u6dfb\u52a0\u6570\u636e\u5e93\u652f\u6301",children:[{value:"2.2.1 \u6dfb\u52a0 Person \u5b9e\u4f53\u7c7b",id:"221-\u6dfb\u52a0-person-\u5b9e\u4f53\u7c7b",children:[]},{value:"2.2.2 \u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"222-\u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"2.2.3 \u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"223-\u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"2.2.4 \u901a\u8fc7\u547d\u4ee4\u521b\u5efa\u6570\u636e\u5e93\u8868",id:"224-\u901a\u8fc7\u547d\u4ee4\u521b\u5efa\u6570\u636e\u5e93\u8868",children:[]}]},{value:"2.3 \u589e\u5220\u67e5\u6539\u5206\u9875\u4f8b\u5b50",id:"23-\u589e\u5220\u67e5\u6539\u5206\u9875\u4f8b\u5b50",children:[{value:"\u9644\u4e0a PersonDto",id:"\u9644\u4e0a-persondto",children:[]}]}],u={rightToc:p};function b(e){var n=e.components,t=Object(a.a)(e,["components"]);return Object(i.b)("wrapper",Object(r.a)({},u,t,{components:n,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"21-hello-fur"},"2.1 Hello Fur"),Object(i.b)("h3",{id:"211-\u521b\u5efa-furservice-\u7c7b"},"2.1.1 \u521b\u5efa ",Object(i.b)("inlineCode",{parentName:"h3"},"FurService")," \u7c7b"),Object(i.b)("p",null,"\u8bbe\u7f6e ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Web.Entry")," \u4e3a\u542f\u52a8\u9879\uff0c\u5e76\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Application")," \u4e2d\u521b\u5efa ",Object(i.b)("inlineCode",{parentName:"p"},"FurService")," \u7c7b\uff0c\u5e76\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9:"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,6,12}","{1,5,6,12}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [DynamicApiController] // \u8fd9\u91cc\u4f7f\u7528\u7279\u6027\u65b9\u5f0f\n public class FurService /*: IDynamicApiController*/ // \u4e5f\u53ef\u4ee5\u4f7f\u7528\u63a5\u53e3\u65b9\u5f0f\n {\n /// \n /// \u5411\u4e16\u754c\u95ee\u597d\n /// \n /// \n public string SayHello()\n {\n return $"Hello {nameof(Fur)}";\n }\n }\n}\n')),Object(i.b)("h3",{id:"212-\u5728\u6d4f\u89c8\u5668\u4e2d\u67e5\u770b\u6548\u679c"},"2.1.2 \u5728\u6d4f\u89c8\u5668\u4e2d\u67e5\u770b\u6548\u679c"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Web.Entry")," \u9879\u76ee\u4e2d\u9009\u62e9 ",Object(i.b)("inlineCode",{parentName:"p"},"wwwroot")," \u53f3\u952e\u9009\u62e9\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"\u6d4f\u89c8\u5668\u4e2d\u67e5\u770b")),Object(i.b)("img",{src:Object(o.a)("img/getstart1.png"),style:{height:400}}),Object(i.b)("p",null,"\u6548\u679c\u5982\u4e0b\uff1a"),Object(i.b)("img",{src:Object(o.a)("img/getstart2.gif")}),Object(i.b)("h2",{id:"22-\u6dfb\u52a0\u6570\u636e\u5e93\u652f\u6301"},"2.2 \u6dfb\u52a0\u6570\u636e\u5e93\u652f\u6301"),Object(i.b)("h3",{id:"221-\u6dfb\u52a0-person-\u5b9e\u4f53\u7c7b"},"2.2.1 \u6dfb\u52a0 ",Object(i.b)("inlineCode",{parentName:"h3"},"Person")," \u5b9e\u4f53\u7c7b"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Core")," \u4e2d\u65b0\u5efa ",Object(i.b)("inlineCode",{parentName:"p"},"Person")," \u5b9e\u4f53\u7c7b\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,7}","{1,7}":!0}),"using Fur.DatabaseAccessor;\nusing System;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Core\n{\n public class Person : Entity // \u7ee7\u627f\u81ea Entity \u62bd\u8c61\u7c7b\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public Person()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u59d3\u540d\n /// \n [MaxLength(32)]\n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n\n /// \n /// \u4f4f\u5740\n /// \n public string Address { get; set; }\n }\n}\n")),Object(i.b)("h3",{id:"222-\u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"2.2.2 \u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u4e2d\u6dfb\u52a0 ",Object(i.b)("inlineCode",{parentName:"p"},"FurDbContext")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{1-2,6-7,13}","{1-2,6-7,13}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Data Source=./Fur.db")] // \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32\n public class FurDbContext : AppDbContext // \u7ee7\u627f AppDbContext<> \u7c7b\n {\n /// \n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\n /// \n /// \n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(i.b)("h3",{id:"223-\u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"2.2.3 \u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"FurEntityFrameworkCoreStartup")," \u4e2d\u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:'{11-14} title="Fur\\framework\\Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"',"{11-14}":!0,title:'"Fur\\framework\\Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"'}),"using Fur.DatabaseAccessor;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n options.AddDbPool(DbProvider.Sqlite);\n });\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u8bf4\u660e")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6f14\u793a\u793a\u4f8b\u4e2d\uff0c\u9ed8\u8ba4\u5df2\u7ecf\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u5c42\u5b89\u88c5\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"Microsoft.EntityFrameworkCore.Sqlite")," \u5305\u3002"),Object(i.b)("p",{parentName:"div"},"\u5982\u679c\u4f60\u9700\u8981\u5b89\u88c5\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u7248\u672c\uff0c\u53ef\u4ee5\u67e5\u9605 \u3010",Object(i.b)("a",Object(r.a)({parentName:"p"},{href:"dbcontext-multi-database"}),"9.18 \u591a\u6570\u636e\u5e93\u64cd\u4f5c"),"\u3011 \u7ae0\u8282\u3002"))),Object(i.b)("h3",{id:"224-\u901a\u8fc7\u547d\u4ee4\u521b\u5efa\u6570\u636e\u5e93\u8868"},"2.2.4 \u901a\u8fc7\u547d\u4ee4\u521b\u5efa\u6570\u636e\u5e93\u8868"),Object(i.b)("p",null,"\u6253\u5f00 ",Object(i.b)("inlineCode",{parentName:"p"},"\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0"),"\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(o.a)("img/getstart3.png"),style:{height:400}}),Object(i.b)("p",null,"\u9009\u62e9 ",Object(i.b)("inlineCode",{parentName:"p"},"\u9ed8\u8ba4\u9879\u76ee\u4e3a"),"\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Database.Migrations"),"\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(o.a)("img/getstart4.png")}),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4"),"\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{}),"Add-Migration v0.0.1\n")),Object(i.b)("img",{src:Object(o.a)("img/getstart5.png")}),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"\u63d0\u4ea4\u5230\u6570\u636e\u5e93\u66f4\u6539")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{}),"Update-Database\n")),Object(i.b)("img",{src:Object(o.a)("img/getstart6.png")}),Object(i.b)("img",{src:Object(o.a)("img/getstart7.png"),style:{height:400}}),Object(i.b)("h2",{id:"23-\u589e\u5220\u67e5\u6539\u5206\u9875\u4f8b\u5b50"},"2.3 \u589e\u5220\u67e5\u6539\u5206\u9875\u4f8b\u5b50"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{14-19}","{14-19}":!0}),'using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DynamicApiController;\nusing Mapster;\nusing Microsoft.EntityFrameworkCore;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nnamespace Fur.Application\n{\n [DynamicApiController] // \u8fd9\u91cc\u4f7f\u7528\u7279\u6027\u65b9\u5f0f\n public class FurService /*: IDynamicApiController*/ // \u4e5f\u53ef\u4ee5\u4f7f\u7528\u63a5\u53e3\u65b9\u5f0f\n {\n // \u521d\u59cb\u5316\u4ed3\u50a8\n private readonly IRepository _personRepository;\n public FurService(IRepository personRepository)\n {\n _personRepository = personRepository;\n }\n\n /// \n /// \u65b0\u589e\u4e00\u6761\n /// \n public async Task Insert(PersonDto personDto)\n {\n // \u5982\u679c\u4e0d\u9700\u8981\u8fd4\u56de\u81ea\u589eId\uff0c\u4f7f\u7528 InsertAsync\u5373\u53ef\n var newEntity = await _personRepository.InsertNowAsync(personDto.Adapt());\n return newEntity.Entity.Id;\n\n // \u8fd8\u53ef\u4ee5\u76f4\u63a5\u64cd\u4f5c\n // await personDto.Adapt().InsertNowAsync();\n }\n\n /// \n /// \u66f4\u65b0\u4e00\u6761\n /// \n /// \n public async Task Update(PersonDto personDto)\n {\n await _personRepository.UpdateAsync(personDto.Adapt());\n\n // \u8fd8\u53ef\u4ee5\u76f4\u63a5\u64cd\u4f5c\n // await personDto.Adapt().UpdateAsync();\n }\n\n /// \n /// \u5220\u9664\u4e00\u6761\n /// \n /// \n public async Task Delete(int id)\n {\n await _personRepository.DeleteAsync(id);\n }\n\n /// \n /// \u67e5\u8be2\u4e00\u6761\n /// \n /// \n public async Task Find(int id)\n {\n var person = await _personRepository.FindAsync(id);\n return person.Adapt();\n }\n\n /// \n /// \u67e5\u8be2\u6240\u6709\n /// \n /// \n public async Task> GetAll()\n {\n var persons = await _personRepository.AsAsyncEnumerable();\n return persons.Adapt>();\n }\n\n /// \n /// \u5206\u9875\u67e5\u8be2\n /// \n /// \n /// \n /// \n public async Task> GetAllByPage(int pageIndex = 1, int pageSize = 10)\n {\n var pageResult = await _personRepository.AsQueryable().ToPagedListAsync(pageIndex, pageSize);\n return pageResult.Adapt>();\n }\n }\n}\n')),Object(i.b)("img",{src:Object(o.a)("img/getstart8.gif")}),Object(i.b)("h3",{id:"\u9644\u4e0a-persondto"},"\u9644\u4e0a ",Object(i.b)("inlineCode",{parentName:"h3"},"PersonDto")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"using System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Application\n{\n public class PersonDto\n {\n /// \n /// Id\n /// \n public int? Id { get; set; }\n\n /// \n /// \u59d3\u540d\n /// \n [StringLength(32, MinimumLength = 2)]\n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n }\n}\n")),Object(i.b)("p",null,"\u8bf4\u597d\u4e00\u5206\u949f\u5165\u95e8\uff0c\u4f60\u4eec\u7528\u4e86\u591a\u957f\u65f6\u95f4\u3002\ud83d\ude01"))}b.isMDXComponent=!0},142:function(e,n,t){"use strict";t.d(n,"a",(function(){return b})),t.d(n,"b",(function(){return d}));var r=t(0),a=t.n(r);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=a.a.createContext({}),u=function(e){var n=a.a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},b=function(e){var n=u(e.components);return a.a.createElement(p.Provider,{value:n},e.children)},l={inlineCode:"code",wrapper:function(e){var n=e.children;return a.a.createElement(a.a.Fragment,{},n)}},m=a.a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),b=u(t),m=r,d=b["".concat(o,".").concat(m)]||b[m]||l[m]||i;return t?a.a.createElement(d,s(s({ref:n},p),{},{components:t})):a.a.createElement(d,s({ref:n},p))}));function d(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=m;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var p=2;pFurService \u7c7b",id:"211-\u521b\u5efa-furservice-\u7c7b",children:[]},{value:"2.1.2 \u5728\u6d4f\u89c8\u5668\u4e2d\u67e5\u770b\u6548\u679c",id:"212-\u5728\u6d4f\u89c8\u5668\u4e2d\u67e5\u770b\u6548\u679c",children:[]}]},{value:"2.2 \u6dfb\u52a0\u6570\u636e\u5e93\u652f\u6301",id:"22-\u6dfb\u52a0\u6570\u636e\u5e93\u652f\u6301",children:[{value:"2.2.1 \u6dfb\u52a0 Person \u5b9e\u4f53\u7c7b",id:"221-\u6dfb\u52a0-person-\u5b9e\u4f53\u7c7b",children:[]},{value:"2.2.2 \u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"222-\u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"2.2.3 \u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",id:"223-\u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587",children:[]},{value:"2.2.4 \u901a\u8fc7\u547d\u4ee4\u521b\u5efa\u6570\u636e\u5e93\u8868",id:"224-\u901a\u8fc7\u547d\u4ee4\u521b\u5efa\u6570\u636e\u5e93\u8868",children:[]}]},{value:"2.3 \u589e\u5220\u67e5\u6539\u5206\u9875\u4f8b\u5b50",id:"23-\u589e\u5220\u67e5\u6539\u5206\u9875\u4f8b\u5b50",children:[{value:"\u9644\u4e0a PersonDto",id:"\u9644\u4e0a-persondto",children:[]}]}],u={rightToc:p};function b(e){var n=e.components,t=Object(a.a)(e,["components"]);return Object(i.b)("wrapper",Object(r.a)({},u,t,{components:n,mdxType:"MDXLayout"}),Object(i.b)("h2",{id:"21-hello-fur"},"2.1 Hello Fur"),Object(i.b)("h3",{id:"211-\u521b\u5efa-furservice-\u7c7b"},"2.1.1 \u521b\u5efa ",Object(i.b)("inlineCode",{parentName:"h3"},"FurService")," \u7c7b"),Object(i.b)("p",null,"\u8bbe\u7f6e ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Web.Entry")," \u4e3a\u542f\u52a8\u9879\uff0c\u5e76\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Application")," \u4e2d\u521b\u5efa ",Object(i.b)("inlineCode",{parentName:"p"},"FurService")," \u7c7b\uff0c\u5e76\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9:"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,5,6,12}","{1,5,6,12}":!0}),'using Fur.DynamicApiController;\n\nnamespace Fur.Application\n{\n [DynamicApiController] // \u8fd9\u91cc\u4f7f\u7528\u7279\u6027\u65b9\u5f0f\n public class FurService /*: IDynamicApiController*/ // \u4e5f\u53ef\u4ee5\u4f7f\u7528\u63a5\u53e3\u65b9\u5f0f\n {\n /// \n /// \u5411\u4e16\u754c\u95ee\u597d\n /// \n /// \n public string SayHello()\n {\n return $"Hello {nameof(Fur)}";\n }\n }\n}\n')),Object(i.b)("h3",{id:"212-\u5728\u6d4f\u89c8\u5668\u4e2d\u67e5\u770b\u6548\u679c"},"2.1.2 \u5728\u6d4f\u89c8\u5668\u4e2d\u67e5\u770b\u6548\u679c"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Web.Entry")," \u9879\u76ee\u4e2d\u9009\u62e9 ",Object(i.b)("inlineCode",{parentName:"p"},"wwwroot")," \u53f3\u952e\u9009\u62e9\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"\u6d4f\u89c8\u5668\u4e2d\u67e5\u770b")),Object(i.b)("img",{src:Object(o.a)("img/getstart1.png"),style:{height:400}}),Object(i.b)("p",null,"\u6548\u679c\u5982\u4e0b\uff1a"),Object(i.b)("img",{src:Object(o.a)("img/getstart2.gif")}),Object(i.b)("h2",{id:"22-\u6dfb\u52a0\u6570\u636e\u5e93\u652f\u6301"},"2.2 \u6dfb\u52a0\u6570\u636e\u5e93\u652f\u6301"),Object(i.b)("h3",{id:"221-\u6dfb\u52a0-person-\u5b9e\u4f53\u7c7b"},"2.2.1 \u6dfb\u52a0 ",Object(i.b)("inlineCode",{parentName:"h3"},"Person")," \u5b9e\u4f53\u7c7b"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Core")," \u4e2d\u65b0\u5efa ",Object(i.b)("inlineCode",{parentName:"p"},"Person")," \u5b9e\u4f53\u7c7b\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{1,7}","{1,7}":!0}),"using Fur.DatabaseAccessor;\nusing System;\nusing System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Core\n{\n public class Person : Entity // \u7ee7\u627f\u81ea Entity \u62bd\u8c61\u7c7b\n {\n /// \n /// \u6784\u9020\u51fd\u6570\n /// \n public Person()\n {\n CreatedTime = DateTime.Now;\n IsDeleted = false;\n }\n\n /// \n /// \u59d3\u540d\n /// \n [MaxLength(32)]\n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n\n /// \n /// \u4f4f\u5740\n /// \n public string Address { get; set; }\n }\n}\n")),Object(i.b)("h3",{id:"222-\u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"2.2.2 \u521b\u5efa\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u4e2d\u6dfb\u52a0 ",Object(i.b)("inlineCode",{parentName:"p"},"FurDbContext")," \u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{1-2,6-7,13}","{1-2,6-7,13}":!0}),'using Fur.DatabaseAccessor;\nusing Microsoft.EntityFrameworkCore;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppDbContext("Data Source=./Fur.db")] // \u914d\u7f6e\u8fde\u63a5\u5b57\u7b26\u4e32\n public class FurDbContext : AppDbContext // \u7ee7\u627f AppDbContext<> \u7c7b\n {\n /// \n /// \u7ee7\u627f\u7236\u7c7b\u6784\u9020\u51fd\u6570\n /// \n /// \n public FurDbContext(DbContextOptions options) : base(options)\n {\n }\n }\n}\n')),Object(i.b)("h3",{id:"223-\u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"},"2.2.3 \u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587"),Object(i.b)("p",null,"\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u7684 ",Object(i.b)("inlineCode",{parentName:"p"},"FurEntityFrameworkCoreStartup")," \u4e2d\u914d\u7f6e\u6570\u636e\u5e93\u4e0a\u4e0b\u6587\uff0c\u4ee3\u7801\u5982\u4e0b\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:'{11-14} title="Fur\\framework\\Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"',"{11-14}":!0,title:'"Fur\\framework\\Fur.EntityFramework.Core\\FurEntityFrameworkCoreStartup.cs"'}),"using Fur.DatabaseAccessor;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Fur.EntityFramework.Core\n{\n [AppStartup(600)]\n public sealed class FurEntityFrameworkCoreStartup : AppStartup\n {\n public void ConfigureServices(IServiceCollection services)\n {\n services.AddDatabaseAccessor(options =>\n {\n options.AddDbPool(DbProvider.Sqlite);\n });\n }\n }\n}\n")),Object(i.b)("div",{className:"admonition admonition-important alert alert--info"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})))),"\u7279\u522b\u8bf4\u660e")),Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-content"}),Object(i.b)("p",{parentName:"div"},Object(i.b)("inlineCode",{parentName:"p"},"Fur")," \u6f14\u793a\u793a\u4f8b\u4e2d\uff0c\u9ed8\u8ba4\u5df2\u7ecf\u5728 ",Object(i.b)("inlineCode",{parentName:"p"},"Fur.EntityFramework.Core")," \u5c42\u5b89\u88c5\u4e86 ",Object(i.b)("inlineCode",{parentName:"p"},"Microsoft.EntityFrameworkCore.Sqlite")," \u5305\u3002"),Object(i.b)("p",{parentName:"div"},"\u5982\u679c\u4f60\u9700\u8981\u5b89\u88c5\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u7248\u672c\uff0c\u53ef\u4ee5\u67e5\u9605 \u3010",Object(i.b)("a",Object(r.a)({parentName:"p"},{href:"dbcontext-multi-database"}),"9.18 \u591a\u6570\u636e\u5e93\u64cd\u4f5c"),"\u3011 \u7ae0\u8282\u3002"))),Object(i.b)("h3",{id:"224-\u901a\u8fc7\u547d\u4ee4\u521b\u5efa\u6570\u636e\u5e93\u8868"},"2.2.4 \u901a\u8fc7\u547d\u4ee4\u521b\u5efa\u6570\u636e\u5e93\u8868"),Object(i.b)("p",null,"\u6253\u5f00 ",Object(i.b)("inlineCode",{parentName:"p"},"\u7a0b\u5e8f\u5305\u7ba1\u7406\u63a7\u5236\u53f0"),"\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(o.a)("img/getstart3.png"),style:{height:400}}),Object(i.b)("p",null,"\u9009\u62e9 ",Object(i.b)("inlineCode",{parentName:"p"},"\u9ed8\u8ba4\u9879\u76ee\u4e3a"),"\uff1a",Object(i.b)("inlineCode",{parentName:"p"},"Fur.Database.Migrations"),"\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a"),Object(i.b)("img",{src:Object(o.a)("img/getstart4.png")}),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4"),"\uff1a"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{}),"Add-Migration v0.0.1\n")),Object(i.b)("img",{src:Object(o.a)("img/getstart5.png")}),Object(i.b)("p",null,Object(i.b)("strong",{parentName:"p"},"\u63d0\u4ea4\u5230\u6570\u636e\u5e93\u66f4\u6539")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{}),"Update-Database\n")),Object(i.b)("img",{src:Object(o.a)("img/getstart6.png")}),Object(i.b)("img",{src:Object(o.a)("img/getstart7.png"),style:{height:400}}),Object(i.b)("h2",{id:"23-\u589e\u5220\u67e5\u6539\u5206\u9875\u4f8b\u5b50"},"2.3 \u589e\u5220\u67e5\u6539\u5206\u9875\u4f8b\u5b50"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs",metastring:"{14-19}","{14-19}":!0}),'using Fur.Core;\nusing Fur.DatabaseAccessor;\nusing Fur.DynamicApiController;\nusing Mapster;\nusing Microsoft.EntityFrameworkCore;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\nnamespace Fur.Application\n{\n [DynamicApiController] // \u8fd9\u91cc\u4f7f\u7528\u7279\u6027\u65b9\u5f0f\n public class FurService /*: IDynamicApiController*/ // \u4e5f\u53ef\u4ee5\u4f7f\u7528\u63a5\u53e3\u65b9\u5f0f\n {\n // \u521d\u59cb\u5316\u4ed3\u50a8\n private readonly IRepository _personRepository;\n public FurService(IRepository personRepository)\n {\n _personRepository = personRepository;\n }\n\n /// \n /// \u65b0\u589e\u4e00\u6761\n /// \n public async Task Insert(PersonDto personDto)\n {\n // \u5982\u679c\u4e0d\u9700\u8981\u8fd4\u56de\u81ea\u589eId\uff0c\u4f7f\u7528 InsertAsync\u5373\u53ef\n var newEntity = await _personRepository.InsertNowAsync(personDto.Adapt());\n return newEntity.Entity.Id;\n\n // \u8fd8\u53ef\u4ee5\u76f4\u63a5\u64cd\u4f5c\n // await personDto.Adapt().InsertNowAsync();\n }\n\n /// \n /// \u66f4\u65b0\u4e00\u6761\n /// \n /// \n public async Task Update(PersonDto personDto)\n {\n await _personRepository.UpdateAsync(personDto.Adapt());\n\n // \u8fd8\u53ef\u4ee5\u76f4\u63a5\u64cd\u4f5c\n // await personDto.Adapt().UpdateAsync();\n }\n\n /// \n /// \u5220\u9664\u4e00\u6761\n /// \n /// \n public async Task Delete(int id)\n {\n await _personRepository.DeleteAsync(id);\n }\n\n /// \n /// \u67e5\u8be2\u4e00\u6761\n /// \n /// \n public async Task Find(int id)\n {\n var person = await _personRepository.FindAsync(id);\n return person.Adapt();\n }\n\n /// \n /// \u67e5\u8be2\u6240\u6709\n /// \n /// \n public async Task> GetAll()\n {\n var persons = await _personRepository.AsAsyncEnumerable();\n return persons.Adapt>();\n }\n\n /// \n /// \u5206\u9875\u67e5\u8be2\n /// \n /// \n /// \n /// \n public async Task> GetAllByPage(int pageIndex = 1, int pageSize = 10)\n {\n var pageResult = await _personRepository.AsQueryable().ToPagedListAsync(pageIndex, pageSize);\n return pageResult.Adapt>();\n }\n }\n}\n')),Object(i.b)("img",{src:Object(o.a)("img/getstart8.gif")}),Object(i.b)("h3",{id:"\u9644\u4e0a-persondto"},"\u9644\u4e0a ",Object(i.b)("inlineCode",{parentName:"h3"},"PersonDto")),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-cs"}),"using System.ComponentModel.DataAnnotations;\n\nnamespace Fur.Application\n{\n public class PersonDto\n {\n /// \n /// Id\n /// \n public int? Id { get; set; }\n\n /// \n /// \u59d3\u540d\n /// \n [StringLength(32, MinimumLength = 2)]\n public string Name { get; set; }\n\n /// \n /// \u5e74\u9f84\n /// \n public int Age { get; set; }\n }\n}\n")),Object(i.b)("p",null,"\u8bf4\u597d\u4e00\u5206\u949f\u5165\u95e8\uff0c\u4f60\u4eec\u7528\u4e86\u591a\u957f\u65f6\u95f4\u3002\ud83d\ude01"))}b.isMDXComponent=!0},142:function(e,n,t){"use strict";t.d(n,"a",(function(){return b})),t.d(n,"b",(function(){return d}));var r=t(0),a=t.n(r);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=a.a.createContext({}),u=function(e){var n=a.a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},b=function(e){var n=u(e.components);return a.a.createElement(p.Provider,{value:n},e.children)},l={inlineCode:"code",wrapper:function(e){var n=e.children;return a.a.createElement(a.a.Fragment,{},n)}},m=a.a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),b=u(t),m=r,d=b["".concat(o,".").concat(m)]||b[m]||l[m]||i;return t?a.a.createElement(d,s(s({ref:n},p),{},{components:t})):a.a.createElement(d,s({ref:n},p))}));function d(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=m;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var p=2;pfunction(e,n,t,{forcePrependBaseUrl:r=!1,absolute:i=!1}={}){if(!t)return t;if(t.startsWith("#"))return t;if(Object(a.b)(t))return t;if(r)return n+t;const o=t.startsWith(n)?t:n+t.replace(/^\//,"");return i?e+o:o}(n,e,t,r)}}function o(e,n={}){const{withBaseUrl:t}=i();return t(e,n)}},145:function(e,n,t){"use strict";function r(e){return!0===/^(\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}t.d(n,"b",(function(){return r})),t.d(n,"a",(function(){return a}))}}]); \ No newline at end of file diff --git a/docs/fa529204.0f5c487b.js b/docs/fa529204.1901aecb.js similarity index 100% rename from docs/fa529204.0f5c487b.js rename to docs/fa529204.1901aecb.js diff --git a/docs/index.html b/docs/index.html index 036b5e8f91d..cdfcb4e7d41 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,21 +5,33 @@ Fur 是 .NET 5 平台下极易入门、极速开发的 Web 应用框架。 Fur | Fur - - - - - - + + + + + + + + + + + +

Fur 是 .NET 5 平台下极易入门、极速开发的 Web 应用框架。

[object Object]

.NET 5 新起点

.NET 5 是 .NET 的重要且令人兴奋的新方向。你会看到 .NET 变得更加简单,但也有更广泛的功能和实用程序。所有新的开发和功能都将是 .NET 5 的一部分,包括新的 C# 版本

[object Object]

“六级” 架构

Fur 在设计之初就秉承着 “六极” :极易入门、极速开发、极少依赖、极少配置、极其灵活、极易维护 的设计思想,在架构设计上做了大量的优化,支持各个能力阶层技术员极速上手。

[object Object]

冲一杯咖啡的时间

Fur 除了独具创新的设计理念和灵活的架构设计以外,同时还结合了主流的敏捷开发模式打造的一款极速开发框架。只需冲制一杯咖啡的时间便可完成工作

- - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/main.2cb9d26e.js b/docs/main.2cb9d26e.js deleted file mode 100644 index 56e8cdd2ca8..00000000000 --- a/docs/main.2cb9d26e.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see main.2cb9d26e.js.LICENSE.txt */ -(window.webpackJsonp=window.webpackJsonp||[]).push([[83],[function(e,t,n){"use strict";e.exports=n(30)},function(e,t,n){"use strict";n.d(t,"a",(function(){return y})),n.d(t,"b",(function(){return E})),n.d(t,"c",(function(){return T})),n.d(t,"d",(function(){return _})),n.d(t,"e",(function(){return b})),n.d(t,"f",(function(){return L})),n.d(t,"g",(function(){return F})),n.d(t,"h",(function(){return g})),n.d(t,"i",(function(){return k})),n.d(t,"j",(function(){return C})),n.d(t,"k",(function(){return U})),n.d(t,"l",(function(){return j})),n.d(t,"m",(function(){return B})),n.d(t,"n",(function(){return z})),n.d(t,"o",(function(){return D}));var r=n(3),o=n(0),a=n.n(o),i=(n(7),n(5)),l=n(17),u=n(4),s=n(2),c=n(18),d=n.n(c),f=(n(23),n(6)),p=n(27),m=n.n(p),h=function(e){var t=Object(l.a)();return t.displayName=e,t}("Router-History"),g=function(e){var t=Object(l.a)();return t.displayName=e,t}("Router"),b=function(e){function t(t){var n;return(n=e.call(this,t)||this).state={location:t.history.location},n._isMounted=!1,n._pendingLocation=null,t.staticContext||(n.unlisten=t.history.listen((function(e){n._isMounted?n.setState({location:e}):n._pendingLocation=e}))),n}Object(r.a)(t,e),t.computeRootMatch=function(e){return{path:"/",url:"/",params:{},isExact:"/"===e}};var n=t.prototype;return n.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},n.componentWillUnmount=function(){this.unlisten&&this.unlisten()},n.render=function(){return a.a.createElement(g.Provider,{value:{history:this.props.history,location:this.state.location,match:t.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}},a.a.createElement(h.Provider,{children:this.props.children||null,value:this.props.history}))},t}(a.a.Component);var y=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o=0;f--){var p=i[f];"."===p?a(i,f):".."===p?(a(i,f),d++):d&&(a(i,f),d--)}if(!s)for(;d--;d)i.unshift("..");!s||""===i[0]||i[0]&&o(i[0])||i.unshift("");var m=i.join("/");return n&&"/"!==m.substr(-1)&&(m+="/"),m};function l(e){return e.valueOf?e.valueOf():Object.prototype.valueOf.call(e)}var u=function e(t,n){if(t===n)return!0;if(null==t||null==n)return!1;if(Array.isArray(t))return Array.isArray(n)&&t.length===n.length&&t.every((function(t,r){return e(t,n[r])}));if("object"==typeof t||"object"==typeof n){var r=l(t),o=l(n);return r!==t||o!==n?e(r,o):Object.keys(Object.assign({},t,n)).every((function(r){return e(t[r],n[r])}))}return!1},s=n(4);function c(e){return"/"===e.charAt(0)?e:"/"+e}function d(e){return"/"===e.charAt(0)?e.substr(1):e}function f(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function p(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function m(e){var t=e.pathname,n=e.search,r=e.hash,o=t||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}function h(e,t,n,o){var a;"string"==typeof e?(a=function(e){var t=e||"/",n="",r="",o=t.indexOf("#");-1!==o&&(r=t.substr(o),t=t.substr(0,o));var a=t.indexOf("?");return-1!==a&&(n=t.substr(a),t=t.substr(0,a)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e)).state=t:(void 0===(a=Object(r.a)({},e)).pathname&&(a.pathname=""),a.search?"?"!==a.search.charAt(0)&&(a.search="?"+a.search):a.search="",a.hash?"#"!==a.hash.charAt(0)&&(a.hash="#"+a.hash):a.hash="",void 0!==t&&void 0===a.state&&(a.state=t));try{a.pathname=decodeURI(a.pathname)}catch(l){throw l instanceof URIError?new URIError('Pathname "'+a.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):l}return n&&(a.key=n),o?a.pathname?"/"!==a.pathname.charAt(0)&&(a.pathname=i(a.pathname,o.pathname)):a.pathname=o.pathname:a.pathname||(a.pathname="/"),a}function g(e,t){return e.pathname===t.pathname&&e.search===t.search&&e.hash===t.hash&&e.key===t.key&&u(e.state,t.state)}function b(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,o){if(null!=e){var a="function"==typeof e?e(t,n):e;"string"==typeof a?"function"==typeof r?r(a,o):o(!0):o(!1!==a)}else o(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;rt?n.splice(t,n.length-t,o):n.push(o),d({action:r,location:o,index:t,entries:n})}}))},replace:function(e,t){var r="REPLACE",o=h(e,t,f(),E.location);c.confirmTransitionTo(o,r,n,(function(e){e&&(E.entries[E.index]=o,d({action:r,location:o}))}))},go:v,goBack:function(){v(-1)},goForward:function(){v(1)},canGo:function(e){var t=E.index+e;return t>=0&&t=0||(o[n]=e[n]);return o}n.d(t,"a",(function(){return r}))},function(e,t,n){e.exports=n(34)()},function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return u}));var r=n(1),o=n(2),a=n(0),i=n.n(a);function l(e,t,n){return void 0===n&&(n=[]),e.some((function(e){var o=e.path?Object(r.j)(t,e):n.length?n[n.length-1].match:r.e.computeRootMatch(t);return o&&(n.push({route:e,match:o}),e.routes&&l(e.routes,t,n)),o})),n}function u(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),e?i.a.createElement(r.g,n,e.map((function(e,n){return i.a.createElement(r.d,{key:e.key||n,path:e.path,exact:e.exact,strict:e.strict,render:function(n){return e.render?e.render(Object(o.a)({},n,{},t,{route:e})):i.a.createElement(e.component,Object(o.a)({},n,t,{route:e}))}})}))):null}},function(e,t,n){"use strict";n.r(t),t.default={title:"Fur",tagline:"Fur \u662f .NET 5 \u5e73\u53f0\u4e0b\u6781\u6613\u5165\u95e8\u3001\u6781\u901f\u5f00\u53d1\u7684 Web \u5e94\u7528\u6846\u67b6\u3002",url:"https://chinadot.net",baseUrl:"/",onBrokenLinks:"throw",favicon:"img/favicon.ico",organizationName:"Baiqian Co.,Ltd.",projectName:"Fur",themeConfig:{prism:{additionalLanguages:["powershell","csharp","sql"]},navbar:{title:"Fur",logo:{alt:"Fur Logo",src:"img/logo.png"},hideOnScroll:!1,items:[{type:"docsVersionDropdown",position:"left"},{to:"docs",activeBasePath:"docs",label:"\u6587\u6863",position:"left"},{to:"blog",label:"\u535a\u5ba2",position:"left"},{label:"\u914d\u7f6e",position:"left"},{label:"\u89c6\u9891",position:"right"},{label:"\u5de5\u5177",position:"right",items:[{label:"\u4ee3\u7801\u751f\u6210\u5668",position:"left"}]},{href:"https://gitee.com/monksoul/Fur/board",label:"\u770b\u677f",position:"right"},{label:"\u4ed3\u5e93",position:"right",items:[{label:"Gitee",href:"https://gitee.com/monksoul/Fur",position:"left"},{label:"GitHub",href:"https://github.com/MonkSoul/Fur",position:"left"}]}]},footer:{style:"dark",links:[{title:"\u6587\u6863",items:[{label:"\u5165\u95e8",to:"docs"},{label:"\u6307\u5357",to:"docs"}]},{title:"\u793e\u533a",items:[{label:"\u8ba8\u8bba",href:"https://gitee.com/monksoul/Fur/issues"},{label:"\u770b\u677f",href:"https://gitee.com/monksoul/Fur/board"}]},{title:"\u66f4\u591a",items:[{label:"\u535a\u5ba2",to:"blog"},{label:"\u4ed3\u5e93",href:"https://gitee.com/monksoul/Fur"}]}],copyright:"Copyright \xa9 2020 Fur, Baiqian Co.,Ltd."},colorMode:{defaultMode:"light",disableSwitch:!1,respectPrefersColorScheme:!1,switchConfig:{darkIcon:"\ud83c\udf1c",darkIconStyle:{},lightIcon:"\ud83c\udf1e",lightIconStyle:{}}},metadatas:[]},presets:[["@docusaurus/preset-classic",{docs:{sidebarPath:"D:\\MONK\\Fur\\handbook\\sidebars.js",editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/"},blog:{showReadingTime:!0,editUrl:"https://gitee.com/monksoul/Fur/tree/main/handbook/"},theme:{customCss:"D:\\MONK\\Fur\\handbook\\src\\css\\custom.css"}}]],onDuplicateRoutes:"warn",customFields:{},plugins:[],themes:[],titleDelimiter:"|"}},function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseIntersectionObserver:r&&"IntersectionObserver"in window,canUseViewport:r&&!!window.screen};t.a=o},function(e){e.exports=JSON.parse('{"/-d7d":{"component":"ece76bd1","config":"5e9f5e1a"},"/blog-c28":{"component":"a6aa9e1f","items":[{"content":"d3c206bc"}],"metadata":"5c4ee1d6"},"/blog/tags-929":{"component":"01a85c17","tags":"9958fd43"},"/blog/tags/fur-6f6":{"component":"6875c492","items":[{"content":"d3c206bc"}],"metadata":"d63edb86"},"/blog/tags/furos-29c":{"component":"6875c492","items":[{"content":"d3c206bc"}],"metadata":"4e3694ae"},"/blog/tags/net-f21":{"component":"6875c492","items":[{"content":"d3c206bc"}],"metadata":"fde1f028"},"/blog/tags/net-5-98a":{"component":"6875c492","items":[{"content":"d3c206bc"}],"metadata":"d631a3bf"},"/blog/tags/netcore-766":{"component":"6875c492","items":[{"content":"d3c206bc"}],"metadata":"ce4b3b2d"},"/blog/welcome-b88":{"component":"ccc49370","content":"3ab56fdf"},"/docs-5b5":{"component":"1be78505","versionMetadata":"f976f453"},"/docs/-901":{"component":"17896441","content":"4c30b939"},"/docs/answer-903":{"component":"17896441","content":"cb0a942e"},"/docs/appstartup-431":{"component":"17896441","content":"5ce0ebbd"},"/docs/auth-control-d15":{"component":"17896441","content":"904cf40b"},"/docs/author-fcf":{"component":"17896441","content":"b30e5fe3"},"/docs/cache-cd5":{"component":"17896441","content":"2ae73ff4"},"/docs/configuration-ae7":{"component":"17896441","content":"e6c62f29"},"/docs/contribute-2ed":{"component":"17896441","content":"7696a0ae"},"/docs/cors-d1d":{"component":"17896441","content":"70699f3e"},"/docs/data-validation-f02":{"component":"17896441","content":"17256d0f"},"/docs/dbcontext-44b":{"component":"17896441","content":"3e869f93"},"/docs/dbcontext-add-808":{"component":"17896441","content":"e6346b20"},"/docs/dbcontext-add-or-update-4cc":{"component":"17896441","content":"1d7b962e"},"/docs/dbcontext-audit-383":{"component":"17896441","content":"9bdac8f0"},"/docs/dbcontext-batch-b6c":{"component":"17896441","content":"1e961311"},"/docs/dbcontext-code-first-e5c":{"component":"17896441","content":"af3e9b99"},"/docs/dbcontext-db-first-931":{"component":"17896441","content":"902d8112"},"/docs/dbcontext-delete-d3d":{"component":"17896441","content":"d3ee75d5"},"/docs/dbcontext-filter-03c":{"component":"17896441","content":"4930ce4d"},"/docs/dbcontext-function-48e":{"component":"17896441","content":"a133dc31"},"/docs/dbcontext-hight-query-f75":{"component":"17896441","content":"4bfcf3ee"},"/docs/dbcontext-Interceptor-810":{"component":"17896441","content":"7b4b163f"},"/docs/dbcontext-locator-b4b":{"component":"17896441","content":"b80c29d5"},"/docs/dbcontext-multi-database-f7d":{"component":"17896441","content":"59d16f51"},"/docs/dbcontext-proc-78e":{"component":"17896441","content":"1761adf3"},"/docs/dbcontext-query-8f7":{"component":"17896441","content":"7c7b3a8a"},"/docs/dbcontext-read-write-624":{"component":"17896441","content":"4dbcf072"},"/docs/dbcontext-repository-f08":{"component":"17896441","content":"d43b3010"},"/docs/dbcontext-seed-data-9d3":{"component":"17896441","content":"2a4cb773"},"/docs/dbcontext-sql-551":{"component":"17896441","content":"dc10b9c8"},"/docs/dbcontext-sql-proxy-abd":{"component":"17896441","content":"d8f92c54"},"/docs/dbcontext-sql-template-65b":{"component":"17896441","content":"d8c8d2dc"},"/docs/dbcontext-update-dd1":{"component":"17896441","content":"17666df9"},"/docs/dbcontext-view-ec0":{"component":"17896441","content":"408ae89d"},"/docs/dependency-injection-a12":{"component":"17896441","content":"5e077782"},"/docs/deploy-8ea":{"component":"17896441","content":"b0be1305"},"/docs/devops-2bf":{"component":"17896441","content":"a688d5cc"},"/docs/dynamic-api-controller-4ba":{"component":"17896441","content":"0ddd808e"},"/docs/entity-f2d":{"component":"17896441","content":"8231c802"},"/docs/errors-303":{"component":"17896441","content":"654ac364"},"/docs/event-bus-89c":{"component":"17896441","content":"2b04a543"},"/docs/friendly-exception-4b5":{"component":"17896441","content":"62953dcd"},"/docs/get-start-e3d":{"component":"17896441","content":"f9353588"},"/docs/gooduse-9d8":{"component":"17896441","content":"d80bb0e0"},"/docs/grpc-bc2":{"component":"17896441","content":"2792faa0"},"/docs/http-6f4":{"component":"17896441","content":"36793c62"},"/docs/job-90d":{"component":"17896441","content":"97c3ef29"},"/docs/local-language-fbb":{"component":"17896441","content":"24dcd402"},"/docs/logging-7ec":{"component":"17896441","content":"a74774ac"},"/docs/object-mapper-86e":{"component":"17896441","content":"7d3779e7"},"/docs/options-fc3":{"component":"17896441","content":"e1713ffa"},"/docs/performance-d8c":{"component":"17896441","content":"c456980b"},"/docs/process-service-1d4":{"component":"17896441","content":"e50e61ad"},"/docs/reference-050":{"component":"17896441","content":"8bbf9761"},"/docs/saas-226":{"component":"17896441","content":"1ea356f4"},"/docs/signalr-8ba":{"component":"17896441","content":"8e2b7b33"},"/docs/source-e6d":{"component":"17896441","content":"34420422"},"/docs/specification-document-bee":{"component":"17896441","content":"e0678751"},"/docs/split-db-026":{"component":"17896441","content":"03ebb857"},"/docs/tran-260":{"component":"17896441","content":"dea2fede"},"/docs/unittest-98b":{"component":"17896441","content":"3a6dbab2"},"/docs/view-engine-8d2":{"component":"17896441","content":"fa529204"}}')},function(e,t,n){var r,o;void 0===(o="function"==typeof(r=function(){var e,t,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
'};function o(e,t,n){return en?n:e}function a(e){return 100*(-1+e)}function i(e,t,n){var o;return(o="translate3d"===r.positionUsing?{transform:"translate3d("+a(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+a(e)+"%,0)"}:{"margin-left":a(e)+"%"}).transition="all "+t+"ms "+n,o}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=o(e,r.minimum,1),n.status=1===e?null:e;var a=n.render(!t),s=a.querySelector(r.barSelector),c=r.speed,d=r.easing;return a.offsetWidth,l((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),u(s,i(e,c,d)),1===e?(u(a,{transition:"none",opacity:1}),a.offsetWidth,setTimeout((function(){u(a,{transition:"all "+c+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),c)}),c)):setTimeout(t,c)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*o(Math.random()*t,.1,.95)),t=o(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");c(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var o,i=t.querySelector(r.barSelector),l=e?"-100":a(n.status||0),s=document.querySelector(r.parent);return u(i,{transition:"all 0 linear",transform:"translate3d("+l+"%,0,0)"}),r.showSpinner||(o=t.querySelector(r.spinnerSelector))&&p(o),s!=document.body&&c(s,"nprogress-custom-parent"),s.appendChild(t),t},n.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&p(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var l=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),u=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function r(t){var n=document.body.style;if(t in n)return t;for(var r,o=e.length,a=t.charAt(0).toUpperCase()+t.slice(1);o--;)if((r=e[o]+a)in n)return r;return t}function o(e){return e=n(e),t[e]||(t[e]=r(e))}function a(e,t,n){t=o(t),e.style[t]=n}return function(e,t){var n,r,o=arguments;if(2==o.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&a(e,n,r);else a(e,o[1],o[2])}}();function s(e,t){return("string"==typeof e?e:f(e)).indexOf(" "+t+" ")>=0}function c(e,t){var n=f(e),r=n+t;s(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=f(e);s(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function f(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function p(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n})?r.call(t,n,t,e):r)||(e.exports=o)},function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return f})),n.d(t,"c",(function(){return y})),n.d(t,"e",(function(){return w}));var r=n(1);n.d(t,"d",(function(){return r.a})),n.d(t,"f",(function(){return r.b})),n.d(t,"g",(function(){return r.c})),n.d(t,"h",(function(){return r.d})),n.d(t,"i",(function(){return r.e})),n.d(t,"j",(function(){return r.f})),n.d(t,"k",(function(){return r.g})),n.d(t,"l",(function(){return r.i})),n.d(t,"m",(function(){return r.j})),n.d(t,"n",(function(){return r.k})),n.d(t,"o",(function(){return r.l})),n.d(t,"p",(function(){return r.m})),n.d(t,"q",(function(){return r.n})),n.d(t,"r",(function(){return r.o}));var o=n(3),a=n(0),i=n.n(a),l=n(5),u=(n(7),n(2)),s=n(6),c=n(4),d=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;oe.length)return;if(!(w instanceof u)){if(h&&v!=t.length-1){if(f.lastIndex=E,!(C=f.exec(e)))break;for(var x=C.index+(m?C[1].length:0),k=C.index+C[0].length,T=v,S=E,O=t.length;T=(S+=t[T].length)&&(++v,E=S);if(t[v]instanceof u)continue;_=T-v,w=e.slice(E,S),C.index-=E}else{f.lastIndex=0;var C=f.exec(w),_=1}if(C){m&&(g=C[1]?C[1].length:0),k=(x=C.index+g)+(C=C[0].slice(g)).length;var N=w.slice(0,x),R=w.slice(k),I=[v,_];N&&(++v,E+=N.length,I.push(N));var A=new u(s,p?o.tokenize(C,p):C,b,C,h);if(I.push(A),R&&I.push(R),Array.prototype.splice.apply(t,I),1!=_&&o.matchGrammar(e,t,n,v,E,!0,s),i)break}else if(i)break}}}}},hooks:{add:function(){}},tokenize:function(e,t,n){var r=[e],a=t.rest;if(a){for(var i in a)t[i]=a[i];delete t.rest}return o.matchGrammar(e,r,t,0,0,!1),r}},(a=o.Token=function(e,t,n,r,o){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length,this.greedy=!!o}).stringify=function(e,t,n){if("string"==typeof e)return e;if("Array"===o.util.type(e))return e.map((function(n){return a.stringify(n,t,e)})).join("");var r={type:e.type,content:a.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n};if(e.alias){var i="Array"===o.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(r.classes,i)}var l=Object.keys(r.attributes).map((function(e){return e+'="'+(r.attributes[e]||"").replace(/"/g,""")+'"'})).join(" ");return"<"+r.tag+' class="'+r.classes.join(" ")+'"'+(l?" "+l:"")+">"+r.content+""},o);i.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},i.languages.markup.tag.inside["attr-value"].inside.entity=i.languages.markup.entity,i.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(i.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:i.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:i.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[\s\S]*?>)(?:\s*|[\s\S])*?(?=<\/__>)/.source.replace(/__/g,e),"i"),lookbehind:!0,greedy:!0,inside:r},i.languages.insertBefore("markup","cdata",o)}}),i.languages.xml=i.languages.extend("markup",{}),i.languages.html=i.languages.markup,i.languages.mathml=i.languages.markup,i.languages.svg=i.languages.markup,function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)\w+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b\w+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+?)\s*(?:\r?\n|\r)(?:[\s\S])*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:n},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s*(?:\r?\n|\r)(?:[\s\S])*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0},{pattern:/(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/,greedy:!0,inside:n}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:n.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|aptitude|apt-cache|apt-get|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|pwd|readonly|return|shift|test|times|trap|umask|unset|alias|bind|builtin|caller|command|declare|echo|enable|help|let|local|logout|mapfile|printf|read|readarray|source|type|typeset|ulimit|unalias|set|shopt)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|==?|!=?|=~|<<[<-]?|[&\d]?>>|\d?[<>]&?|&[>&]?|\|[&|]?|<=?|>=?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}};for(var r=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=n.variable[1].inside,a=0;a=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},i.languages.c=i.languages.extend("clike",{"class-name":{pattern:/(\b(?:enum|struct)\s+)\w+/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/,number:/(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i}),i.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,lookbehind:!0},directive:{pattern:/(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,lookbehind:!0,alias:"keyword"}}},constant:/\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/}),delete i.languages.c.boolean,i.languages.cpp=i.languages.extend("c",{"class-name":{pattern:/(\b(?:class|enum|struct)\s+)\w+/,lookbehind:!0},keyword:/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+\.?[\da-f']*|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+\.?[\d']*|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]*/i,greedy:!0},operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:true|false)\b/}),i.languages.insertBefore("cpp","string",{"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/,inside:{rule:/@[\w-]+/}},url:{pattern:RegExp("url\\((?:"+t.source+"|[^\n\r()]*)\\)","i"),inside:{function:/^url/i,punctuation:/^\(|\)$/}},selector:RegExp("[^{}\\s](?:[^{};\"']|"+t.source+")*?(?=\\s*\\{)"),string:{pattern:t,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),e.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:n.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:e.languages.css}},alias:"language-css"}},n.tag))}(i),i.languages.css.selector={pattern:i.languages.css.selector,inside:{"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-:.\w]+/,id:/#[-:.\w]+/,attribute:{pattern:/\[(?:[^[\]"']|("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1)*\]/,greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},attribute:{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},value:[/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],punctuation:/[()]/}},i.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}}),i.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:/#[\da-f]{3,8}/i,entity:/\\[\da-f]{1,8}/i,unit:{pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},number:/-?[\d.]+/}),i.languages.javascript=i.languages.extend("clike",{"class-name":[i.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,function:/#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,operator:/-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),i.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,i.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,lookbehind:!0,inside:i.languages.javascript},{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,inside:i.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,lookbehind:!0,inside:i.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,lookbehind:!0,inside:i.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),i.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:i.languages.javascript}},string:/[\s\S]+/}}}),i.languages.markup&&i.languages.markup.tag.addInlined("script","javascript"),i.languages.js=i.languages.javascript,function(e){var t=e.util.clone(e.languages.javascript);e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=/<\/?(?:[\w.:-]+\s*(?:\s+(?:[\w.:-]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s{'">=]+|\{(?:\{(?:\{[^}]*\}|[^{}])*\}|[^{}])+\}))?|\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}))*\s*\/?)?>/i,e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/i,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">]+)/i,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.insertBefore("inside","attr-name",{spread:{pattern:/\{\.{3}[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\}/,inside:{punctuation:/\.{3}|[{}.]/,"attr-value":/\w+/}}},e.languages.jsx.tag),e.languages.insertBefore("inside","attr-value",{script:{pattern:/=(\{(?:\{(?:\{[^}]*\}|[^}])*\}|[^}])+\})/i,inside:{"script-punctuation":{pattern:/^=(?={)/,alias:"punctuation"},rest:e.languages.jsx},alias:"language-javascript"}},e.languages.jsx.tag);var n=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(n).join(""):""},r=function(t){for(var o=[],a=0;a0&&o[o.length-1].tagName===n(i.content[0].content[1])&&o.pop():"/>"===i.content[i.content.length-1].content||o.push({tagName:n(i.content[0].content[1]),openedBraces:0}):o.length>0&&"punctuation"===i.type&&"{"===i.content?o[o.length-1].openedBraces++:o.length>0&&o[o.length-1].openedBraces>0&&"punctuation"===i.type&&"}"===i.content?o[o.length-1].openedBraces--:l=!0),(l||"string"==typeof i)&&o.length>0&&0===o[o.length-1].openedBraces){var u=n(i);a0&&("string"==typeof t[a-1]||"plain-text"===t[a-1].type)&&(u=n(t[a-1])+u,t.splice(a-1,1),a--),t[a]=new e.Token("plain-text",u,null,u)}i.content&&"string"!=typeof i.content&&r(i.content)}};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||r(e.tokens)}))}(i),function(e){var t=e.languages.javadoclike={parameter:{pattern:/(^\s*(?:\/{3}|\*|\/\*\*)\s*@(?:param|arg|arguments)\s+)\w+/m,lookbehind:!0},keyword:{pattern:/(^\s*(?:\/{3}|\*|\/\*\*)\s*|\{)@[a-z][a-zA-Z-]+\b/m,lookbehind:!0},punctuation:/[{}]/};Object.defineProperty(t,"addSupport",{value:function(t,n){"string"==typeof t&&(t=[t]),t.forEach((function(t){!function(t,n){var r="doc-comment",o=e.languages[t];if(o){var a=o[r];if(!a){var i={"doc-comment":{pattern:/(^|[^\\])\/\*\*[^/][\s\S]*?(?:\*\/|$)/,alias:"comment"}};a=(o=e.languages.insertBefore(t,"comment",i))[r]}if(a instanceof RegExp&&(a=o[r]={pattern:a}),Array.isArray(a))for(var l=0,u=a.length;l>>?=?|->|([-+&|])\2|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0}}),e.languages.insertBefore("java","class-name",{annotation:{alias:"punctuation",pattern:/(^|[^.])@\w+/,lookbehind:!0},namespace:{pattern:/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)[a-z]\w*(\.[a-z]\w*)+/,lookbehind:!0,inside:{punctuation:/\./}},generics:{pattern:/<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,inside:{"class-name":n,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}}})}(i),function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,o,a){if(n.language===r){var i=n.tokenStack=[];n.code=n.code.replace(o,(function(e){if("function"==typeof a&&!a(e))return e;for(var o,l=i.length;-1!==n.code.indexOf(o=t(r,l));)++l;return i[l]=e,o})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var o=0,a=Object.keys(n.tokenStack);!function i(l){for(var u=0;u=a.length);u++){var s=l[u];if("string"==typeof s||s.content&&"string"==typeof s.content){var c=a[o],d=n.tokenStack[c],f="string"==typeof s?s:s.content,p=t(r,c),m=f.indexOf(p);if(m>-1){++o;var h=f.substring(0,m),g=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),b=f.substring(m+p.length),y=[];h&&y.push.apply(y,i([h])),y.push(g),b&&y.push.apply(y,i([b])),"string"==typeof s?l.splice.apply(l,[u,1].concat(y)):s.content=y}}else s.content&&i(s.content)}return l}(n.tokens)}}}})}(i),function(e){e.languages.php=e.languages.extend("clike",{keyword:/\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|new|or|parent|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i,boolean:{pattern:/\b(?:false|true)\b/i,alias:"constant"},constant:[/\b[A-Z_][A-Z0-9_]*\b/,/\b(?:null)\b/i],comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0}}),e.languages.insertBefore("php","string",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),e.languages.insertBefore("php","comment",{delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"}}),e.languages.insertBefore("php","keyword",{variable:/\$+(?:\w+\b|(?={))/i,package:{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),e.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}});var t={pattern:/{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/,lookbehind:!0,inside:{rest:e.languages.php}};e.languages.insertBefore("php","string",{"nowdoc-string":{pattern:/<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/,greedy:!0,alias:"string",inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},"heredoc-string":{pattern:/<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i,greedy:!0,alias:"string",inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:t}},"single-quoted-string":{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0,alias:"string"},"double-quoted-string":{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,alias:"string",inside:{interpolation:t}}}),delete e.languages.php.string,e.hooks.add("before-tokenize",(function(t){if(/<\?/.test(t.code)){e.languages["markup-templating"].buildPlaceholders(t,"php",/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#)(?:[^?\n\r]|\?(?!>))*|\/\*[\s\S]*?(?:\*\/|$))*?(?:\?>|$)/gi)}})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"php")}))}(i),function(e){var t=e.languages.javascript,n=/{(?:[^{}]|{(?:[^{}]|{[^{}]*})*})+}/.source,r="(@(?:param|arg|argument|property)\\s+(?:"+n+"\\s+)?)";e.languages.jsdoc=e.languages.extend("javadoclike",{parameter:{pattern:RegExp(r+/[$\w\xA0-\uFFFF.]+(?=\s|$)/.source),lookbehind:!0,inside:{punctuation:/\./}}}),e.languages.insertBefore("jsdoc","keyword",{"optional-parameter":{pattern:RegExp(r+/\[[$\w\xA0-\uFFFF.]+(?:=[^[\]]+)?\](?=\s|$)/.source),lookbehind:!0,inside:{parameter:{pattern:/(^\[)[$\w\xA0-\uFFFF\.]+/,lookbehind:!0,inside:{punctuation:/\./}},code:{pattern:/(=)[\s\S]*(?=\]$)/,lookbehind:!0,inside:t,alias:"language-javascript"},punctuation:/[=[\]]/}},"class-name":[{pattern:RegExp("(@[a-z]+\\s+)"+n),lookbehind:!0,inside:{punctuation:/[.,:?=<>|{}()[\]]/}},{pattern:/(@(?:augments|extends|class|interface|memberof!?|this)\s+)[A-Z]\w*(?:\.[A-Z]\w*)*/,lookbehind:!0,inside:{punctuation:/\./}}],example:{pattern:/(@example\s+)[^@]+?(?=\s*(?:\*\s*)?(?:@\w|\*\/))/,lookbehind:!0,inside:{code:{pattern:/^(\s*(?:\*\s*)?).+$/m,lookbehind:!0,inside:t,alias:"language-javascript"}}}}),e.languages.javadoclike.addSupport("javascript",e.languages.jsdoc)}(i),i.languages.actionscript=i.languages.extend("javascript",{keyword:/\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,operator:/\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=?)=?|[~?@]/}),i.languages.actionscript["class-name"].alias="function",i.languages.markup&&i.languages.insertBefore("actionscript","string",{xml:{pattern:/(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/,lookbehind:!0,inside:{rest:i.languages.markup}}}),function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},rest:e.languages.javascript}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(i),function(e){e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:(?:Uint|Int)(?:8|16|32)|Uint8Clamped|Float(?:32|64))?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|(?:Weak)?(?:Set|Map)|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:/(\.\s*)#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*/,lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|location|navigator|performance|(?:local|session)Storage|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var t=["function","function-variable","method","method-variable","property-access"],n=0;n))/i,delete e.languages.flow.parameter,e.languages.insertBefore("flow","operator",{"flow-punctuation":{pattern:/\{\||\|\}/,alias:"punctuation"}}),Array.isArray(e.languages.flow.keyword)||(e.languages.flow.keyword=[e.languages.flow.keyword]),e.languages.flow.keyword.unshift({pattern:/(^|[^$]\b)(?:type|opaque|declare|Class)\b(?!\$)/,lookbehind:!0},{pattern:/(^|[^$]\B)\$(?:await|Diff|Exact|Keys|ObjMap|PropertyType|Shape|Record|Supertype|Subtype|Enum)\b(?!\$)/,lookbehind:!0})}(i),i.languages.n4js=i.languages.extend("javascript",{keyword:/\b(?:any|Array|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/}),i.languages.insertBefore("n4js","constant",{annotation:{pattern:/@+\w+/,alias:"operator"}}),i.languages.n4jsd=i.languages.n4js,i.languages.typescript=i.languages.extend("javascript",{keyword:/\b(?:abstract|as|async|await|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|is|keyof|let|module|namespace|new|null|of|package|private|protected|public|readonly|return|require|set|static|super|switch|this|throw|try|type|typeof|var|void|while|with|yield)\b/,builtin:/\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/}),i.languages.ts=i.languages.typescript,function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,o=r.inside["interpolation-punctuation"],a=r.pattern.source;function i(t,r){if(e.languages[t])return{pattern:RegExp("((?:"+r+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function l(e,t){return"___"+t.toUpperCase()+"_"+e+"___"}function u(t,n,r){var o={code:t,grammar:n,language:r};return e.hooks.run("before-tokenize",o),o.tokens=e.tokenize(o.code,o.grammar),e.hooks.run("after-tokenize",o),o.tokens}function s(t){var n={};n["interpolation-punctuation"]=o;var a=e.tokenize(t,n);if(3===a.length){var i=[1,1];i.push.apply(i,u(a[1],e.languages.javascript,"javascript")),a.splice.apply(a,i)}return new e.Token("interpolation",a,r.alias,t)}function c(t,n,r){var o=e.tokenize(t,{interpolation:{pattern:RegExp(a),lookbehind:!0}}),i=0,c={},d=u(o.map((function(e){if("string"==typeof e)return e;for(var n,o=e.content;-1!==t.indexOf(n=l(i++,r)););return c[n]=o,n})).join(""),n,r),f=Object.keys(c);return i=0,function e(t){for(var n=0;n=f.length)return;var r=t[n];if("string"==typeof r||"string"==typeof r.content){var o=f[i],a="string"==typeof r?r:r.content,l=a.indexOf(o);if(-1!==l){++i;var u=a.substring(0,l),d=s(c[o]),p=a.substring(l+o.length),m=[];if(u&&m.push(u),m.push(d),p){var h=[p];e(h),m.push.apply(m,h)}"string"==typeof r?(t.splice.apply(t,[n,1].concat(m)),n+=m.length-1):r.content=m}}else{var g=r.content;Array.isArray(g)?e(g):e([g])}}}(d),new e.Token(r,d,"language-"+r,t)}e.languages.javascript["template-string"]=[i("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),i("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),i("svg",/\bsvg/.source),i("markdown",/\b(?:md|markdown)/.source),i("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),t].filter(Boolean);var d={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function f(e){return"string"==typeof e?e:Array.isArray(e)?e.map(f).join(""):f(e.content)}e.hooks.add("after-tokenize",(function(t){t.language in d&&function t(n){for(var r=0,o=n.length;r/g,t),n&&(e=e+"|"+e.replace(/_/g,"\\*")),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``.+?``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\r?\n|\r)|$)/.source.replace(/__/g,r),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\r?\n|\r)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+a+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+a+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/(^[ \t]*(?:\r?\n|\r))(?: {4}|\t).+(?:(?:\r?\n|\r)(?: {4}|\t).+)*/m,lookbehind:!0,alias:"keyword"},{pattern:/``.+?``|`[^`\r\n]+`/,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\r?\n|\r))[\s\S]+?(?=(?:\r?\n|\r)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\r?\n|\r)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#+.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/__(?:(?!_)|_(?:(?!_))+_)+__/.source,!0),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/_(?:(?!_)|__(?:(?!_))+__)+_/.source,!0),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+?\2/.source,!1),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[(?:(?!\]))+\])/.source,!1),lookbehind:!0,greedy:!0,inside:{variable:{pattern:/(\[)[^\]]+(?=\]$)/,lookbehind:!0},content:{pattern:/(^!?\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},string:{pattern:/"(?:\\.|[^"\\])*"(?=\)$)/}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],o=[];/^\w+$/.test(n)||o.push(/\w+/.exec(n)[0]),"diff"===n&&o.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:o}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(i),i.languages.git={comment:/^#.*/m,deleted:/^[-\u2013].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/m,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/m}},coord:/^@@.*@@$/m,commit_sha1:/^commit \w{40}$/m},i.languages.go=i.languages.extend("clike",{keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,builtin:/\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/,boolean:/\b(?:_|iota|nil|true|false)\b/,operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,number:/(?:\b0x[a-f\d]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[-+]?\d+)?)i?/i,string:{pattern:/(["'`])(\\[\s\S]|(?!\1)[^\\])*\1/,greedy:!0}}),delete i.languages.go["class-name"],function(e){e.languages.handlebars={comment:/\{\{![\s\S]*?\}\}/,delimiter:{pattern:/^\{\{\{?|\}\}\}?$/i,alias:"punctuation"},string:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,boolean:/\b(?:true|false)\b/,block:{pattern:/^(\s*~?\s*)[#\/]\S+?(?=\s*~?\s*$|\s)/i,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\s\S]+/}},punctuation:/[!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,.\/;<=>@\[\\\]^`{|}~\s]+/},e.hooks.add("before-tokenize",(function(t){e.languages["markup-templating"].buildPlaceholders(t,"handlebars",/\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"handlebars")}))}(i),i.languages.json={property:{pattern:/"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,greedy:!0},string:{pattern:/"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,greedy:!0},comment:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,number:/-?\d+\.?\d*(e[+-]?\d+)?/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:true|false)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},i.languages.less=i.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-]+?(?:\([^{}]+\)|[^(){};])*?(?=\s*\{)/i,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\([^{}]*\)|[^{};@])*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/i,operator:/[+\-*\/]/}),i.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-]+.*?(?=[(;])/,lookbehind:!0,alias:"function"}}),i.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},builtin:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,symbol:{pattern:/^[^:=\r\n]+(?=\s*:(?!=))/m,inside:{variable:/\$+(?:[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:[/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,{pattern:/(\()(?:addsuffix|abspath|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:s|list)?)(?=[ \t])/,lookbehind:!0}],operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/},i.languages.objectivec=i.languages.extend("c",{keyword:/\b(?:asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while|in|self|super)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|@"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,operator:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete i.languages.objectivec["class-name"],i.languages.ocaml={comment:/\(\*[\s\S]*?\*\)/,string:[{pattern:/"(?:\\.|[^\\\r\n"])*"/,greedy:!0},{pattern:/(['`])(?:\\(?:\d+|x[\da-f]+|.)|(?!\1)[^\\\r\n])\1/i,greedy:!0}],number:/\b(?:0x[\da-f][\da-f_]+|(?:0[bo])?\d[\d_]*\.?[\d_]*(?:e[+-]?[\d_]+)?)/i,type:{pattern:/\B['`]\w*/,alias:"variable"},directive:{pattern:/\B#\w+/,alias:"function"},keyword:/\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|object|of|open|prefix|private|rec|then|sig|struct|to|try|type|val|value|virtual|where|while|with)\b/,boolean:/\b(?:false|true)\b/,operator:/:=|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lxor|lsl|lsr|mod|nor|or)\b/,punctuation:/[(){}\[\]|_.,:;]/},i.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},"string-interpolation":{pattern:/(?:f|rf|fr)(?:("""|''')[\s\S]+?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:{{)*){(?!{)(?:[^{}]|{(?!{)(?:[^{}]|{(?!{)(?:[^{}])+})+})+}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|rb|br)?("""|''')[\s\S]+?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^\s*)@\w+(?:\.\w+)*/i,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:True|False|None)\b/,number:/(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},i.languages.python["string-interpolation"].inside.interpolation.inside.rest=i.languages.python,i.languages.py=i.languages.python,i.languages.reason=i.languages.extend("clike",{comment:{pattern:/(^|[^\\])\/\*[\s\S]*?\*\//,lookbehind:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:mod|land|lor|lxor|lsl|lsr|asr)\b/}),i.languages.insertBefore("reason","class-name",{character:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,alias:"string"},constructor:{pattern:/\b[A-Z]\w*\b(?!\s*\.)/,alias:"variable"},label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete i.languages.reason.function,function(e){e.languages.sass=e.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t]+.+)*/m,lookbehind:!0}}),e.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,inside:{atrule:/(?:@[\w-]+|[+=])/m}}}),delete e.languages.sass.atrule;var t=/\$[-\w]+|#\{\$[-\w]+\}/,n=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|or|not)\b/,{pattern:/(\s+)-(?=\s)/,lookbehind:!0}];e.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,inside:{punctuation:/:/,variable:t,operator:n}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s]+.*)/m,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:t,operator:n,important:e.languages.sass.important}}}),delete e.languages.sass.property,delete e.languages.sass.important,e.languages.insertBefore("sass","punctuation",{selector:{pattern:/([ \t]*)\S(?:,?[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,?[^,\r\n]+)*)*/,lookbehind:!0}})}(i),i.languages.scss=i.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()]|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}]+[:{][^}]+))/m,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),i.languages.insertBefore("scss","atrule",{keyword:[/@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)/i,{pattern:/( +)(?:from|through)(?= )/,lookbehind:!0}]}),i.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),i.languages.insertBefore("scss","function",{placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:true|false)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/,lookbehind:!0}}),i.languages.scss.atrule.inside.rest=i.languages.scss,i.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:TRUE|FALSE|NULL)\b/i,number:/\b0x[\da-f]+\b|\b\d+\.?\d*|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t={url:/url\((["']?).*?\1\)/i,string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,number:/\b\d+(?:\.\d+)?%?/,boolean:/\b(?:true|false)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.+|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],punctuation:/[{}()\[\];:,]/};t.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^{|}$/,alias:"punctuation"},rest:t}},t.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:t}},e.languages.stylus={comment:{pattern:/(^|[^\\])(\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},"atrule-declaration":{pattern:/(^\s*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:t}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:t}},statement:{pattern:/(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:t}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(\r?\n|\r)(?:\{|\2[ \t]+)))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:t.interpolation}},rest:t}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,lookbehind:!0,inside:{interpolation:t.interpolation,punctuation:/[{},]/}},func:t.func,string:t.string,interpolation:t.interpolation,punctuation:/[{}()\[\];:.]/}}(i);var l=i.util.clone(i.languages.typescript);i.languages.tsx=i.languages.extend("jsx",l),i.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^_`|~]+/i,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/},i.languages.yaml={scalar:{pattern:/([\-:]\s*(?:![^\s]+)?[ \t]*[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)[^\r\n]+(?:\2[^\r\n]+)*)/,lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:/(\s*(?:^|[:\-,[{\r\n?])[ \t]*(?:![^\s]+)?[ \t]*)[^\r\n{[\]},#\s]+?(?=\s*:\s)/,lookbehind:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:/([:\-,[{]\s*(?:![^\s]+)?[ \t]*)(?:\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?)?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?)(?=[ \t]*(?:$|,|]|}))/m,lookbehind:!0,alias:"number"},boolean:{pattern:/([:\-,[{]\s*(?:![^\s]+)?[ \t]*)(?:true|false)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},null:{pattern:/([:\-,[{]\s*(?:![^\s]+)?[ \t]*)(?:null|~)[ \t]*(?=$|,|]|})/im,lookbehind:!0,alias:"important"},string:{pattern:/([:\-,[{]\s*(?:![^\s]+)?[ \t]*)("|')(?:(?!\2)[^\\\r\n]|\\.)*\2(?=[ \t]*(?:$|,|]|}|\s*#))/m,lookbehind:!0,greedy:!0},number:{pattern:/([:\-,[{]\s*(?:![^\s]+)?[ \t]*)[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+\.?\d*|\.?\d+)(?:e[+-]?\d+)?|\.inf|\.nan)[ \t]*(?=$|,|]|})/im,lookbehind:!0},tag:/![^\s]+/,important:/[&*][\w]+/,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},i.languages.yml=i.languages.yaml,t.a=i},function(e,t,n){"use strict";var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function i(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(o){return!1}}()?Object.assign:function(e,t){for(var n,l,u=i(e),s=1;sR.length&&R.push(e)}function P(e,t,n,r){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var l=!1;if(null===e)l=!0;else switch(o){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case a:case i:l=!0}}if(l)return n(r,e,""===t?"."+F(e,0):t),1;if(l=0,t=""===t?".":t+":",Array.isArray(e))for(var u=0;u