Simplified some logic and added initial Insert, Update, Get, Delete session functions.
This commit is contained in:
@ -4,21 +4,23 @@ namespace MontoyaTech.MySqlPlus.Example
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public class Car : MySqlRow
|
||||
[MySqlRow("cars")]
|
||||
public class Car
|
||||
{
|
||||
[MySqlRowId]
|
||||
[MySqlColumn]
|
||||
[MySqlColumn(Id = true, Name = "id")]
|
||||
public ulong Id = 0;
|
||||
|
||||
[MySqlColumn("make")]
|
||||
[MySqlColumnAlias("Make")]
|
||||
public string Make = null;
|
||||
|
||||
[MySqlColumn("mode")]
|
||||
[MySqlColumn("model")]
|
||||
public string Model = null;
|
||||
|
||||
[MySqlColumn("dateCreated", typeof(DateTime2UnixConverter))]
|
||||
public DateTime DateCreated = DateTime.UtcNow;
|
||||
[MySqlColumn("year")]
|
||||
public uint Year = 0;
|
||||
|
||||
//[MySqlColumn("dateCreated", typeof(DateTime2UnixConverter))]
|
||||
//public DateTime DateCreated = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public class DateTime2UnixConverter
|
||||
@ -28,7 +30,24 @@ namespace MontoyaTech.MySqlPlus.Example
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, World!");
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user