Ejemplo n.º 1
0
		static InstrumentManager()
		{
			InstrumentManager.Server = new InstrumentDbServer();
            Type connectionType = null;
			string connectionString = String.Empty;
			switch (Framework.Storage.ServerType)
			{
                case DbServerType.MYSQL:
                    connectionType = Type.GetType("MySqlConnection");
                    connectionString = string.Format("Server={0};Database={1};Uid={2};Pwd={3}", "localhost", "freequant", "freequant", "freequant");
                    break;
                case DbServerType.SQLITE:
                    connectionType = Type.GetType("SQLiteConnection");
                    connectionString = string.Format("Data Source={0};Pooling=true;FailIfMissing=false;", Path.Combine(Framework.Installation.DataDir.FullName, "freequant.db"));
                    break;
                default:
                    throw new NotSupportedException("This db is not support yet.");
			}

            InstrumentManager.Server = null;
            InstrumentManager.Server = new InstrumentFileServer();
			InstrumentManager.Server.Open(connectionType, connectionString);
            InstrumentManager.Instruments = InstrumentManager.Server.Load();
//            foreach (Instrument instrument in InstrumentManager.Server.Load())
//            {
//                InstrumentManager.Instruments.Add(instrument);
//            }

            InstrumentManager.instrumentLists = new Hashtable();
		}
Ejemplo n.º 2
0
        static InstrumentManager()
        {
            InstrumentManager.Server = new InstrumentDbServer();
            Type   connectionType   = null;
            string connectionString = String.Empty;

            switch (Framework.Storage.ServerType)
            {
            case DbServerType.MYSQL:
                connectionType   = Type.GetType("MySqlConnection");
                connectionString = string.Format("Server={0};Database={1};Uid={2};Pwd={3}", "localhost", "freequant", "freequant", "freequant");
                break;

            case DbServerType.SQLITE:
                connectionType   = Type.GetType("SQLiteConnection");
                connectionString = string.Format("Data Source={0};Pooling=true;FailIfMissing=false;", Path.Combine(Framework.Installation.DataDir.FullName, "freequant.db"));
                break;

            default:
                throw new NotSupportedException("This db is not support yet.");
            }

            InstrumentManager.Server = null;
            InstrumentManager.Server = new InstrumentFileServer();
            InstrumentManager.Server.Open(connectionType, connectionString);
            InstrumentManager.Instruments = InstrumentManager.Server.Load();
//            foreach (Instrument instrument in InstrumentManager.Server.Load())
//            {
//                InstrumentManager.Instruments.Add(instrument);
//            }

            InstrumentManager.instrumentLists = new Hashtable();
        }