/*
|-------------------------------------------------------------------------------|
| Copyright © Computer Ease Limited |
| Address: 1/9 Bloack-A Lalmatia, Dhaka-1207, Bangladesh |
| Email: info@celimited.com, cease@bol-online.com, web: www.celimited.com |
| Unauthorized copy or distribution is strictly prohibited |
| Author: S. M. Russel, Last modified date: 18/04/2009 |
|-------------------------------------------------------------------------------|
*/
using System;
using System.Collections.Generic;
namespace Ease.Core.Model
{
#region Services
///
///This class returns the appropriate service factory according to configuration
///
public class Services
{
private static ServiceFactory _factory;
private const string defaultKey = "serviceHandler";
private static Dictionary _keyBaseServices;
static Services()
{
_keyBaseServices = new Dictionary();
_factory = new ServiceFactory(defaultKey);
}
///
/// Return default service facory
///
public static ServiceFactory Factory
{
get { return _factory; }
}
///
/// Crete an instance of services.
///
/// Key is used handle services
public Services(string serviceHandlerKey)
{
if (_keyBaseServices.ContainsKey(serviceHandlerKey))
return;
ServiceFactory svc = new ServiceFactory(serviceHandlerKey);
_keyBaseServices.Add(serviceHandlerKey, svc);
}
///
/// Return Service factory according to parameter.
///
/// Valid key of existing services
///
public ServiceFactory KeyBaseFactory(string svcKey)
{
if (_keyBaseServices != null && _keyBaseServices.ContainsKey(svcKey))
return _keyBaseServices[svcKey];
return null;
}
}
#endregion
}