|
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: ApexSQL Code |
© 2008 Apex SQL Tools All Rights Reserved | 1.919.968.8444 | Contact Us | Terms of Use | Privacy Policy






