Created
November 13, 2014 20:45
-
-
Save Suchiman/5b7621d3ab35a2b67d92 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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>(); } } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice one :)