Пример #1
0
 /// <summary>
 /// Gets the <see cref="Version"/> of the current Subtext data store (ie. SQL Server). 
 /// This is the value stored in the database. If it does not match the actual 
 /// assembly version, we may need to run an upgrade.
 /// </summary>
 /// <returns></returns>
 public Version GetCurrentInstallationVersion()
 {
     var procedures = new StoredProcedures(_connectionString);
     try
     {
         using(var reader = procedures.VersionGetCurrent())
         {
             if(reader.Read())
             {
                 var version = new Version((int)reader["Major"], (int)reader["Minor"], (int)reader["Build"]);
                 reader.Close();
                 return version;
             }
         }
     }
     catch(SqlException exception)
     {
         if(exception.Number != (int)SqlErrorMessage.CouldNotFindStoredProcedure)
         {
             throw;
         }
     }
     return null;
 }
Пример #2
0
 /// <summary>
 /// Updates the value of the current installed version within the subtext_Version table.
 /// </summary>
 /// <param name="newVersion">New version.</param>
 /// <param name="transaction">The transaction to perform this action within.</param>
 public static void UpdateInstallationVersionNumber(Version newVersion, SqlTransaction transaction)
 {
     var procedures = new StoredProcedures(transaction);
     procedures.VersionAdd(newVersion.Major, newVersion.Minor, newVersion.Build, DateTime.Now);
 }
Пример #3
0
 public DatabaseObjectProvider(int blogId, StoredProcedures procedures)
 {
     _procedures = procedures;
     _blogId = new Func<int>(() => blogId);
 }
Пример #4
0
 public DatabaseObjectProvider()
 {
     _procedures = new StoredProcedures(Config.ConnectionString);
     _blogId = new Func<int>(() => BlogRequest.Current.IsHostAdminRequest ? NullValue.NullInt32 : BlogRequest.Current.Blog.Id);
 }
Пример #5
0
 public DatabaseObjectProvider(int blogId, StoredProcedures procedures)
 {
     _procedures = procedures;
     _blogId     = new Func <int>(() => blogId);
 }
Пример #6
0
 public DatabaseObjectProvider()
 {
     _procedures = new StoredProcedures(Config.ConnectionString);
     _blogId     = new Func <int>(() => BlogRequest.Current.IsHostAdminRequest ? NullValue.NullInt32 : BlogRequest.Current.Blog.Id);
 }
Пример #7
0
 public SearchEngine(Blog blog, UrlHelper urlHelper, string connectionString)
 {
     _blog = blog;
     _procedures = new StoredProcedures(connectionString);
     _urlHelper = urlHelper;
 }