/// <summary> /// constructor /// </summary> public ConfigBootStrap() { Trace.WriteLine("configuration bootstraping ..."); JObject jobject_qx_frame_config = File_Helper_DG.Json_GetJObjectFromJsonFile("../../config/qx_frame.config.json");//get json configuration file QX_Frame_Helper_DG_Config.ConnectionString_DB_QX_Frame_Default = jobject_qx_frame_config["database"]["connectionStrings"]["QX_Frame_Default"].ToString(); QX_Frame_Helper_DG_Config.Log_Location_General = jobject_qx_frame_config["log"]["Log_Location_General"].ToString(); QX_Frame_Helper_DG_Config.Log_Location_Error = jobject_qx_frame_config["log"]["Log_Location_Error"].ToString(); QX_Frame_Helper_DG_Config.Log_Location_Use = jobject_qx_frame_config["log"]["Log_Location_Use"].ToString(); QX_Frame_Helper_DG_Config.Cache_IsCache = jobject_qx_frame_config["cache"]["IsCache"].ToInt() == 1; QX_Frame_Helper_DG_Config.Cache_CacheExpirationTimeSpan_Minutes = jobject_qx_frame_config["cache"]["CacheExpirationTime_Minutes"].ToInt(); QX_Frame_Helper_DG_Config.Cache_CacheServer = QX_Frame.Helper_DG.Options.Opt_CacheServer.Redis; QX_Frame_Helper_DG_Config.Cache_Redis_Host_ReadWrite_Array = jobject_qx_frame_config["cache"]["Cache_Redis_Host_ReadWrite_Array"].ToString().Split(','); QX_Frame_Helper_DG_Config.Cache_Redis_Host_OnlyRead_Array = jobject_qx_frame_config["cache"]["Cache_Redis_Host_OnlyRead_Array"].ToString().Split(','); QX_Frame_Helper_DG_Config.MSMQ_RabbitMQ_Host = jobject_qx_frame_config["rabbitmq"]["Host"].ToString(); QX_Frame_Helper_DG_Config.MSMQ_RabbitMQ_UserName = jobject_qx_frame_config["rabbitmq"]["UserName"].ToString(); QX_Frame_Helper_DG_Config.MSMQ_RabbitMQ_Password = jobject_qx_frame_config["rabbitmq"]["Password"].ToString(); QX_Frame_Helper_DG_Config.MSMQ_RabbitMQ_VirtualHost = jobject_qx_frame_config["rabbitmq"]["VirtualHost"].ToString(); QX_Frame_Helper_DG_Config.MSMQ_RabbitMQ_RequestedHeartBeat = Convert.ToUInt16(jobject_qx_frame_config["rabbitmq"]["RequestedHeartBeat"]); QX_Frame_Helper_DG_Config.International_ConfigFileLocation = @"../../config/qx_frame.internationalization.json"; QX_Frame_Helper_DG_Config.International_Language = "english"; Trace.WriteLine("configuration bootstrap succeed !"); }
/// <summary> /// Get JObject from json config file /// </summary> /// <returns></returns> private static JObject GetJObject() { if (string.IsNullOrEmpty(QX_Frame_Helper_DG_Config.International_ConfigFileLocation)) { throw new Helper_DG.Extends.Exception_DG("QX_Frame_Config.International_ConfigFileLocation must be provide correctly ! -- QX_Frame.Helper_DG.Extends.Exception_DG line:18"); } return(File_Helper_DG.Json_GetJObjectFromJsonFile(QX_Frame_Helper_DG_Config.International_ConfigFileLocation));//get json configuration file }
protected static string GetERROR_XXX(int ERROR_Code) { if (string.IsNullOrEmpty(QX_Frame_Helper_DG_Config.International_ConfigFileLocation)) { throw new Exception_DG("QX_Frame_Helper_DG_Config.International_ConfigFileLocation must be provide correctly ! -- QX_Frame.Helper_DG.Extends.Exception_DG line:18"); } JObject jobject = File_Helper_DG.Json_GetJObjectFromJsonFile(QX_Frame_Helper_DG_Config.International_ConfigFileLocation);//get json configuration file return(jobject[QX_Frame_Helper_DG_Config.International_Language][$"ERROR_{ERROR_Code}"].ToString()); }
public Exception_DG_Internationalization(int errorCode) : base("Refrence Message_DG") { if (string.IsNullOrEmpty(QX_Frame_Helper_DG_Config.International_ConfigFileLocation)) { throw new Exception_DG("QX_Frame_Helper_DG_Config.International_ConfigFileLocation must be provide correctly ! -- QX_Frame.Helper_DG.Extends.Exception_DG line:69"); } JObject jobject = File_Helper_DG.Json_GetJObjectFromJsonFile(QX_Frame_Helper_DG_Config.International_ConfigFileLocation);//get json configuration file this.Message_DG = jobject[QX_Frame_Helper_DG_Config.International_Language][$"ERROR_{errorCode}"].ToString(); this.ErrorCode = errorCode; }
/// <summary> /// constructor /// </summary> public ConfigBootStrap() { JObject jobject_qx_frame_config = File_Helper_DG.Json_GetJObjectFromJsonFile("../../config/qx_frame.config.json");//get json configuration file QX_Frame_Helper_DG_Config.ConnectionString_DB_QX_Frame_Default = jobject_qx_frame_config["database"]["connectionStrings"]["QX_Frame_Default"].ToString(); QX_Frame_Helper_DG_Config.Log_Location_General = jobject_qx_frame_config["log"]["Log_Location_General"].ToString(); QX_Frame_Helper_DG_Config.Log_Location_Error = jobject_qx_frame_config["log"]["Log_Location_Error"].ToString(); QX_Frame_Helper_DG_Config.Log_Location_Use = jobject_qx_frame_config["log"]["Log_Location_Use"].ToString(); QX_Frame_Helper_DG_Config.Cache_IsCache = jobject_qx_frame_config["cache"]["IsCache"].ToInt() == 1; QX_Frame_Helper_DG_Config.Cache_CacheExpirationTimeSpan_Minutes = jobject_qx_frame_config["cache"]["CacheExpirationTime_Minutes"].ToInt(); QX_Frame_Helper_DG_Config.Cache_CacheServer = QX_Frame.Helper_DG.Options.Opt_CacheServer.Redis; QX_Frame_Helper_DG_Config.Cache_Redis_Host = jobject_qx_frame_config["cache"]["Cache_Redis_Host"].ToString(); QX_Frame_Helper_DG_Config.Cache_Redis_Port = jobject_qx_frame_config["cache"]["Cache_Redis_Port"].ToInt(); QX_Frame_Helper_DG_Config.International_ConfigFileLocation = @"../../config/qx_frame.internationalization.json"; QX_Frame_Helper_DG_Config.International_Language = "english"; Trace.WriteLine("configuration bootstrap succeed !"); }
/// <summary> /// constructor /// </summary> public ConfigBootStrap() { JObject jobject_qx_frame_config = File_Helper_DG.Json_GetJObjectFromJsonFile(IO_Helper_DG.RootPath_MVC + @"/Config/qx_frame.config.json");//get json configuration file QX_Frame_Helper_DG_Config.ConnectionString_DB_QX_Frame_Default = jobject_qx_frame_config["database"]["connectionStrings"]["QX_Frame_Default"].ToString(); QX_Frame_Helper_DG_Config.Log_Location_General = jobject_qx_frame_config["log"]["Log_Location_General"].ToString(); QX_Frame_Helper_DG_Config.Log_Location_Error = jobject_qx_frame_config["log"]["Log_Location_Error"].ToString(); QX_Frame_Helper_DG_Config.Log_Location_Use = jobject_qx_frame_config["log"]["Log_Location_Use"].ToString(); QX_Frame_Helper_DG_Config.Cache_IsCache = jobject_qx_frame_config["cache"]["IsCache"].ToInt() == 1; QX_Frame_Helper_DG_Config.Cache_CacheExpirationTimeSpan_Minutes = jobject_qx_frame_config["cache"]["CacheExpirationTime_Minutes"].ToInt(); QX_Frame_Helper_DG_Config.Cache_CacheServer = QX_Frame.Helper_DG.Options.Opt_CacheServer.HttpRuntimeCache; QX_Frame_Helper_DG_Config.Cache_Redis_Host_ReadWrite_Array = jobject_qx_frame_config["cache"]["Cache_Redis_Host_ReadWrite_Array"].ToString().Split(','); QX_Frame_Helper_DG_Config.Cache_Redis_Host_OnlyRead_Array = jobject_qx_frame_config["cache"]["Cache_Redis_Host_OnlyRead_Array"].ToString().Split(','); QX_Frame_Helper_DG_Config.International_ConfigFileLocation = IO_Helper_DG.RootPath_MVC + @"/Config/qx_frame.internationalization.json"; QX_Frame_Helper_DG_Config.International_Language = "english"; QX_Frame_Data_Config.ConnectionString_DB_QX_Frame_Test = jobject_qx_frame_config["database"]["connectionStrings"]["DB_QX_Frame_Test"].ToString(); Trace.WriteLine("configuration bootstrap succeed !"); }