using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.Data.SqlClient;
public static void Main()
var connection = new SqlConnection(FiddleHelper.GetConnectionStringSqlServer());
var customers = new List<Customer>();
customers.Add(new Customer() { Name = "Jonathan Magnan", Email = "info@zzzprojects.com" });
customers.Add(new Customer() { Name = "ZZZ Projects", Email = "sales@zzzprojects.com" });
customers.Add(new Customer() { Name = "Sara", Email = "sara@zzzprojects.com" });
connection.CreateTable(customers, CreateTableType.Permanent);
FiddleHelper.WriteTable("CustomCustomer:", connection.Query<Customer>("SELECT CustomerID, FullName as Name, Email, Version FROM CustomerWithAnnotation"));
[Table("CustomerWithAnnotation")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int CustomerID { get; set; }
[Column("FullName", TypeName="nvarchar(50)")]
public string Name { get; set; }
public string Email { get; set; }
public byte[] Version { get; set; }
public string NotMapped { get; set; }