NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Data.SqlDatabaseChecker Class Reference
Collaboration diagram for Ntp.Data.SqlDatabaseChecker:

Public Member Functions

 SqlDatabaseChecker (ISqlFactory factory, IApplicationController controller, LogBase log)
 
void CheckConnection ()
 

Private Member Functions

void ControllerExitApplication (object sender, EventArgs e)
 

Private Attributes

readonly IApplicationController controller
 
readonly ISqlFactory factory
 
readonly LogBase log
 
bool stop
 

Detailed Description

Definition at line 31 of file SqlDatabaseChecker.cs.

Constructor & Destructor Documentation

Ntp.Data.SqlDatabaseChecker.SqlDatabaseChecker ( ISqlFactory  factory,
IApplicationController  controller,
LogBase  log 
)
inline

Definition at line 33 of file SqlDatabaseChecker.cs.

References factory.

34  {
35  this.controller = controller;
36  this.factory = factory;
37  this.log = log;
38  stop = false;
39  }
readonly IApplicationController controller
readonly ISqlFactory factory

Member Function Documentation

void Ntp.Data.SqlDatabaseChecker.CheckConnection ( )
inline

Definition at line 46 of file SqlDatabaseChecker.cs.

References e.

47  {
49 
50  var connection = factory.CreateGenericConnection();
51  log.AwaitingDbLink(connection);
52 
53  bool first = true;
54  bool done = false;
55 
56  do
57  {
58  try
59  {
60  connection.Open();
61  done = true;
62  }
63  catch (DbException ex)
64  {
65  log.DbLinkError(ex);
66 
67  if (first)
68  {
69  log.DbLinkDown();
70  }
71 
72  first = false;
73  Thread.Sleep(5000);
74  }
75  } while (!done && !stop);
76 
77  if (done)
78  {
79  log.DbLinkUp();
80 
81  try
82  {
83  connection.Close();
84  }
85  catch (Exception e)
86  {
87  log.WriteLine(e);
88  }
89  }
90 
92  }
abstract void WriteLine(string text, Severity severity)
readonly IApplicationController controller
abstract void Close()
var e
Definition: bootstrap.min.js:6
IDbConnection CreateGenericConnection()
readonly ISqlFactory factory
void ControllerExitApplication(object sender, EventArgs e)
void Ntp.Data.SqlDatabaseChecker.ControllerExitApplication ( object  sender,
EventArgs  e 
)
inlineprivate

Definition at line 94 of file SqlDatabaseChecker.cs.

95  {
96  stop = true;
97  }

Member Data Documentation

readonly IApplicationController Ntp.Data.SqlDatabaseChecker.controller
private

Definition at line 41 of file SqlDatabaseChecker.cs.

readonly ISqlFactory Ntp.Data.SqlDatabaseChecker.factory
private

Definition at line 42 of file SqlDatabaseChecker.cs.

readonly LogBase Ntp.Data.SqlDatabaseChecker.log
private

Definition at line 43 of file SqlDatabaseChecker.cs.

bool Ntp.Data.SqlDatabaseChecker.stop
private

Definition at line 44 of file SqlDatabaseChecker.cs.


The documentation for this class was generated from the following file: