Exemplo n.º 1
0
        public static XElement LoadMappingFile(string fileKey)
        {
            MappingFileElement element = MappingFileSection.GetConfig().FileLocations[fileKey];

            ExceptionHelper.TrueThrow(element == null, string.Format("没有与fileKey :{0}匹配的配置信息", fileKey));
            return(LoadMappingFile(element));
        }
Exemplo n.º 2
0
        private static string GetBaseDir()
        {
            string baseDir = MappingFileSection.GetConfig().BaseDir;

            ExceptionHelper.TrueThrow(string.IsNullOrWhiteSpace(baseDir), string.Format("配置信息baseDir不能为空"));
            ExceptionHelper.FalseThrow(Directory.Exists(baseDir), string.Format("未找到baseDir:{0}对应的目录", baseDir));
            return(baseDir);
        }
Exemplo n.º 3
0
        public static MappingFileSection GetConfig()
        {
            MappingFileSection section = (MappingFileSection)ConfigurationBroker.GetSection(sectionName);

            ConfigurationExceptionHelper.CheckSectionNotNull(section, sectionName);

            return(section);
        }
Exemplo n.º 4
0
        public static List <XElement> LoadMappingFile()
        {
            List <XElement> result  = new List <XElement>();
            string          baseDir = GetBaseDir();

            MappingFileElementCollection collection = MappingFileSection.GetConfig().FileLocations;

            foreach (MappingFileElement element in collection)
            {
                result.Add(LoadMappingFile(element));
            }
            return(result);
        }
Exemplo n.º 5
0
 private static string GetFilePath(string modelName)
 {
     return(GetFilePath(MappingFileSection.GetConfig().FileLocations[modelName]));
 }