Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            AbsFactory f = null;

            //f = new ColaFactory();
            f = new PepsiFactory();

            Client.Client client = new Client.Client(f);
            Console.WriteLine(f.GetBottle());
            Console.WriteLine(f.GetWatter());
            client.Interact();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Business layer constructor
 /// </summary>
 /// <param name="pDALayerType">Data type of the DAL DBFactory. e.g Type.GetType("ML.AccessControl.DAL.SQLite.DBFactory, ML.AccessControl.DAL.SQLite", true)</param>
 /// <param name="pConnectionString">Connection string to the database</param>
 /// <param name="pCacheDALAssembly">If pCacheDALAssembly is true then subsequent instantiation of the BusManager class will reuse the same DAL assembly. Always set it true if you are not intending to switch the data provider at runtime.</param>
 public BusManager(Type pDALayerType, string pConnectionString, bool pCacheDALAssembly)
 {
     _bCacheDALAssembly = pCacheDALAssembly;
     if (_bCacheDALAssembly)
     {
         if (_dbStaticFactory == null)
         {
             _dbStaticFactory = (AbsFactory)Activator.CreateInstance(pDALayerType);
         }
         _dbManager = _dbStaticFactory.CreateDBManager(pConnectionString);
     }
     else
     {
         _dbFactory = (AbsFactory)Activator.CreateInstance(pDALayerType);
         _dbManager = _dbFactory.CreateDBManager(pConnectionString);
     }
 }
Ejemplo n.º 3
0
 public Client(AbsFactory factoryies)
 {
     watter = factoryies.GetWatter();
     bottle = factoryies.GetBottle();
 }
Ejemplo n.º 4
0
 public Clients(AbsFactory factories)
 {
     window = factories.CreateWindow();
     button = factories.CreateButton();
 }