using System;
using System.Collections.Generic;

namespace MarketData.DataAccess
{
  public class MainDataSource
  {
//    private DataSourceEx dataSource = new DataSourceEx();
    private Dictionary<String,DataSourceEx> dataSourceDictionary = new Dictionary<String,DataSourceEx>();
    private static MainDataSource mainDataSource;
    private MainDataSource()
    {
    }
    public static MainDataSource Instance
    {
      get
      {
        lock (typeof(MainDataSource))
        {
          if (null == mainDataSource)
          {

            mainDataSource = new MainDataSource();
            DataSourceEx marketDataSource = new DataSourceEx("market_data");
            mainDataSource.dataSourceDictionary.Add("market_data",marketDataSource);

            DataSourceEx portfolioDataSource = new DataSourceEx("portfolio_data");
            mainDataSource.dataSourceDictionary.Add("portfolio_data",portfolioDataSource);

            DataSourceEx userDataSource = new DataSourceEx("user_data");
            mainDataSource.dataSourceDictionary.Add("user_data",userDataSource);
          }
          return mainDataSource;
        }
      }
    }
    public DataSourceEx LocateDataSource(String sourceKey)
    {
      return mainDataSource.dataSourceDictionary[sourceKey];
    }
  }
}
