CLR-based Versus SP-based Global Change

The real difference between a stored procedure (SP)-based and CLR-based global change is whether the non-visual form logic is implemented in .NET code running on the web server or in T-SQL code running on the database server.

With a SP-based feature, you just author a T-SQL stored proc and and place the Transact-SQL code within the XML of the spec. Your code is very isolated, stateless, almost impossible to leak memory or have any impact outside the scope of your SP. Plus, your SP will be automatically wrapped in a transaction.

With a CLR-based feature, you can go crazy with any .NET code on the web server – make web service calls, touch the file system, call a 3rd party .NET library, use a distributed transaction. The bad news is YOU bear the burden of not hosing the web server since your code is running in the same process as the whole system.  So don’t do this unless you absolutely cannot accomplish what you need with T-SQL. You bear the burden of transaction management, raising  a rich error, proper use of Using/Dispose on any DB connections you open, etc.

The CLR code will live on the Infinity web server along with the server side code that constitutes the Blackbaud CRM application. Therefore, you must ensure that your code can “see” its dependencies from the point of view of the web server. Will your CLR code utilize web services? If so, you will need to verify that your code can connect to those services via HTTP. Will Blackbaud CRM be hosted by Blackbaud? Will your CLR code have visibility to your organization’s back office systems? Connectivity to dependant systems and services are topics that your technical team will need to solve early in your project’s lifecycle.

Within a GlobalChangeSpec, the CLR code which defines the business logic exists within a CLRDataForm XML element. Within the CLRDataForm tag you can see the reference to a .NET class that which is deployed to the web server. The actual CLR code exists within a separate class file.

See the following sections for more details: