Пример #1
0
        public void Init()
        {
            SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder();

            csb.InitialCatalog = "TestDB";
            csb.Password       = "******";
            csb.UserID         = "sa";
            csb.DataSource     = "localhost";

            _sut = new NovaDb(csb.ToString());
        }
Пример #2
0
        public Storage(string host, string database, string user, string password)
        {
            SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder();

            csb.DataSource     = host;
            csb.InitialCatalog = database;
            csb.UserID         = user;
            csb.Password       = password;
            _db = new NovaDb(csb.ToString());

            if (!_db.TableExists("Simulations"))
            {
                _db.Create("Simulations")
                .Column("Id", "INT IDENTITY(1,1)")
                .Column("Type", "varchar(250)")
                .Column("StartTime", "DATETIME default CURRENT_TIMESTAMP")
                .Column("EndTime", "DATETIME")
                .Column("PopulationSize", "INT")
                .Column("Duration", "INT")
                .Column("MutationRate", "INT")
                .Column("CrossoverRate", "INT")
                .Column("Complexity", "INT")
                .Column("SelectionPressure", "INT")
                .Column("Generations", "INT")
                .Column("Score", "INT")
                .Column("Chromosome", "text")
                .Execute();
            }
            if (!_db.TableExists("Generations"))
            {
                _db.Create("Generations")
                .Column("Id", "INT IDENTITY(1,1)")
                .Column("StartTime", "DATETIME default CURRENT_TIMESTAMP")
                .Column("Generation", "INT")
                .Column("Simulation", "INT")
                .Column("FittestScore", "INT")
                .Column("FittestChromosome", "text")
                .Execute();
            }
        }