void OnStart(object param) { if (_serverModel.Initialize(_port)) { isServerManagerVisible = false; } StatusMessage = _serverModel.Status; }
public ServerViewModel() { StartCommand = new DelegateCommand(OnStart); _serverModel = new ServerModel(); if (!_serverModel.Initialize()) { StatusMessage = _serverModel.Status; } }
protected override void InitializeFixture() { if (!DatabaseExists()) { Debug.WriteLine(string.Format("Creating database '{0}'...", _DataBaseName)); CreateTestDataBase(); } _Connection.Close(); _Connection.ConnectionString = new SqlConnectionStringBuilder(_Connection.ConnectionString) { InitialCatalog = _DataBaseName }.ToString(); _Connection.Open(); ServerModel.Initialize(Connection.ConnectionString, HttpRuntime.Cache); }
protected override void InitializeFixture() { var context = new NUnitDBInteractionContext(this); var dbExists = (bool)DBUpdateManager.IsDatabaseExists(_DataBaseName)(context); if (NeedToRecreateDB || !dbExists) { if (dbExists) { Debug.WriteLine(string.Format("Deleting database '{0}'...", context.DBName)); DropTestDataBase(); } Debug.WriteLine(string.Format("Creating database '{0}'...", context.DBName)); CreateTestDataBase(); } else { _Connection.Close(); _Connection.ConnectionString = new SqlConnectionStringBuilder(_Connection.ConnectionString) { InitialCatalog = _DataBaseName }.ToString(); _Connection.Open(); } var scriptsToRun = ((KeyValuePair <IList <string>, IList <string> >)DBUpdateManager.GetScriptsToRun(context)).Value; Debug.Write("Scripts to run:" + scriptsToRun.ConcatComma()); foreach (var s in scriptsToRun) { var updateAction = DBUpdateManager.UpgrateToNextVersion( DBUpdateManager.ExtractScriptVersion(s), File.ReadAllText(Path.Combine(context.DBScriptsPath, s + ".sql")), s); Debug.WriteLine(string.Format("Running script '{0}'...", s)); updateAction(context); } ServerModel.Initialize(Connection.ConnectionString, HttpRuntime.Cache); }
protected void Application_Start(object sender, EventArgs e) { ServerModel.Initialize(WebConfigurationManager.ConnectionStrings["NEWS"].ConnectionString, HttpRuntime.Cache); }