To use all facilities like
IntelliSense or strong type binding we have to create native DataContext for our Employees mysql database.
DbLink helps us to do that.
DBLink has utility DBMetal.exe (aka SQLMetal) which analyses database structure and generates DBML file and corresponding classes also.
After that I can rewrite "Hello, World" as
MySqlConnection conn = new MySqlConnection("SERVER=localhost; DATABASE=employees;UID=root;PASSWORD=");
var emp = new DB_Employees(conn, new DbLinq.MySql.MySqlVendor());
var result =
from s in emp.Employees.Skip(20).Take(10)
select s.FirstName;
Listing 2.
Look it's better?
No comments:
Post a Comment