当前位置:网站首页>How to use function switch in blazor webassembly

How to use function switch in blazor webassembly

2021-01-23 23:23:22 itread01

Microsoft Azure Team developed Function management (Feature Management) package Microsoft.FeatureManagement Can be used to implement Function switch , It can be done by Function switch Features dynamically change the behavior of an application without changing any business logic code . For more functions of the function switch, please see Edi Wang Of B Station video :

The focus of this article is to introduce how to Blazor WebAssembly Project implementation function switch .

Through NuGet Install Microsoft.FeatureManagement , It can be done by Visual Studio 2019 Under the NuGet Package Manager Visual management interface perhaps Through .NET CLI Command line tools enter the following command .

dotnet add package Microsoft.FeatureManagement

In order to be able to use Function management , Need to be in ConfigureServices Method service Inject , As shown in the following code :

One thing to note : Function management Medium Function switch The value read is from the configuration file , If you want Function switch The value of is derived from Configuration Different nodes of the file , Must be on service When you register, specify it separately .

In order to be able to Blazor Wassembly I use it in my life Function management (feature management), We need to inject it into Blazor In the components :

Call when using IFeatureManager Interface method IsEnabledAsync, The code is as follows :

The usage is very simple , You can see .NET Yes Function management Provides out of the box support , It's really a very practical feature , More about Knowledge point Introduction of , Please refer to the official website :https://docs.microsoft.com/en-us/azure/azure-app-configuration/use-feature-flags-dotnet-core

From this little article you can feel the use of blazor You can .NET The whole ecology of the company is integrated into the front end , This is it blazor It's empowering you . For the screenshot code in this article, please refer to :https://github.com/geffzhang/Abp.BootstrapTheme 


版权声明
本文为[itread01]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/01/20210123232234461F.html

随机推荐