Skip to content

Instantly share code, notes, and snippets.

@Suchiman
Created November 13, 2014 20:45
Show Gist options
  • Select an option

  • Save Suchiman/5b7621d3ab35a2b67d92 to your computer and use it in GitHub Desktop.

Select an option

Save Suchiman/5b7621d3ab35a2b67d92 to your computer and use it in GitHub Desktop.
using LinqToDB;
using LinqToDB.Data;
using LinqToDB.DataProvider.SQLite;
using LinqToDB.Mapping;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
using (var db = new DbNorthwind())
{
db.CreateTable<Product>();
}
}
}
[Table(Name = "Products")]
public class Product
{
[PrimaryKey, Identity]
public int ProductID { get; set; }
[Column(Name = "ProductName"), NotNull]
public string Name { get; set; }
}
public class DbNorthwind : DataConnection
{
public DbNorthwind() : base(new SQLiteDataProvider(), "Data Source=db.sqlite") { }
public ITable<Product> Product { get { return GetTable<Product>(); } }
}
}
@slashkite
Copy link
Copy Markdown

nice one :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment