Click here to Skip to main content
12,077,586 members (47,061 online)
Click here to Skip to main content

Stats

81.1K views
570 downloads
155 bookmarked
Posted

Learn How to Build a Provider Framework - With an Easy to Understand Example Towards Applying the Provider Pattern

, 20 Jul 2007 CPOL
After reading this article, you'll be able to: (1) Change your mindset a little bit, and start thinking about 'frameworks' instead of just 'code' (2) Understand a lot about practically applying the Provider pattern in your projects (3) Gain much knowledge regarding XML config files and providers.
publisher.zip
Sumeru.Publisher
bin
Debug
Sumeru.Publisher.dll
obj
Debug
temp
TempPE
Publisher.xsx
Sumeru.Publisher.csproj.user
Sumeru.Publisher.FTPPublisher
bin
Debug
Sumeru.Publisher.dll
Sumeru.Publisher.FTPPublisher.dll
obj
Debug
temp
TempPE
Sumeru.Publisher.FTPPublisher.csproj.user
Sumeru.Publisher.Loader
App.ico
bin
Debug
Sumeru.Publisher.dll
Sumeru.Publisher.FTPPublisher.dll
Sumeru.Publisher.Loader.exe
obj
Debug
temp
TempPE
Sumeru.Publisher.Loader.csproj.user
using System;
using System.Xml.Serialization;
using System.IO;

namespace Sumeru.Publisher.Framework
{
	/// <summary>
	/// Summary description for PublisherLoader.
	/// </summary>
	public class PublisherLoader
	{
		public PublisherLoader()



		{
			//
			// TODO: Add constructor logic here
			//
		}

	 /// <summary>
	 /// Load all the publishers from the configuration, and create an instance
	 /// using the factory
	 /// </summary>
     /// <param name="path"></param>
		public void LoadPublisher(string path) 
		{
			Framework.Data.Publishers pubs;
			XmlSerializer xsr=new XmlSerializer(typeof(Framework.Data.Publishers));
			pubs=(Framework.Data.Publishers) xsr.Deserialize(new StreamReader(path));

			foreach (Framework.Data.Publisher p in pubs) 
			{
				Framework.IPublisher ipub=Framework.PublisherFactory.CreatePublisher(p.AssemblyName,p.ClassName,p.SettingCollection);
				ipub.Get();
				ipub.Put(); 
			}
		}

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author


You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.160212.1 | Last Updated 20 Jul 2007
Article Copyright 2007 by Anoop Madhusudanan
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid