Example #1
0
        private void Initalize(IList <string> directories)
        {
            foreach (var dir in directories)
            {
                var path = App.GetLocalPath(dir);
                if (!Directory.Exists(path))
                {
                    throw new AceException($"Not found the folder: {path}");
                }
                logger.LogDebug($"SqlMapper initalize the folder: {path}");

                var files = Directory.EnumerateFiles(path, "*.config");
                foreach (var file in files)
                {
                    var scope = ConfigContext.GetXmlConfig <SqlScope>(file, (s) =>
                    {
                        logger.LogDebug($"SqlScope has changed with id: {s.Id}");
                        MappedScopes[s.Id] = s;
                        CacheManager.ResetMappedCaches();
                    });
                    MappedScopes.Add(scope.Id, scope);
                }
            }
        }