using System;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using MySql.Data.MySqlClient;
namespace dotnet_demo
{
public class Programcls
{
public static void Main(string[] args)
{
// CreateHostBuilder(args).Build().Run();
MySqlConnection connection = new MySqlConnection
{
ConnectionString = "server=127.0.0.1;Port=3306;database=test;Username=root;Password=root;charset='utf8';ConnectionReset=True;pooling=true;minpoolsize=1;maxpoolsize=4;ConnectionLifeTime=30;"
};
Insert(connection, "[email protected]", "jlkdjsklfjskl");
var rds = new CSRedis.CSRedisClient("127.0.0.1:6379,password=,defaultDatabase=13,poolsize=50,ssl=false,writeBuffer=10240,prefix=ftms_");
rds.Set("test1", "123123", 60);
var val = rds.Get("test1");
Console.WriteLine(val);
}
private static int Insert(MySqlConnection connection, string email, string password)
{
connection.Open();
MySqlCommand command = new MySqlCommand($"insert into users values (null,'{email}','{password}');", connection);
int count = command.ExecuteNonQuery();
Console.WriteLine(count);
connection.Close();
return count;
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}
}