ARTICLE

Implement Concrete Factory Design Pattern using Reflection in VB.NET

Posted by Siva Kumar B Articles | Visual Basic .NET November 10, 2012
Reflection is used to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object. In this example, we implement Concrete Factory Pattern using Reflection to fetch records from MS-Access and MS-SQL Database.
Reader Level:
Download Files:
 

In order for a Class A to create an instance of Class B, A must have a reference to B, which means that class B must be instantiated and a reference to object B must be available to A. A has a direct reference to B and they are tightly coupled.

In order to reduce tight coupling between these two objects, it is best to give the responsibility of creating B to a factory class using Reflection. It then becomes less coupled.

Reflection is used to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object. In this example, we implement Concrete Factory Pattern using Reflection to fetch records from MS-Access and MS-SQL Database. It is possible to configure this application to retrieve data from Oracle DB also.

Login to add your contents and source code to this article
post comment
     
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Join a Chapter