Exemplo n.º 1
0
        public RentalService()
        {
            System.Configuration.AppSettingsReader r = new System.Configuration.AppSettingsReader();
            string path = (string)r.GetValue("DataFaceSimulationsettings", typeof(String));
            //class name to load
            string line;

            // Read the file and display it line by line.
            using (System.IO.StreamReader file = new System.IO.StreamReader(path))
            {
                line = file.ReadToEnd();
                file.Close();
            }
            SimulationManager.Simulator s = new SimulationManager.Simulator();

            //s.Check("DataFaceSimulationsettings: " + line);
            if (line=="DataFacade1")
            {
                df = new DataFacade1();
                //s.Check("DataFaceSimulationsettings: instantiated " + line);
            }
            else if (line == "DataFacade2")
            {
                df = new DataFacade2();
                //s.Check("DataFaceSimulationsettings: instantiated " + line);
            }
            else
            {
                throw new Exception("DataFacade not loaded, check the following appsetting in web.config -> 'DataFaceSimulationsettings'");
            }
        }