1. C # in System.Environment.NewLine ::: acquired defined for this environment newline character string
2.db.Log = Console.Out; generating a log output display LINQ to SQL generated SQL commands. This logging feature (using the Log ) helpful for debugging, and help to determine whether the commands sent to the database accurately represent your query.
3.column properties DbType = "Int NOT NULL IDENTITY" IsDbGenerated = true generated automatically without setting
4 represents a foreign key: [Association (Storage = "_Customer", ThisKey = "CustomerID")]
5. Create a strongly typed view of the database
之前:DataContext db = new DataContext (@"c:\linqtest5\northwnd.mdf");
// Get a typed table to run queries.
Table<Customer> Customers = db.GetTable<Customer>();
just now:
添加: public class Northwind : DataContext
{
public Table<Customer> Customer;
public Table<Order> Orders;
public Northwind(string connection) : base(connection) { }
}
It is used: Northwind db = new Northwind (@ "C: \ linqtest5 \ northwnd.mdf"); to;
Reproduced in: https: //www.cnblogs.com/gorgeous1314/archive/2012/07/28/2613255.html