Пример #1
0
        public static FileSystemSqlEmiter FromSqlDirectoryAndWatch(
            string sqlDirectory,
            bool ensureCompiled = false)
        {
            var compiler = CreateCompilerFromSqlDirectory(
                sqlDirectory,
                ensureCompiled);

            var result = new FileSystemSqlEmiter(compiler);

            var watcher = new FileSystemWatcher(sqlDirectory);

            watcher.EnableRaisingEvents = true;
            watcher.NotifyFilter        = NotifyFilters.LastWrite;
            watcher.Changed            += (o, e) =>
            {
                GC.KeepAlive(watcher);
                Thread.Sleep(1);
                result._compiler = CreateCompilerFromSqlDirectory(
                    sqlDirectory,
                    ensureCompiled);
            };

            return(result);
        }
Пример #2
0
 public static void SetSqlDirectoryAndWatch(string sqlDirectory)
 {
     SetSqlEmiter(FileSystemSqlEmiter.FromSqlDirectoryAndWatch(sqlDirectory));
 }