_Samples/Example_Environments.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Data;
using System.Data.Common;
using System.Security.Cryptography;

//<doc:using>
using ComLib;
using ComLib.Environments;
//</doc:using>
using ComLib.Application;
using ComLib.Logging;


namespace ComLib.Samples
{
    /// <summary>
    /// Example for the Environments namespace.
    /// </summary>
    public class Example_Environments : App
    {
        /// <summary>
        /// Initialize.
        /// </summary>
        public Example_Environments()
        {
        }

		
		//<doc:example>
        /// <summary>
        /// Run the application.
        /// </summary>
        public override BoolMessageItem Execute()
        {
            //// Setup notification on Environment changed.
            Env.OnChange += (sender, args) => Console.Write("New Env: " + Env.Name);

            // Use 1: Set to "prod"(PRODUCTION) with default available envs as "prod,uat,qa,dev".
            Envs.Set("prod");
            PrintEnvironment();

            // Use 2: Set to "qa"(QA) with default available envs as "prod,qa,dev".
            Envs.Set("qa", "prod,qa,dev");
            PrintEnvironment();

            // Use 3: Set to "dev"(DEVELOPMENT) with default available envs as "prod,uat,qa,dev".
            //        Also set the "dev" env RefPath to "dev.config".
            Envs.Set("dev", "prod,uat,qa,dev", "dev.config");
            PrintEnvironment();

            // Use 4: Env Set up & Configuration File Setup WITH-OUT Inheritance
            //        - Set env to "ny.prod"(PRODUCTION) with default available envs as "ny.prod,london.prod,qa,dev".
            //        - The "ny.prod" environment name is set to environment type of "prod" via format "<envName>:<envType>" e.g. "myprod:prod"
            //        - Also set the "ny.prod" env RefPath to use 3 config files "ny.prod.config,london.prod.config,dev.config. ( For config file inheritance ).
            Envs.Set("ny.prod", "ny.prod:prod,london.prod:prod,qa,dev", "ny.prod.config,london.prod.config,qa.config,dev.config");
            PrintEnvironment();
后面还有 62 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。