diff --git a/.idea/.idea.cicm_web/riderModule.iml b/.idea/.idea.cicm_web/riderModule.iml index 1a4e0d95..46d586da 100644 --- a/.idea/.idea.cicm_web/riderModule.iml +++ b/.idea/.idea.cicm_web/riderModule.iml @@ -1,6 +1,19 @@ + + + + + + + + + + + + + diff --git a/cicm_web/Database/Mysql.cs b/cicm_web/Database/Mysql.cs new file mode 100644 index 00000000..baf01f8e --- /dev/null +++ b/cicm_web/Database/Mysql.cs @@ -0,0 +1,22 @@ +using MySql.Data.MySqlClient; + +namespace cicm_web.Database +{ + public class Mysql + { + MySqlConnection connection; + + public Mysql(string server, string user, string database, ushort port, string password) + { + string connectionString = + $"server={server};user={user};database={database};port={port};password={password}"; + + connection = new MySqlConnection(connectionString); + } + + ~Mysql() + { + connection?.Close(); + } + } +} \ No newline at end of file diff --git a/cicm_web/Program.cs b/cicm_web/Program.cs index 75413a25..ab4cf586 100644 --- a/cicm_web/Program.cs +++ b/cicm_web/Program.cs @@ -29,6 +29,7 @@ *******************************************************************************/ using System; +using cicm_web.Database; using DiscImageChef.Interop; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; @@ -38,6 +39,8 @@ namespace cicm_web { public static class Program { + static cicm_web.Database.Mysql database; + public static void Main(string[] args) { Console.Clear(); @@ -103,6 +106,8 @@ namespace cicm_web DetectOS.IsMono ? "Mono" : ".NET Core", DetectOS.IsMono ? Version.GetMonoVersion() : Version.GetNetCoreVersion()); + Console.WriteLine("\u001b[31;1mConnecting to MySQL database...\u001b[0m"); + database = new Mysql("localhost", "cicm", "cicm", 3306, "cicmpass"); Console.WriteLine("\u001b[31;1mStarting web server...\u001b[0m"); BuildWebHost(args).Run(); diff --git a/cicm_web/cicm_web.csproj b/cicm_web/cicm_web.csproj index 9ca488ac..97e2bfac 100644 --- a/cicm_web/cicm_web.csproj +++ b/cicm_web/cicm_web.csproj @@ -2,16 +2,23 @@ netcoreapp2.0 - 3.0.99.18 + 3.0.99.23 Canary Islands Computer Museum Copyright © 2003-2018 Natalia Portillo Canary Islands Computer Museum Website $(Version) + + $(Version)-{chash:8} built by {mname} in $(Configuration){!:, modified} + true + true + + +