calsoft enterprise solutions

White Papers

Interface Creation and Deployment at Runtime

Overview

Interface creation and deployment at runtime (ICDR) is a programming system that is developed using Microsoft .NET and enables programmers to quickly build working programs. In general, these systems provide a number of tools to help implement different software architectures that would, normally take a large development effort. Historically, these systems have tended to emphasize reducing development time, sometimes, at the expense of generating efficient executable code. Nowadays, many of these systems produce extremely fast and efficient code.

How does it work?

The Interface creation and deployment at Runtime tool consists of three major modules.
They are

Database connector and XML generator

A database is a collection of information organized in such a way that a computer program can quickly select desired pieces of data. Fields, records, and tables organize relational databases. A field is a single piece of information; a record is one complete set of fields; and a table is a collection of records. Storing content in fields rather than static pages makes that content appropriate for dynamic delivery. This module establishes connection with the database ( SQL, MSACESS, DBASE, ORACLE, etc.. ) and creates a XML file such that the Namespace name, Class name and Member names were created as XMLTags. All these names are highly organized such that

Namespace name   -   Database name

Class name   -   Table name

Member   -   Fields or Columns name

Therefore the output of the first module is a XML file with all necessary details to create a class file.

XML reader and Class file generator

This module contains two sub divisions namely XML reader and Class file generator. The XML reader reads the XML file and gets the Namespace, Class and Member names. And all these details are passed on to the next sub division Class file generator that generates a Class file with the Class names and Member names specified in the XML file using CodeDOM.

The CodeDom namespace contains types for managing the generation and compilation of source code in supported programming languages. Code generators can each produce source code in a particular programming language based on the structure of Code Document Object Model (CodeDOM) source code models consisting of elements provided by the CodeDOM namespace. The Class file generated using CodeDOM is given as an input to the next Module.

Class File Compiler and DLL generator

The Class file given to this module is complied in run time using CodeDOM compiler. While using CodeDOM compiler the compile options should be set to create Dynamic Link Library (DLL). This DLL is the output of Runtime Interface creation and deployment toolkit.

This DLL contains functions for retrieving and updating data from the database like Gettable Values and UpdateTable respectively. Therefore the Application, which uses this DLL, need not connect to the Database or use any SQL queries to get or set the data in the database.

The below screen shot is a Runtime Interface creation and deployment toolkit Application that connects with the database server and displays all the datatypes listed in the Server. The user can select the Database to view its tables, Stored procedures and views and the user can select the appropriate tables, stored procedures and views and create a XML file by clicking create XML file button.

This XML file is then read and converted to class file and compiled internally by using CodeDOM code generator and CodeDOM compiler respectively. The output will be a DLL with name of the selected Database.

Client Application

The Client application that needs the data from the Database should use the DLL provided by the Runtime Interface creation and deployment toolkit to access the Database. As the object of the Class should be created in the run time Reflections must be used in the client application to access the member variables and the methods of the Class.

Reflection enables a program to dynamically analyze and discover elements (such as fields, methods, constructors, and attributes) of types (such as classes, interfaces, and structures) in existing assemblies. When this type information is obtained, it may be simply displayed Or, the types may be instantiated, accessed, and invoked in a very dynamic and interactive manner, making it possible to implement interesting programming tools such as an interpreted test script language. The Client application should implement this concept to Get table information from the database and display the information to the User. Here there is no direct interactions between the Client application and the database, and all SQL Queries must pass through the DLL.

The below screen shot is a Client application that displays all the Tables in the database VisionRD. When any table is selected the table information is updated in the Data grid displaying data to the user. The table information could be modified and the database could be updated by using the Update button.

Versioning in .NET

In .Net Assemblies have a version number as part of its identity. As such, two assemblies that different version numbers are considered by the runtime to be completely different assemblies. The version number is stored in the assembly manifest along with other identity information, including the assembly name and public key, as well as information on relationships and identities of other assemblies connected with the application.

When an assembly is built, the development tool records dependency information for each assembly that is referenced in the assembly manifest. The runtime uses these version numbers, in conjunction with configuration information set by an administrator, an application, or a publisher, to load the proper version of a referenced assembly. The runtime distinguishes between regular and strong-named assemblies for the purposes of versioning. Version checking only occurs with strong-named assemblies.

Side-by-side execution is the ability to store and execute multiple versions of an application or component on the same computer. This means that you can have multiple versions of the runtime, and multiple versions of applications and components that use a version of the runtime, on the same computer at the same time. Side-by-side execution gives you more control over what versions of a component an application binds to, and more control over what version of the runtime an application uses. Support for side-by-side storage and execution of different versions of the same assembly is an integral part of strong naming and is built into the infrastructure of the runtime. Because the strong-named assembly's version number is part of its identity, the runtime can store multiple versions of the same assembly in the global assembly cache and load those assemblies at run time. Although the runtime provides you with the ability to create side-by-side applications, side-by-side execution is not automatic.

Advantages of Runtime Interface Creation and Deployment Toolkit

  • Implements the Three-tier architecture thereby increasing speed and Dexterity
  • It reduces the Development time to a considerable extent
  • By changing the XML file alone new classes and methods could be added to the Class file therefore only minimal efforts are needed to create a new DLL with new implementations