Exemple #1
0
        public Response PostDictionary(string projectName, string applicationName, DatabaseDictionary databaseDictionary)
        {
            Response response = new Response();

            try
            {
                InitializeScope(projectName, applicationName);

                string keyFile = string.Format("{0}{1}.{2}.key",
                                               _settings["AppDataPath"], _settings["ProjectName"], _settings["ApplicationName"]);

                NHibernateUtility.SaveDatabaseDictionary(databaseDictionary, _settings["DBDictionaryPath"], keyFile);

                Response genRes = Generate(projectName, applicationName);
                response.Append(genRes);
            }
            catch (Exception ex)
            {
                _logger.Error("Error updating dictionary: " + ex);

                response.Level = StatusLevel.Error;
                response.Messages.Add("Error updating dictionary" + ex.Message);
            }

            return(response);
        }
Exemple #2
0
        public DatabaseDictionary GetDictionary(string projectName, string applicationName)
        {
            DatabaseDictionary databaseDictionary = new DatabaseDictionary();

            try
            {
                InitializeScope(projectName, applicationName);

                string keyFile = string.Format("{0}{1}.{2}.key",
                                               _settings["AppDataPath"], _settings["ProjectName"], _settings["ApplicationName"]);

                if (File.Exists(_settings["DBDictionaryPath"]))
                {
                    databaseDictionary = NHibernateUtility.LoadDatabaseDictionary(
                        _settings["DBDictionaryPath"], keyFile);
                }
                else
                {
                    databaseDictionary = new DatabaseDictionary();
                    NHibernateUtility.SaveDatabaseDictionary(databaseDictionary,
                                                             _settings["DBDictionaryPath"], keyFile);
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Error in GetDbDictionary: " + ex);
                return(null);
            }

            return(databaseDictionary);
        }