예제 #1
0
        private static void UpdateVersionNumber(DataAccessBaseEx dba)
        {
            var versionSp =
                $@"ALTER PROCEDURE [dbo].[bvn_notfoundversion] AS RETURN {Configuration.Configuration.CurrentVersion}";

            Valid = dba.ExecuteNonQuery(versionSp);
        }
예제 #2
0
        private static bool AddRedirectTypeColumnToRedirectsTable(DataAccessBaseEx dba)
        {
            Logger.Information("Alter 404 handler redirects table to add RedirectType column START");
            var alterTableScript = @"ALTER TABLE [dbo].[404Handler.Redirects]
                                            ADD [RedirectType] int NOT NULL
                                        DEFAULT (301)
                                    WITH VALUES";
            var created          = dba.ExecuteNonQuery(alterTableScript);

            Logger.Information("Alter 404 handler redirects table to add RedirectType column END");

            return(created);
        }
예제 #3
0
        private static bool CreateSuggestionsTableIndex(DataAccessBaseEx dba)
        {
            Log.Information("Create suggestions table clustered index START");
            var clusteredIndex =
                "CREATE CLUSTERED INDEX NotFoundRequests_ID ON [dbo].[BVN.NotFoundRequests] (ID)";

            var created = dba.ExecuteNonQuery(clusteredIndex);

            if (!created)
            {
                Log.Error("An error occurred during the creation of the 404 handler redirects clustered index. Canceling.");
            }

            Log.Information("Create suggestions table clustered index END");
            return(created);
        }
예제 #4
0
        private static bool CreateVersionNumberSp(DataAccessBaseEx dba)
        {
            Log.Information("Create 404 handler version SP START");
            var versionSp =
                $@"CREATE PROCEDURE [dbo].[bvn_notfoundversion] AS RETURN {Configuration.Configuration.CurrentVersion}";

            var created = dba.ExecuteNonQuery(versionSp);

            if (!created)
            {
                Log.Error("An error occured during the creation of the 404 handler version stored procedure. Canceling.");
            }

            Log.Information("Create 404 handler version SP END");
            return(created);
        }
예제 #5
0
        private static bool CreateRedirectsTable(DataAccessBaseEx dba)
        {
            Log.Information("Create 404 handler redirects table START");
            var createTableScript = @"CREATE TABLE [dbo].[404Handler.Redirects](
                                        [Id] [uniqueidentifier] NOT NULL,
                                        [OldUrl] [nvarchar](2000) NOT NULL,
                                        [NewUrl] [nvarchar](2000) NOT NULL,
                                        [State] [int] NOT NULL,
                                        [WildCardSkipAppend] [bit] NOT NULL,
                                        CONSTRAINT [PK_404HandlerRedirects] PRIMARY KEY CLUSTERED ([Id] ASC) ON [PRIMARY]
                                        ) ON [PRIMARY]";
            var created           = dba.ExecuteNonQuery(createTableScript);

            Log.Information("Create 404 handler redirects table END");

            return(created);
        }
예제 #6
0
        private static bool CreateSuggestionsTable(DataAccessBaseEx dba)
        {
            Log.Information("Create 404 handler suggestions table START");
            var createTableScript = @"CREATE TABLE [dbo].[BVN.NotFoundRequests](
                                        [ID] [int] IDENTITY(1,1) NOT NULL,
                                        [OldUrl] [nvarchar](2000) NOT NULL,
                                        [Requested] [datetime] NULL,
                                        [Referer] [nvarchar](2000) NULL
                                        ) ON [PRIMARY]";
            var created           = dba.ExecuteNonQuery(createTableScript);

            Log.Information("Create 404 handler suggestions table END");

            if (created)
            {
                created = CreateSuggestionsTableIndex(dba);
            }

            return(created);
        }