/// <summary> /// Setups the specified context. /// </summary> /// <param name="context">The context.</param> void IDataTarget.Setup(IProcessingContext context) { context?.WriteInfo("Initializing..."); long userId; RequestContext.TryGetUserId(out userId); using (EntryPointContext.UnsafeToIncludeEntryPoint( )) using (IDbCommand command = CreateCommand( )) { command.CommandText = CommandText.TenantRepairTargetSetupCommandText; command.CommandType = CommandType.Text; command.ExecuteNonQuery( ); command.CommandText = @" IF ( @context IS NOT NULL ) BEGIN DECLARE @contextInfo VARBINARY(128) = CONVERT( VARBINARY(128), @context ) SET CONTEXT_INFO @contextInfo END"; command.AddParameter("@context", DbType.AnsiString, DatabaseContextInfo.GetMessageChain(userId), 128); command.ExecuteNonQuery( ); } }
/// <summary> /// Tears down this instance. /// </summary> void IDataSource.TearDown(IProcessingContext context) { using (EntryPointContext.UnsafeToIncludeEntryPoint( )) using (IDbCommand command = CreateCommand( )) { command.CommandText = @"DROP TABLE #candidateList DROP TABLE #dependents"; command.CommandType = CommandType.Text; command.ExecuteNonQuery( ); } }
/// <summary> /// Sets up this instance. /// </summary> void IDataSource.Setup(IProcessingContext context) { using (EntryPointContext.UnsafeToIncludeEntryPoint( )) using (IDbCommand command = CreateCommand( )) { command.CommandText = @"CREATE TABLE #candidateList ( UpgradeId UNIQUEIDENTIFIER PRIMARY KEY, [Explicit] BIT ) CREATE TABLE #dependents ( Id BIGINT PRIMARY KEY )"; command.CommandType = CommandType.Text; command.ExecuteNonQuery( ); } }
/// <summary> /// Tears down. /// </summary> /// <param name="context">The context.</param> void IDataTarget.TearDown(IProcessingContext context) { context?.WriteInfo("Finalizing..."); using (EntryPointContext.UnsafeToIncludeEntryPoint( )) using (IDbCommand command = CreateCommand( )) { command.CommandText = CommandText.TenantRepairTargetTearDownCommandText; command.CommandType = CommandType.Text; command.ExecuteNonQuery( ); } }
/// <summary> /// Setups the specified context. /// </summary> /// <param name="context">The context.</param> void IDataTarget.Setup(IProcessingContext context) { if (context != null) { context.WriteInfo("Initializing..."); } using (EntryPointContext.UnsafeToIncludeEntryPoint( )) using (IDbCommand command = CreateCommand( )) { command.CommandText = CommandText.TenantMergeTargetSetupCommandText; command.CommandType = CommandType.Text; command.ExecuteNonQuery( ); } }
/// <summary> /// Tears down. /// </summary> /// <param name="context">The context.</param> void IDataTarget.TearDown(IProcessingContext context) { if (context != null) { context.WriteInfo("Finalizing..."); } using (EntryPointContext.UnsafeToIncludeEntryPoint( )) using (IDbCommand command = CreateCommand( )) { command.CommandText = "DROP TABLE #Binary"; command.CommandType = CommandType.Text; command.ExecuteNonQuery( ); command.CommandText = "DROP TABLE #Document"; command.CommandType = CommandType.Text; command.ExecuteNonQuery( ); } }
/// <summary> /// Setups the specified context. /// </summary> /// <param name="context">The context.</param> void IDataTarget.Setup(IProcessingContext context) { if (context != null) { context.WriteInfo("Initializing..."); } using (EntryPointContext.UnsafeToIncludeEntryPoint( )) using (IDbCommand command = CreateCommand( )) { command.CommandText = "CREATE TABLE #Binary ( OldDataHash NVARCHAR(MAX) COLLATE Latin1_General_CI_AI NULL, NewDataHash NVARCHAR(MAX) COLLATE Latin1_General_CI_AI NULL, FileExtension NVARCHAR(20) COLLATE Latin1_General_CI_AI NULL )"; command.CommandType = CommandType.Text; command.ExecuteNonQuery(); command.CommandText = "CREATE TABLE #Document ( OldDataHash NVARCHAR(MAX) COLLATE Latin1_General_CI_AI NULL, NewDataHash NVARCHAR(MAX) COLLATE Latin1_General_CI_AI NULL, FileExtension NVARCHAR(20) COLLATE Latin1_General_CI_AI NULL )"; command.CommandType = CommandType.Text; command.ExecuteNonQuery(); } }
/// <summary> /// Gets the solution dependencies. /// </summary> /// <param name="context">The context.</param> /// <param name="solution">The solution.</param> /// <returns></returns> /// <exception cref="System.InvalidOperationException">No active database connection.</exception> private IList <SolutionDependency> GetSolutionDependencies(IProcessingContext context, Solution solution) { IList <SolutionDependency> solutionDependencies = new List <SolutionDependency>( ); using (EntryPointContext.UnsafeToIncludeEntryPoint( )) { IList <ApplicationDependency> applicationDependencies = solution.GetDependencies(true); if (applicationDependencies != null && applicationDependencies.Count > 0) { foreach (ApplicationDependency applicationDependency in applicationDependencies) { solutionDependencies.Add(new SolutionDependency(applicationDependency)); } } if (context != null) { context.Report.SolutionDependencies = solutionDependencies; } } return(solutionDependencies); }