private void _CreateDatabase()
        {
            using (var nhibernateConfigurator = new NhibernateConfigurator())
            {
                var configuration        = nhibernateConfigurator.GetConfiguration();
                var connectionString     = configuration.Properties["connection.connection_string"];
                var scriptsDirectoryPath = Path.Combine(_GetAssemblyCodeBaseLocation(), "DatabaseScripts");

                var builderOfDatabase = new BuilderOfDatabase(() => new NpgsqlConnection(connectionString));
                builderOfDatabase.BuildDatabase(scriptsDirectoryPath);
            }
        }
Пример #2
0
        static void Main()
        {
            Console.WriteLine("Choose from the following options and press enter:");
            Console.WriteLine("1 Generate database schema sql file");

            var line = Console.ReadLine();

            if (line == "1")
            {
                var databaseSchemaFileName = "UsefulNotifications_generated_database_schema.sql";

                using (var nhibernateConfigurator = new NhibernateConfigurator(shouldMapDtos: false))
                {
                    new DatabaseSchemaGenerator(databaseSchemaFileName, nhibernateConfigurator).Generate();
                    Console.WriteLine($"Database schema sql file has been generated into {databaseSchemaFileName}");
                }

                _AddSemicolonsToPostgreSqlScript(databaseSchemaFileName);
            }
        }