53 lines
1.2 KiB
C#
Raw Normal View History

2023-01-27 11:34:31 -08:00
using System;
namespace MontoyaTech.MySqlPlus.Example
{
public class Program
{
[MySqlRow("cars")]
public class Car
2023-01-27 11:34:31 -08:00
{
[MySqlColumn(Id = true, Name = "id")]
2023-01-27 11:34:31 -08:00
public ulong Id = 0;
[MySqlColumn("make")]
public string Make = null;
[MySqlColumn("model")]
2023-01-27 11:34:31 -08:00
public string Model = null;
[MySqlColumn("year")]
public uint Year = 0;
//[MySqlColumn("dateCreated", typeof(DateTime2UnixConverter))]
//public DateTime DateCreated = DateTime.UtcNow;
2023-01-27 11:34:31 -08:00
}
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();
2023-01-27 11:34:31 -08:00
}
}
}