public static void EnsureVersion40(this SqlCeEngine engine, string filename) { SQLCEVersion fileversion = DetermineVersion(filename); if (fileversion == SQLCEVersion.SQLCE20) { throw new ApplicationException("Unable to upgrade from 2.0 to 4.0"); } if (SQLCEVersion.SQLCE40 > fileversion) { // Original-Datei sichern string filenameBackup = GetBackupFilename(filename); File.Copy(filename, filenameBackup); engine.Upgrade();//string.Format("Data Source=\"{0}\"", filename+".new")); } }
protected override void OnSetConnectionString(XDbConnectionStringBuilder builder) { base.OnSetConnectionString(builder); SqlCeVer = SQLCEVersion.SQLCE40; if (!String.IsNullOrEmpty(FileName) && File.Exists(FileName)) { try { SqlCeVer = SqlCeHelper.DetermineVersion(FileName); } catch (Exception ex) { XTrace.WriteException(ex); SqlCeVer = SQLCEVersion.SQLCE40; } } }
protected override void OnSetConnectionString(ConnectionStringBuilder builder) { base.OnSetConnectionString(builder); SqlCeVer = SQLCEVersion.SQLCE40; var fn = DatabaseName; if (!fn.IsNullOrEmpty() && File.Exists(fn)) { try { SqlCeVer = SqlCeHelper.DetermineVersion(fn); } catch (Exception ex) { XTrace.WriteException(ex); SqlCeVer = SQLCEVersion.SQLCE40; } } }