示例#1
0
 /// <summary>
 /// It will initialize the FabricServiceConfig with settings loaded from fullFilePath .
 /// If File not found, it will return false.
 /// if initialized successfully , it returns true.
 /// </summary>
 /// <param name="fullFilePath"></param>
 /// <param name="configParser"></param>
 /// <returns></returns>
 public static bool Initialize(string fullFilePath, IFabricServiceConfigParser configParser = null)
 {
     lock (instanceLock)
     {
         return(InitializeWithCallerHoldingLock(fullFilePath, configParser));
     }
 }
示例#2
0
        private static bool InitializeWithCallerHoldingLock(string fullFilePath, IFabricServiceConfigParser configParser = null)
        {
            if (CheckifFileIsPresent(fullFilePath))
            {
                instance = new FabricServiceConfig();
                if (configParser == null)
                {
                    configParser = new SettingsConfigParser();
                }

                instance.Settings = configParser.Parse(fullFilePath);
                AppTrace.TraceSource.WriteInfo(TraceType, "Initialize Config From File:{0}", fullFilePath);
                return(true);
            }
            else
            {
                AppTrace.TraceSource.WriteInfo(
                    TraceType,
                    "Couldn't load config as Settings File {0} is not Found",
                    fullFilePath);
                return(false);
            }
        }