Home Products Downloads Purchase Support News Members Company
SITE FEED
Support Forum
The fastest and most effective to get answers to your questions quickly. Click Here for more info.
FAQs
Quick answers to common questions. Click Here for more info.
Troubleshooting
Known issues and basic troubleshooting techniques for problems or unexpected behaviors. Click Here for more info.
Knowledgebase
Technical tips, How-to articles, and other tutorials about ApexSQL Tools. Click Here for more info.
Online Documentation
All of our help files for download or convenient viewing online. Click Here for more info.
Videos
Watch product demos, training videos, or tutorials of our products' main features.  We frequently upload new videos so check often for updates. Click Here for more info.

ApexSQL Knowledgebase

Tips and How-to Articles for Apex SQL Tools


How to Use External Assemblies in ApexSQL Code Templates

DESCRIPTION
The article describes how to reference an external assembly from a template in ApexSQL Code.

SOLUTION
The Assemblies property in ApexSQL Code allows you to reference an external assembly from a code template. For instance, to use the MessageBox class in a template for the purpose of displaying messages, the System.Windows.Forms.dll assembly must be referenced.

To add a reference to the assembly, click the Browse button in Import-Assembly of the Properties panel:



In the Assemblies dialog, enter the assembly name:



Important: The assembly must exist in the Global Assembly Cache (the same directory as ApexSQLCode) , or in the ApexSQLCode\bin directory.

The namespace of the assembly may be defined in the Property panel:



The Namespaces property is used to import a namespace so that it can easily be used on the template. In our example, if System.Windows.Forms namespace is not imported, System.Windows.Forms.MessageBox.Show() would have to be typed in the template every time we want to display a MessageBox from System.Windows.Forms.dll assembly:



If the namespace is imported, above code would be simplified as below:



Tip: To reference several assemblies, enter the name of each assembly into separate lines.



AUTHORS
William Parker
Denis Mak

LAST REVIEW DATE
21 August 2007

Labels:



© 2008 Apex SQL Tools All Rights Reserved | 1.919.968.8444 | Contact Us | Terms of Use | Privacy Policy