<a href="http://www.micropoll.com/akira/mpview/585320-168921">Click Here for Poll</a><a href="http://www.questionpro.com" title="online surveys">Online Survey</a><BR> | <a href="http://www.micropoll.com" title="Website Polls">Website Polls</a><BR> | <BR><a href="http://www.micropoll.com/akira/MicroPoll?mode=html&id=168921">View MicroPoll</A></div>

Visual Studio 2010!

Read now >

Windows Mobile Development Thoughts

Read now >

View Now
DevSource RSS FEEDS
XML Want an easy way to keep up with breaking tech news? And the Get DevSource headlines delivered to your desktop with RSS.
ADVERTISEMENT
ADVERTISEMENT

 

DevSource.com: Your Source for Visual Studio on Facebook
ADVERTISEMENT
Building Plug-ins with C# .NET: Part 1
By Nathan Good

Rate This Article: Add This Article To:

Building Plug-ins with C# .NET: Part 1 - ' Where Do We Go '
( Page 4 of 4 )

From Here?">

Summary

The downloadable solution contains three projects: AuthenticationPlugin.Common, AuthenticationPlugin.Plugins.MyTest, and AuthenticationPlugin.UI.UITester. The AuthenticationPlugin.Common project contains the IAuthenticationPlugin interface and the AuthenticationPluginAttribute, which are used to develop new plug-ins and call them with other applications. The AuthenticationPlugin.Plugins.MyTest project contains a very simple plug-in. The AuthenticationPlugin.UI.UITester project contains a Windows application that can be run to visually test the plug-in.

Some of the concepts that were reviewed in this article are the use of interfaces, inheritance, and reflection.

The basic steps that were followed to create the solution were:

  • Create a common project with an interface and an attribute class which will be used by the plug-ins and applications to define, load, and call the plug-ins.
  • Create a plug-in by adding a new project that will compile to its own .NET assembly. This project will refer to the common project. The implementation class implements the interface and is identified by an attribute. The attribute is metadata that is used in reflection later to know which class, or type, to load and use.
  • Create an application that uses the .NET reflection classes Assembly and Activator to load the assembly, find the implementation class, and run the correct method.

The downloadable solution contains the three projects and code that demonstrates these concepts.

The next article in this series will cover what happens when one of these plug-ins requires its own configuration, and will also cover authenticating users against an XML file.

Download the code for this project here.



 
 
>>> More ASP and .Net Coding Techniques Articles          >>> More By Nathan Good