-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTools.cs
38 lines (33 loc) · 1.02 KB
/
Tools.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Microsoft.Extensions.Configuration;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Text;
namespace LeafTests
{
class Tools
{
public static Boolean InitDatabase(IConfiguration _config)
{
try
{
string script = System.IO.File.ReadAllText(@"C:\Projects\CoreLeaf\Database\LeafDBv0.1.sql");
using (MySqlConnection conn = new MySqlConnection(_config.GetValue<String>("ConnectionStrings:Testing")))
{
conn.Open();
MySqlCommand cmd = new MySqlCommand(script, conn);
cmd.ExecuteNonQuery();
}
return true;
} catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
return false;
}
}
private static MySqlConnection GetConnection()
{
throw new NotImplementedException();
}
}
}