mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Added MySQL connection.
This commit is contained in:
13
.idea/.idea.cicm_web/riderModule.iml
generated
13
.idea/.idea.cicm_web/riderModule.iml
generated
@@ -1,6 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="RIDER_MODULE" version="4">
|
<module type="RIDER_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/app.config.transform" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/docs/MySqlCommand.xml" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/docs/MySqlCommandBuilder.xml" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/docs/MySqlConnection.xml" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/docs/MySqlConnectionStringBuilder.xml" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/docs/MySqlDataAdapter.xml" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/docs/MySqlDataReader.xml" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/docs/MySqlException.xml" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/docs/MySqlHelper.xml" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/docs/MySqlParameter.xml" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/docs/MySqlParameterCollection.xml" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/docs/MySqlTransaction.xml" />
|
||||||
|
<content url="file://$USER_HOME$/.nuget/packages/mysql.data/6.10.6/contentFiles/any/netcoreapp2.0/web.config.transform" />
|
||||||
<content url="file://$MODULE_DIR$/../.." />
|
<content url="file://$MODULE_DIR$/../.." />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
22
cicm_web/Database/Mysql.cs
Normal file
22
cicm_web/Database/Mysql.cs
Normal file
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using cicm_web.Database;
|
||||||
using DiscImageChef.Interop;
|
using DiscImageChef.Interop;
|
||||||
using Microsoft.AspNetCore;
|
using Microsoft.AspNetCore;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
@@ -38,6 +39,8 @@ namespace cicm_web
|
|||||||
{
|
{
|
||||||
public static class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
|
static cicm_web.Database.Mysql database;
|
||||||
|
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
@@ -103,6 +106,8 @@ namespace cicm_web
|
|||||||
DetectOS.IsMono ? "Mono" : ".NET Core",
|
DetectOS.IsMono ? "Mono" : ".NET Core",
|
||||||
DetectOS.IsMono ? Version.GetMonoVersion() : Version.GetNetCoreVersion());
|
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");
|
Console.WriteLine("\u001b[31;1mStarting web server...\u001b[0m");
|
||||||
|
|
||||||
BuildWebHost(args).Run();
|
BuildWebHost(args).Run();
|
||||||
|
|||||||
@@ -2,16 +2,23 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
<Version>3.0.99.18</Version>
|
<Version>3.0.99.23</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
<ApplicationVersion>$(Version)</ApplicationVersion>
|
<ApplicationVersion>$(Version)</ApplicationVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<NrtRevisionFormat>$(Version)-{chash:8} built by {mname} in $(Configuration){!:, modified}</NrtRevisionFormat>
|
||||||
|
<NrtResolveSimpleAttributes>true</NrtResolveSimpleAttributes>
|
||||||
|
<NrtShowRevision>true</NrtShowRevision>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
|
||||||
<PackageReference Include="Microsoft.NETCore.App" Version="2.0.6" />
|
<PackageReference Include="Microsoft.NETCore.App" Version="2.0.6" />
|
||||||
<PackageReference Include="MSBump" Version="2.3.2" PrivateAssets="All" />
|
<PackageReference Include="MSBump" Version="2.3.2" PrivateAssets="All" />
|
||||||
|
<PackageReference Include="MySql.Data" Version="6.10.6" />
|
||||||
|
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.2.2-beta" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
|
||||||
|
|||||||
Reference in New Issue
Block a user