Esempio n. 1
0
        /// <summary>
        /// Write one backing data entity out
        /// </summary>
        /// <param name="entity">the thing to write out to current</param>
        public void WriteEntity(IConfigData entity)
        {
            try
            {
                string dirName = GetCurrentDirectoryForEntity(entity);

                if (!VerifyDirectory(dirName))
                {
                    throw new Exception("Unable to locate or create base backing data directory.");
                }

                string entityFileName = GetEntityFilename(entity);

                if (string.IsNullOrWhiteSpace(entityFileName))
                {
                    return;
                }

                string fullFileName = dirName + entityFileName;

                ArchiveEntity(entity);
                WriteToFile(fullFileName, entity.ToBytes());
            }
            catch (Exception ex)
            {
                LoggingUtility.LogError(ex);
            }
        }