Quickstart - Vidarls/Simple.Data.Mysql GitHub Wiki

#Quickstart This is just a quick code example on using the Simple.Data framework against a MySql database.

For more info and samples:

Now to the MySql Sample:

  1. Create a new console application
  2. Add Simple.Data.Mysql using Nuget
  3. Use Database.OpenConnection("Connectionstring") with the appropriate connection string to your MySql database.
  4. You are now ready to interact with your MySql database
using System;
using Simple.Data;

namespace SimpleDataDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            var db = Database.OpenConnection
                ("server=localhost;user=SimpleData;database=SimpleDataTest;password=test;");
            var users = db.users.All();
            foreach (var user in users)
            {
                Console.WriteLine(user.Name);
            }
            Console.ReadLine();
        }
    }
}