This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Security.Cryptography; | |
using System.Text; | |
namespace Domain.ValueObjects | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exec sp_MSforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL' | |
exec sp_MSforeachtable 'ALTER TABLE ? DISABLE TRIGGER ALL' | |
exec sp_MSforeachtable 'DELETE FROM ?' | |
exec sp_MSforeachtable 'ALTER TABLE ? CHECK CONSTRAINT ALL' | |
exec sp_MSforeachtable 'ALTER TABLE ? ENABLE TRIGGER ALL' | |
exec sp_MSforeachtable 'IF NOT EXISTS (SELECT * | |
FROM SYS.IDENTITY_COLUMNS | |
JOIN SYS.TABLES ON SYS.IDENTITY_COLUMNS.Object_ID = SYS.TABLES.Object_ID | |
WHERE SYS.TABLES.Object_ID = OBJECT_ID(''?'') AND SYS.IDENTITY_COLUMNS.Last_Value IS NULL) | |
AND OBJECTPROPERTY(OBJECT_ID(''?''), ''TableHasIdentity'') = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Drop all non-system stored procs */ | |
DECLARE @name VARCHAR(128) | |
DECLARE @SQL VARCHAR(254) | |
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name]) | |
WHILE @name is not null | |
BEGIN | |
SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']' | |
EXEC (@SQL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: ELMAH logs the errors anyway | |
protected void Application_Error(object sender, EventArgs e) | |
{ | |
var exception = Server.GetLastError(); | |
var httpException = exception as HttpException; | |
if (httpException != null) | |
{ | |
switch (httpException.GetHttpCode()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<modules runAllManagedModulesForAllRequests="false"> | |
<!-- disable authorization section --> | |
<remove name="UrlAuthorization" /> | |
<!-- disable unused authentication schemes --> | |
<remove name="WindowsAuthentication" /> | |
<remove name="PassportAuthentication" /> | |
<!-- disable ACL file and directory check --> | |
<!-- <remove name="FileAuthorization" /> --> | |
<!-- We don't use ASP.NET Profiles --> | |
<remove name="Profile" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @TableName varchar(255) | |
DECLARE TableCursor CURSOR FOR | |
SELECT table_name FROM information_schema.tables | |
WHERE table_type = 'base table' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN TRY | |
BEGIN TRANSACTION | |
-- statements here | |
COMMIT TRAN | |
END TRY | |
BEGIN CATCH | |
IF @@TRANCOUNT > 0 | |
ROLLBACK TRAN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Disable all table constraints | |
ALTER TABLE MyTable NOCHECK CONSTRAINT ALL | |
-- Enable all table constraints | |
ALTER TABLE MyTable CHECK CONSTRAINT ALL | |
-- Disable single constraint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Run this to reverse ignoring of changes to web.config so it gets committed. | |
git update-index --no-assume-unchanged path_to_file/web.config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [master] | |
DECLARE @dbname SYSNAME | |
SET @dbname = 'DATABASENAME' | |
DECLARE @spid INT | |
SELECT @spid = MIN([spid]) FROM [master].[dbo].[sysprocesses] WHERE [dbid] = DB_ID(@dbname) | |
WHILE @spid IS NOT NULL | |
BEGIN |