예제 #1
0
        static void Main(string[] args)
        {
            //var testWatcher = new TestWatcher();
            //var configuration = WardenConfiguration
            //	.Create()
            //	.AddWatcher(testWatcher, hooks =>
            //	{
            //		hooks.OnCompleted(result => Console.WriteLine($"Completed {DateTime.Now:s}"));

            //	})
            //	.WithInterval(TimeSpan.FromSeconds(10))
            //	.Build();
            //var warden = WardenInstance.Create(configuration);


            var mssqlconfiguration = MsSqlWatcherConfiguration
                                     .Create(@"Data Source=localhost;Initial Catalog=AtomicScope;Integrated Security=True")
                                     .WithQuery("select * from Config_BusinessProcess", new Dictionary <string, object> {
                ["id"] = 1
            })
                                     .EnsureThat(users => users.Any(user => user.ProcessName == "Kovai.Sales"))
                                     .Build();
            var mssqlWatcher = MsSqlWatcher.Create("My MSSQL watcher", mssqlconfiguration);

            var configuration = WardenConfiguration
                                .Create()
                                .AddWatcher(mssqlWatcher, hooks => { hooks.OnCompleted(result => PrintResult(result)); })
                                .Build();

            var warden = WardenInstance.Create(configuration);

            Task.WaitAll(warden.StartAsync());

            Read();
        }
예제 #2
0
 protected MsSqlWatcherCheckResult(MsSqlWatcher watcher, bool isValid, string description,
     string connectionString, string query, IEnumerable<dynamic> queryResult)
     : base(watcher, isValid, description)
 {
     ConnectionString = connectionString;
     Query = query;
     QueryResult = queryResult;
 }
예제 #3
0
 /// <summary>
 /// Factory method for creating a new instance of MsSqlWatcherCheckResult.
 /// </summary>
 /// <param name="watcher">Instance of MsSqlWatcher.</param>
 /// <param name="isValid">Flag determining whether the performed check was valid.</param>
 /// <param name="connectionString">Connection string of the MSSQL server.</param>
 /// <param name="query">SQL query.</param>
 /// <param name="queryResult">Collection of dynamic results of the SQL query.</param>
 /// <param name="description">Custom description of the performed check.</param>
 /// <returns>Instance of MsSqlWatcherCheckResult.</returns>
 public static MsSqlWatcherCheckResult Create(MsSqlWatcher watcher, bool isValid,
     string connectionString, string query, IEnumerable<dynamic> queryResult, string description = "")
     => new MsSqlWatcherCheckResult(watcher, isValid, description, connectionString, query, queryResult);
예제 #4
0
 /// <summary>
 /// Factory method for creating a new instance of MsSqlWatcherCheckResult.
 /// </summary>
 /// <param name="watcher">Instance of MsSqlWatcher.</param>
 /// <param name="isValid">Flag determining whether the performed check was valid.</param>
 /// <param name="connectionString">Connection string of the MSSQL server.</param>
 /// <param name="description">Custom description of the performed check.</param>
 /// <returns>Instance of MsSqlWatcherCheckResult.</returns>
 public static MsSqlWatcherCheckResult Create(MsSqlWatcher watcher, bool isValid,
     string connectionString, string description = "")
     => new MsSqlWatcherCheckResult(watcher, isValid, description, connectionString, string.Empty,
         Enumerable.Empty<dynamic>());