Using Keyword

Use using keyword can import the namespace, which can avoid the global identity.

Example

using NorthwindDemo;
select e.FirstName, e.LastName 
from Employee as e
Same as
select e.FirstName, e.LastName 
from NorthwindDemo.Employee as e

Auto Imported Namespace

When use CreateQuery method create a query, ALinq Dynami will auto import the namespace of the dataContext instance.
var db = new NorthwindDemo.NorthwindDataContext();
var esql = "select e.FirstName, e.LastName from Employee as e";
var q = db.CreateQuery(esql)
Same as
var db = new NorthwindDemo.NorthwindDataContext();
var esql = @"using NorthwindDemo;
             select e.FirstName, e.LastName from Employee as e";
var q = db.CreateQuery(esql)

Last edited Mar 24, 2013 at 9:02 AM by ansiboy, version 2

Comments

No comments yet.