Try Playground
Show / Hide Table of Contents

Setup SQL Server for CLR Procedures [Deprecated]

NCache provides you with CLR stored procedures that synchronize the cache with the database. It does not involve database monitoring or a notification mechanism; instead, you can execute any complex logic using CLR procedures, minimizing the risk of excessive notifications.

How to Setup SQL Server for CLR Procedures

Follow the given steps on the database in order to enable CLR procedures and then implement them.

Step 1: Enable CLR on Database

In order to use CLR stored procedures, make sure that CLR integration is enabled on the database. If you haven't enabled CLR integrations already, then execute the following command to enable CLR integrations:

-- Enable CLR Integration on Database
sp_configure 'clr enabled', 1
GO
RECONFIGURE
GO

Step 2: Install NuGet Package for Assemblies and Deploy Them

To use NCache in the CLR stored procedure, NCache assemblies need to be registered with the database. This will enable the database to use the NCache API in stored procedures. NCache provides CLRStoredProcedure.NCache for the required dependent assemblies. Therefore, you first need to download the CLRStoredProcedure.NCache NuGet package or install it in your application. The required assemblies should be referred from this NuGet package.

Step 3: Deploy the Assemblies

Once you have the NuGet package, deploy the assemblies using the following commands:

Note

In order to deploy Alachisoft.NCache.Client.dll in the following query, you need to provide the path according to the location of the NuGet package.

USE Northwind
ALTER DATABASE Northwind
SET TRUSTWORTHY ON;
GO
-- REGISTER SYSTEM ASSEMBLIES ...
DROP ASSEMBLY [System.Web]
DROP ASSEMBLY [System.Management]
DROP ASSEMBLY [Microsoft.CSharp]


CREATE ASSEMBLY [System.Web] FROM N'C:\Windows\Microsoft.Net\Framework64\v4.0.30319\System.Web.dll' WITH PERMISSION_SET=UNSAFE

CREATE ASSEMBLY [System.Management] FROM N'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Management.dll' WITH PERMISSION_SET=UNSAFE

CREATE ASSEMBLY [Microsoft.CSharp] FROM N'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.CSharp.dll' WITH PERMISSION_SET=UNSAFE

CREATE ASSEMBLY [Alachisoft.NCache.Client] FROM N'C:\Users\john_doe\Downloads\CLRStoredProcedure.NCache\lib\net40\Alachisoft.NCache.Client.dll' WITH PERMISSION_SET=UNSAFE

After following these steps, the environment for CLR procedures will be set. Please refer to Programmer's Guide to get help in the implementation of stored procedures.

Setup SQL Server Environment
Setup Oracle Database Environment
Setup Ole​Db Environment
Monitor Caches

In This Article
  • How to Setup SQL Server for CLR Procedures
    • Step 1: Enable CLR on Database
    • Step 2: Install NuGet Package for Assemblies and Deploy Them
    • Step 3: Deploy the Assemblies

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Professional
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - 2025. All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top