Ejemplo n.º 1
0
        public static void CreateQueue(this SqlTransaction tran, SqlObjectName queueName)
        {
            var script = LoadScript("CreateQueue");

            script = script.Replace("{queueName}", queueName);
            tran.ExecuteNonQuery(script);
        }
Ejemplo n.º 2
0
        public static void CreateMessageType(this SqlTransaction tran, SqlSchemalessObjectName messageTypeName)
        {
            var script = LoadScript("CreateMessageType");

            script = script.Replace("{messageTypeName.Name}", messageTypeName.Name);
            script = script.Replace("{messageTypeName}", messageTypeName);
            tran.ExecuteNonQuery(script);
        }
Ejemplo n.º 3
0
        public static void CreateService(this SqlTransaction tran, SqlSchemalessObjectName serviceName, SqlObjectName queueName, SqlSchemalessObjectName contractName)
        {
            var script = LoadScript("CreateService");

            script = script.Replace("{serviceName.Name}", serviceName.Name);
            script = script.Replace("{serviceName}", serviceName);
            script = script.Replace("{queueName}", queueName);
            script = script.Replace("{contractName}", contractName);
            tran.ExecuteNonQuery(script);
        }
Ejemplo n.º 4
0
        private static void CreateTrigger(this SqlTransaction tran, string triggerResource, SqlObjectName triggerName, SqlObjectName tableName, string dialogHandle, SqlSchemalessObjectName messageType, bool withNative)
        {
            var script = LoadScript(triggerResource);

            script = script.Replace("{triggerName}", triggerName);
            script = script.Replace("{tableName.Schema}", tableName.Schema);
            script = script.Replace("{tableName.Name}", tableName.Name);
            script = script.Replace("{tableName}", tableName);
            script = script.Replace("{dialogHandle}", dialogHandle);
            script = script.Replace("{messageType}", messageType);
            if (withNative)
            {
                script = script.Replace("{with}", "WITH NATIVE_COMPILATION, SCHEMABINDING");
                script = script.Replace("{as}", "BEGIN ATOMIC WITH ( TRANSACTION ISOLATION LEVEL = SNAPSHOT, LANGUAGE = N'us_english' )");
            }
            else
            {
                script = script.Replace("{with}", String.Empty);
                script = script.Replace("{as}", String.Empty);
            }
            tran.ExecuteNonQuery(script);
        }
Ejemplo n.º 5
0
 public static void UpdateMessage(this SqlTransaction transaction, int id, string text)
 {
     transaction.ExecuteNonQuery($"UPDATE [dbo].[Messages] SET [Text] = '{text}' WHERE [Id] = {id}");
 }
Ejemplo n.º 6
0
 public static void InsertMessage(this SqlTransaction transaction, string text)
 {
     transaction.ExecuteNonQuery($"INSERT INTO [dbo].[Messages] ([Text]) VALUES (N'{text}')");
 }
Ejemplo n.º 7
0
 public static void EndConversation(this SqlTransaction tran, Guid conversation)
 {
     tran.ExecuteNonQuery($"DECLARE @dialog_handle UNIQUEIDENTIFIER = '{conversation}';{Environment.NewLine}END CONVERSATION @dialog_handle WITH CLEANUP;");
 }
Ejemplo n.º 8
0
 public static void DropQueue(this SqlTransaction tran, SqlObjectName queueName)
 {
     tran.ExecuteNonQuery($"DROP QUEUE {queueName}");
 }
Ejemplo n.º 9
0
 public static void DropService(this SqlTransaction tran, SqlSchemalessObjectName serviceName)
 {
     tran.ExecuteNonQuery($"DROP SERVICE {serviceName}");
 }
Ejemplo n.º 10
0
 public static void DropContract(this SqlTransaction tran, SqlSchemalessObjectName contract)
 {
     tran.ExecuteNonQuery($"DROP CONTRACT {contract}");
 }
Ejemplo n.º 11
0
 public static void DropMessageType(this SqlTransaction tran, SqlSchemalessObjectName messageTypeName)
 {
     tran.ExecuteNonQuery($"DROP MESSAGE TYPE {messageTypeName}");
 }
Ejemplo n.º 12
0
 public static void DropTrigger(this SqlTransaction tran, SqlObjectName triggerName)
 {
     tran.ExecuteNonQuery($"DROP TRIGGER {triggerName}");
 }