Esempio n. 1
0
 When_calling_CreateSqlCreateStatementFromDto_with_a_test_dto_it_will_generate_the_expected_sql_create_statement_case_1
     ()
 {
     Assert.That(_sqlCreateBuilder.CreateSqlCreateStatementFromDto(typeof(TestDtoCase1)),
                 Is.EqualTo(
                     "CREATE TABLE TestDtoCase1 ([Column1] [nvarchar(250)],[Column2] [nvarchar(250)],[Column3] [nvarchar(250)]);"));
 }
        private void DoCreateDatabaseSchema()
        {
            SQLiteConnection.CreateFile(DATA_BASE_FILE);

            var sqLiteConnection = new SQLiteConnection(string.Format("Data Source={0}", DATA_BASE_FILE));

            sqLiteConnection.Open();

            using (DbTransaction dbTrans = sqLiteConnection.BeginTransaction())
            {
                using (DbCommand sqLiteCommand = sqLiteConnection.CreateCommand())
                {
                    foreach (var dto in dtos)
                    {
                        sqLiteCommand.CommandText = sqlCreateBuilder.CreateSqlCreateStatementFromDto(dto);
                        sqLiteCommand.ExecuteNonQuery();
                    }
                }
                dbTrans.Commit();
            }

            sqLiteConnection.Close();
        }