53 lines
1.2 KiB
C#
53 lines
1.2 KiB
C#
using System;
|
|
|
|
namespace MontoyaTech.MySqlPlus.Example
|
|
{
|
|
public class Program
|
|
{
|
|
[MySqlRow("cars")]
|
|
public class Car
|
|
{
|
|
[MySqlColumn(Id = true, Name = "id")]
|
|
public ulong Id = 0;
|
|
|
|
[MySqlColumn("make")]
|
|
public string Make = null;
|
|
|
|
[MySqlColumn("model")]
|
|
public string Model = null;
|
|
|
|
[MySqlColumn("year")]
|
|
public uint Year = 0;
|
|
|
|
//[MySqlColumn("dateCreated", typeof(DateTime2UnixConverter))]
|
|
//public DateTime DateCreated = DateTime.UtcNow;
|
|
}
|
|
|
|
public class DateTime2UnixConverter
|
|
{
|
|
|
|
}
|
|
|
|
public static void Main(string[] args)
|
|
{
|
|
var session = new MySqlSession("server=db.zone2d.com;user=root;database=zone2d;port=3306;password=-+W6!?Kv-6wDL2Vj5f=kC^Q&;SslMode=Required");
|
|
|
|
//var car = new Car() { Make = "Chevy", Model = "Camaro" };
|
|
|
|
//session.Insert(car);
|
|
|
|
//car.Model = null;
|
|
|
|
//session.Update(car);
|
|
|
|
var car2 = session.Get<Car>(9);
|
|
|
|
session.Insert(car2);
|
|
|
|
//session.Delete(car);
|
|
|
|
Console.WriteLine("Done.");
|
|
Console.ReadLine();
|
|
}
|
|
}
|
|
} |