本文整理汇总了C#中DatabaseVersionMismatchEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DatabaseVersionMismatchEventArgs类的具体用法?C# DatabaseVersionMismatchEventArgs怎么用?C# DatabaseVersionMismatchEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseVersionMismatchEventArgs类属于命名空间,在下文中一共展示了DatabaseVersionMismatchEventArgs类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidationTesterAspNetApplication_DatabaseVersionMismatch
private void ValidationTesterAspNetApplication_DatabaseVersionMismatch(object sender, DatabaseVersionMismatchEventArgs e) {
#if EASYTEST
e.Updater.Update();
e.Handled = true;
#else
e.Updater.Update();
e.Handled = true;
if (Debugger.IsAttached) {
e.Updater.Update();
e.Handled = true;
} else {
string message = "The application cannot connect to the specified database, because the latter doesn't exist or its version is older than that of the application.\r\n" +
"This error occurred because the automatic database update was disabled when the application was started without debugging.\r\n" +
"To avoid this error, you should either start the application under Visual Studio in debug mode, or modify the " +
"source code of the 'DatabaseVersionMismatch' event handler to enable automatic database update, " +
"or manually create a database using the 'DBUpdater' tool.\r\n" +
"Anyway, refer to the following help topics for more detailed information:\r\n" +
"'Update Application and Database Versions' at http://www.devexpress.com/Help/?document=ExpressApp/CustomDocument2795.htm\r\n" +
"'Database Security References' at http://www.devexpress.com/Help/?document=ExpressApp/CustomDocument3237.htm\r\n" +
"If this doesn't help, please contact our Support Team at http://www.devexpress.com/Support/Center/";
if (e.CompatibilityError != null && e.CompatibilityError.Exception != null) {
message += "\r\n\r\nInner exception: " + e.CompatibilityError.Exception.Message;
}
throw new InvalidOperationException(message);
}
#endif
}
示例2: XVideoRentalWindowsFormsApplication_DatabaseVersionMismatch
void XVideoRentalWindowsFormsApplication_DatabaseVersionMismatch(object sender,
DatabaseVersionMismatchEventArgs e) {
#if EASYTEST
e.Updater.Update();
e.Handled = true;
#else
if (this.DropDatabaseOnVersionMissmatch() > 0)
Application.ExitThread();
if (Debugger.IsAttached) {
e.Updater.Update();
e.Handled = true;
}
else {
throw new InvalidOperationException(
"The application cannot connect to the specified database, because the latter doesn't exist or its version is older than that of the application.\r\n" +
"This error occurred because the automatic database update was disabled when the application was started without debugging.\r\n" +
"To avoid this error, you should either start the application under Visual Studio in debug mode, or modify the " +
"source code of the 'DatabaseVersionMismatch' event handler to enable automatic database update, " +
"or manually create a database using the 'DBUpdater' tool.\r\n" +
"Anyway, refer to the 'Update Application and Database Versions' help topic at http://www.devexpress.com/Help/?document=ExpressApp/CustomDocument2795.htm " +
"for more detailed information. If this doesn't help, please contact our Support Team at http://www.devexpress.com/Support/Center/");
}
#endif
}
示例3: ReportsTesterWindowsFormsApplication_DatabaseVersionMismatch
private void ReportsTesterWindowsFormsApplication_DatabaseVersionMismatch(object sender, DatabaseVersionMismatchEventArgs e) {
#if EASYTEST
e.Updater.Update();
e.Handled = true;
#else
if (true) {
e.Updater.Update();
e.Handled = true;
}
#endif
}
示例4: DCSecurityDemoAspNetApplication_DatabaseVersionMismatch
private void DCSecurityDemoAspNetApplication_DatabaseVersionMismatch(object sender, DatabaseVersionMismatchEventArgs e) {
try {
e.Updater.Update();
e.Handled = true;
} catch (CompatibilityException exception) {
if (exception.Error is CompatibilityUnableToOpenDatabaseError) {
throw new UserFriendlyException(
"The connection to the database failed. This demo requires the local instance of Microsoft SQL Server Express. To use another database server,\r\nopen the demo solution in Visual Studio and modify connection string in the \"app.config\" file.");
}
}
}
示例5: FeatureCenterWindowsFormsApplication_DatabaseVersionMismatch
// protected override ShowViewStrategyBase CreateShowViewStrategy() {
// return new ShowInSingleWindowStrategy(this);
// }
private void FeatureCenterWindowsFormsApplication_DatabaseVersionMismatch(object sender, DatabaseVersionMismatchEventArgs e) {
#if EASYTEST
e.Updater.Update();
e.Handled = true;
#else
if (true) {
if (this.DropDatabaseOnVersionMissmatch() > 0)
Application.ExitThread();
e.Updater.Update();
e.Handled = true;
} else {
throw new InvalidOperationException(
"The application cannot connect to the specified database, because the latter doesn't exist or its version is older than that of the application.\r\n" +
"The automatic update is disabled, because the application was started without debugging.\r\n" +
"You should start the application under Visual Studio, or modify the " +
"source code of the 'DatabaseVersionMismatch' event handler to enable automatic database update, " +
"or manually create a database using the 'DBUpdater' tool.");
}
#endif
}
示例6: SecuritySystemExampleWindowsFormsApplication_DatabaseVersionMismatch
void SecuritySystemExampleWindowsFormsApplication_DatabaseVersionMismatch(object sender,
DatabaseVersionMismatchEventArgs e) {
throw new InvalidOperationException(
"The application cannot connect to the specified database, because the latter doesn't exist or its version is older than that of the application.");
}
示例7: OnDatabaseVersionMismatch
protected override void OnDatabaseVersionMismatch(DatabaseVersionMismatchEventArgs args) {
args.Updater.Update();
args.Handled = true;
}
示例8: EFDemoWebApplication_DatabaseVersionMismatch
private void EFDemoWebApplication_DatabaseVersionMismatch(Object sender, DatabaseVersionMismatchEventArgs e) {
e.Updater.Update();
e.Handled = true;
}
示例9: app_DatabaseVersionMismatch
void app_DatabaseVersionMismatch(object sender, DatabaseVersionMismatchEventArgs e)
{
e.Handled = true;
}
示例10: OnVersionMismatch
void OnVersionMismatch(object sender, DatabaseVersionMismatchEventArgs args) {
args.Updater.Update();
args.Handled = true;
}
示例11: OnDatabaseVersionMismatch
protected override void OnDatabaseVersionMismatch(DatabaseVersionMismatchEventArgs args)
{
args.Handled = true;
base.OnDatabaseVersionMismatch(args);
}
示例12: Application_DatabaseVersionMismatch
/// <summary>
/// http://www.devexpress.com/Help/?document=ExpressApp/CustomDocument2795.htm
/// ЗДЕСЬ ПРОИСХОДИТ ОБНОВЛЕНИЕ БД !!!
/// </summary>
private void Application_DatabaseVersionMismatch(object sender, DatabaseVersionMismatchEventArgs e)
{
if (e.CompatibilityError is CompatibilityDatabaseIsOldError)
{ // если база есть, но другой версии
SplashScreenStop();
string compatibilityError = e.CompatibilityError.Message;
System.Windows.Forms.DialogResult dialog = XtraMessageBox.Show(Strings.WinApplication_CompatibilityDatabaseIsOldWarning,
this.ApplicationName, System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning);
if (dialog == System.Windows.Forms.DialogResult.Yes)
{
this.StartSplash();
CreateDatabaseBackup();
try
{
SplashScreenSetDisplayText(Strings.SplashScreenText_Application_DatabaseUpdateBegin);
e.Updater.Update();
e.Handled = true;
SplashScreenSetDisplayText(Strings.SplashScreenText_Application_DatabaseUpdateEnd);
}
catch (Exception ex)
{
string UpdateError = ex.Message;
SplashScreenStop();
Config.Data.UserSettings.DBPathIsInstalled = false;
Config.Data.UserSettings.Save();
string message = String.Format("{0}\n{1}\n{2}", Strings.WinApplication_DatabaseUpdateGlobalError, compatibilityError, UpdateError);
ErrorManager.RaiseException(ErrorCode.Application_DatabaseUpdateFailed, message);
}
}
else
{// если пользователь отменил обновление
ErrorManager.RaiseException(ErrorCode.Application_DatabaseUpdateCanceled, "");
}
return;
}
else if (e.CompatibilityError is CompatibilityUnableToOpenDatabaseError)
{ // если базы нету совсем
string compatibilityError = e.CompatibilityError.Message;
try
{
string databaseDirectory = Path.GetDirectoryName(Config.Data.AppSettings.DatabaseFile);
if (Directory.Exists(databaseDirectory) == false)
Directory.CreateDirectory(databaseDirectory);
SplashScreenSetDisplayText(Strings.SplashScreenText_Application_DatabaseCreateBegin);
e.Updater.Update();
e.Handled = true;
CreateBuiltInObjects();
SplashScreenSetDisplayText(Strings.SplashScreenText_Application_DatabaseCreateEnd);
//this.SetUserSetting("DBPathIsInstalled", "true");
}
catch (Exception ex)
{
string UpdateError = ex.Message;
SplashScreenStop();
Config.Data.UserSettings.DBPathIsInstalled = false;
Config.Data.UserSettings.Save();
//Config.SaveAll();
string message = String.Format("{0}\n{1}\n{2}", Strings.WinApplication_DatabaseCreateGlobalError, compatibilityError, UpdateError);
ErrorManager.RaiseException(ErrorCode.Application_DatabaseCreateFailed, message);
}
SplashScreenStop();
// Показывем форму перовначальной настройки
ShowFirstLaunchPatameters();
}
}
示例13: AIR_ERPAspNetApplication_DatabaseVersionMismatch
private void AIR_ERPAspNetApplication_DatabaseVersionMismatch(object sender, DatabaseVersionMismatchEventArgs e)
{
e.Updater.Update();
e.Handled = true;
}