CodeDom – An Advance Strategy For Code Technology at Operate Time
CodeDom, which stands for Code Doc Object Model, is 1 advance strategy supplied by Microsoft.Internet Framework to produce code at operate-time. At software stage, it provides programmers the capability to publish a single language-unbiased code that can emit supply code in a specific language for afterwards demands.
Code Document Item Model lies in the System.CodeDom namespaces of the.Internet Framework. The CodeDom has the following advantages:
From a solitary code that utilizes the CodeDom to symbolize the composition of supply code that can create supply code of any language supports the CodeDom specification.
The CodeDom permits resource code and assemblies to be designed, compiled, and executed dynamically at runtime.
It offers a language impartial object model for representing the structure of source code in memory.
qr code generator It functions as a supply code translator amongst distinct languages.
Frequent usages of the CodeDOM incorporate:
Making template code for emitting code wizards, coding examples, XML Web companies shopper proxies, etc.
Dynamically compiling code in languages supported.
T4 (Text Template Transformation Toolkit) is another powerful era tool supplied by Microsoft.internet Framework. Not like the CodeDom, T4 makes use of string concatenation to develop textual template to make code. A lot of the output code will be place into template blocks, in purchase to make the code generator simple to create and personalize. Nevertheless, T4 is a language dependent and will want a independent code generator for each output language. On the other hand, the CodeDom permits builders use a solitary source code to make the identical issue in diverse languages, which certainly give a large edge in developing.Web Framework tools.
Most programing constructs, like declarations, statements, arrays, casts, iterations, mistake managing and other people, is supported by the CodeDom. For programing constructs that are not presently supported in CodeDom, “snippet” classes such as the CodeSnippetCompileUnit, CodeSnippetExpression, CodeSnippetStatement, and CodeSnippetTypeMember can be employed as generic illustration. For creating code in a certain language, a corresponding CodeDomProvider class will be needed.
At present there are Microsoft.CSharp.CSharpCodeProvider and Microsoft.VisualBasic.VBCodeProvider that can be employed to make C Sharp code and VisuaBasic.web code. Other programming languages will not have CodeDomProvider but, and might not have easy techniques to signify some CodeDom constructions (delegates, enums, templates, and framework) thanks to variation in language specs. Nevertheless, creating a CodeDomProvider is not a extremely intricate task, if the enter CodeDom composition is restricted. Programmers can always create a CodeDomProvider for a distinct language by inheriting from CodeDomProvider, and toss exceptions if the construction is also tough to signify.