Пример #1
0
 public void CreateSessionStateTable()
 {
     using (var connection = new SqlConnection(_connectString))
     {
         try
         {
             var cmd  = _commandHelper.CreateNewSessionTableCmd(CreateSessionTableSql);
             var task = SqlSessionStateRepositoryUtil.SqlExecuteNonQueryWithRetryAsync(connection, cmd, CanRetry).ConfigureAwait(false);
             task.GetAwaiter().GetResult();
         }
         catch (Exception ex)
         {
             // Indicate that the DB doesn't support InMemoryTable
             var sqlException = ex as SqlException;
             if (sqlException != null &&
                 // 40536 error code from SQL Azure
                 // 41337 error code from SQL server
                 (sqlException.Number == 40536 || sqlException.Number == 41337))
             {
                 throw sqlException;
             }
             else
             {
                 throw new HttpException(SR.Cant_connect_sql_session_database, ex);
             }
         }
     }
 }
 public void CreateSessionStateTable()
 {
     using (var connection = new SqlConnection(_connectString))
     {
         try
         {
             var cmd  = _commandHelper.CreateNewSessionTableCmd(CreateSessionTableSql);
             var task = SqlSessionStateRepositoryUtil.SqlExecuteNonQueryWithRetryAsync(connection, cmd, CanRetry).ConfigureAwait(false);
             task.GetAwaiter().GetResult();
         }
         catch (Exception ex)
         {
             throw new HttpException(SR.Cant_connect_sql_session_database, ex);
         }
     }
 }