当前位置: 首页>>代码示例>>C#>>正文


C# NorthwindDB类代码示例

本文整理汇总了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 });
 }
开发者ID:henleygao,项目名称:linq2db,代码行数:7,代码来源:Association.cs

示例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);
 }
开发者ID:jkshan,项目名称:linq2db,代码行数:7,代码来源:Association.cs

示例3: CountTest

		static void CountTest()
		{
			using (var db = new NorthwindDB())
			{
				int count = db.Employee.Count();

				Console.WriteLine(count);
			}
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:9,代码来源:Program.cs

示例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()));
     }
 }
开发者ID:henleygao,项目名称:linq2db,代码行数:9,代码来源:ElementOperationTest.cs

示例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();
            }
        }
开发者ID:henleygao,项目名称:linq2db,代码行数:11,代码来源:ElementOperationTest.cs

示例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);
 }
开发者ID:nectide,项目名称:linq2db,代码行数:11,代码来源:SetTest.cs

示例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));
			}
		}
开发者ID:starteleport,项目名称:bltoolkit,代码行数:11,代码来源:VisualBasicTest.cs

示例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));
			}
		}
开发者ID:CITnDev,项目名称:linq2db,代码行数:12,代码来源:VisualBasicTests.cs

示例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);
				}
			}
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:12,代码来源:Program.cs

示例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();
			}
		}
开发者ID:Lonli-Lokli,项目名称:bltoolkit,代码行数:13,代码来源:TableFunctionTest.cs

示例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();
            }
        }
开发者ID:henleygao,项目名称:linq2db,代码行数:13,代码来源:TableFunctionTest.cs

示例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));
            }
        }
开发者ID:ru-sh,项目名称:linq2db,代码行数:14,代码来源:TableFunctionTest.cs

示例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);
			}
		}
开发者ID:ronnyek,项目名称:linq2db,代码行数:14,代码来源:JoinOperatorTests.cs

示例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);
				}
			}
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:16,代码来源:Program.cs

示例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);
			}
		}
开发者ID:ronnyek,项目名称:linq2db,代码行数:16,代码来源:Issue475Tests.cs


注:本文中的NorthwindDB类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。