Ascentis.SQLRewriteInterceptor 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ascentis.SQLRewriteInterceptor --version 1.2.0                
NuGet\Install-Package Ascentis.SQLRewriteInterceptor -Version 1.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ascentis.SQLRewriteInterceptor" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ascentis.SQLRewriteInterceptor --version 1.2.0                
#r "nuget: Ascentis.SQLRewriteInterceptor, 1.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ascentis.SQLRewriteInterceptor as a Cake Addin
#addin nuget:?package=Ascentis.SQLRewriteInterceptor&version=1.2.0

// Install Ascentis.SQLRewriteInterceptor as a Cake Tool
#tool nuget:?package=Ascentis.SQLRewriteInterceptor&version=1.2.0                

SQL-Rewrite-Interceptor

Description

This package provides the ability to instrument a .NET application reliant on ado.net in a way that allows SQL re-write (sql text modification) in a production environment without requiring applicaiton re-compilation.

This allows for query fast deployment (hotfixing) of query optimization while working on changing source code application logic.

Nuget package name

Ascentis.SQLRewriteInterceptor

Dependencies

  • Lib.Harmony
  • Ascentis.Infrastructure

Sample usage


using System;
using System.Data.SqlClient;
using Ascentis.Infrastructure;

namespace ConsoleApp
{
    class Program
    {
        private const string Cs = "Server=<Your Server Name>; Database=<Your Database>; Trusted_Connection=True;";

        static void Main()
        {
            using (var repo = new SqlRewriteDbRepository(Cs))
            using (var svc = new SqlRewriteRuleService(repo))
            {
                var id = svc.AddRule(".*", "(.+ +)@@VERSION", "$1GETDATE()");
                try
                {
                    svc.Enabled = true;
                    using (var conn = new SqlConnection(Cs))
                    using (var cmd = new SqlCommand("SELECT   @@VERSION", conn))
                    {
                        conn.Open();
                        Console.WriteLine($"SQL: {cmd.CommandText}\r\nResult: {cmd.ExecuteScalar()}");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine($"Exception: {e.Message}");
                }
                finally
                {
                    svc.RemoveRule(id);
                    Console.ReadLine();
                }
            }
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.9.3 563 7/13/2020
1.3.9.2 448 7/13/2020
1.3.9.1 447 7/7/2020
1.3.9 413 7/7/2020
1.3.8.2 485 6/30/2020
1.3.8.1 488 6/30/2020
1.3.8 452 6/30/2020
1.3.7 411 6/29/2020
1.3.6.2 460 6/29/2020
1.3.6.1 437 6/29/2020
1.3.6 432 6/29/2020
1.3.5 510 6/28/2020
1.3.4 460 6/27/2020
1.3.3 459 6/26/2020
1.3.2.1 594 6/25/2020
1.3.2 596 6/25/2020
1.3.1 513 6/24/2020
1.3.0 500 6/24/2020
1.2.0 522 6/23/2020
1.1.0 431 6/23/2020
1.0.0 453 6/23/2020

First release