本文整理汇总了C#中NorthwindDB类的典型用法代码示例。如果您正苦于以下问题:C# NorthwindDB类的具体用法?C# NorthwindDB怎么用?C# NorthwindDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NorthwindDB类属于命名空间,在下文中一共展示了NorthwindDB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EqualsNull3
public void EqualsNull3([IncludeDataContexts("Northwind")] string context)
{
using (var db = new NorthwindDB())
AreEqual(
from employee in Employee where employee.ReportsToEmployee != null select new { employee.ReportsToEmployee, employee },
from employee in db.Employee where employee.ReportsToEmployee != null select new { employee.ReportsToEmployee, employee });
}
示例2: EqualsNull2
public void EqualsNull2(string context)
{
using (var db = new NorthwindDB())
AreEqual(
from employee in Employee where employee.ReportsToEmployee != null select employee,
from employee in db.Employee where employee.ReportsToEmployee != null select employee);
}
示例3: CountTest
static void CountTest()
{
using (var db = new NorthwindDB())
{
int count = db.Employee.Count();
Console.WriteLine(count);
}
}
示例4: FirstOrDefaultEntitySet
public void FirstOrDefaultEntitySet([IncludeDataContexts("Northwind")] string context)
{
using (var db = new NorthwindDB())
{
AreEqual(
Customer.Select(c => c.Orders.FirstOrDefault()),
db.Customer.Select(c => c.Orders.FirstOrDefault()));
}
}
示例5: MultipleQuery
public void MultipleQuery([IncludeDataContexts("Northwind")] string context)
{
using (var db = new NorthwindDB())
{
var q =
from p in db.Product
select db.Category.Select(zrp => zrp.CategoryName).FirstOrDefault();
q.ToList();
}
}
示例6: AllNestedTest
public void AllNestedTest(string context)
{
using (var db = new NorthwindDB())
AreEqual(
from c in Customer
where Order.Where(o => o.Customer == c).All(o => Employee.Where(e => o.Employee == e).Any(e => e.FirstName.StartsWith("A")))
select c,
from c in db.Customer
where db.Order.Where(o => o.Customer == c).All(o => db.Employee.Where(e => o.Employee == e).Any(e => e.FirstName.StartsWith("A")))
select c);
}
示例7: SearchCondition2
public void SearchCondition2()
{
using (var db = new NorthwindDB())
{
AreEqual(
from cust in Customer
where cust.Orders.Count > 0 && cust.CompanyName.StartsWith("H")
select cust.CustomerID,
VisualBasicCommon.SearchCondition2(db));
}
}
示例8: SearchCondition2
public void SearchCondition2(string context)
{
using (var db = new NorthwindDB(context))
{
var dd = GetNorthwindAsList(context);
AreEqual(
from cust in dd.Customer
where cust.Orders.Count > 0 && cust.CompanyName.StartsWith("H")
select cust.CustomerID,
VisualBasicCommon.SearchCondition2(db));
}
}
示例9: FirstTest
static void FirstTest()
{
using (var db = new NorthwindDB())
{
var query = db.Employee;
foreach (var employee in query)
{
Console.WriteLine("{0} {1}", employee.EmployeeID, employee.FirstName);
}
}
}
示例10: FreeText1
public void FreeText1()
{
using (var db = new NorthwindDB())
{
var q =
from c in db.Category
join t in db.FreeTextTable<Northwind.Category,int>("[Description]", "sweetest candy bread and dry meat")
on c.CategoryID equals t.Key
select c;
q.ToList();
}
}
示例11: FreeText3
public void FreeText3([IncludeDataContexts("Northwind")] string context)
{
using (var db = new NorthwindDB())
{
var q =
from t in db.FreeTextTable<Northwind.Category,int>(c => c.Description, "sweetest candy bread and dry meat")
join c in db.Category
on t.Key equals c.CategoryID
select c;
q.ToList();
}
}
示例12: FreeText2
public void FreeText2(string context)
{
using (var db = new NorthwindDB())
{
var q =
from t in db.Category
where Sql.FreeText(Sql.AllColumns(), "sweet")
select t;
var list = q.ToList();
Assert.That(list.Count, Is.GreaterThan(0));
}
}
示例13: InnerJoinOnSingleColumn
public void InnerJoinOnSingleColumn(string context)
{
using (var db = new NorthwindDB(context))
{
var query =
from c in db.Category
join p in db.Product on c.CategoryID equals p.CategoryID
where !p.Discontinued
select c;
foreach (var category in query)
Console.WriteLine(category.CategoryID);
}
}
示例14: SingleTableTest
static void SingleTableTest()
{
using (var db = new NorthwindDB())
{
var query =
from e in db.Employee
where e.EmployeeID > 5
orderby e.LastName, e.FirstName
select e;
foreach (var employee in query)
{
Console.WriteLine("{0} {1}, {2}", employee.EmployeeID, employee.LastName, employee.FirstName);
}
}
}
示例15: Test
public void Test(string context)
{
using (var db = new NorthwindDB(context))
{
var zz =
from e in db.Employee
select e;
var lst = zz.ToList();
var item1 = lst.Take(1).Single();
var item2 = zz.Take(1).Single();
Assert.AreEqual(item1.EmployeeID, item2.EmployeeID);
}
}