• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# NorthwindDB类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NorthwindDB的典型用法代码示例。如果您正苦于以下问题:C# NorthwindDB类的具体用法?C# NorthwindDB怎么用?C# NorthwindDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NorthwindDB类属于命名空间,在下文中一共展示了NorthwindDB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Contains12

        public void Contains12(string context)
        {
            using (var db = new NorthwindDB())
            {
                var q =
                    from e in db.EmployeeTerritory
                    group e by e.Employee into g
                    where g.Key.EmployeeTerritories.Count() > 1 && g.Count() > 2
                    select new
                    {
                        g.Key.LastName,
                        //cnt = g.Where(t => t.Employee.FirstName.Contains("an")).Count(),
                    };

                q.ToList();
            }
        }
开发者ID:ili,项目名称:linq2db,代码行数:17,代码来源:SetTests.cs


示例17: NorthwindTest

		static void NorthwindTest()
		{
			using (var db = new NorthwindDB())
			{
				var q =
					from order in db.Orders
					select new
					{
						order.Customer.CompanyName,
						Count = order.OrderDetails.Count(),
					};

				foreach (var item in q)
				{
					WriteLine($"Company Name: {item.CompanyName}, Count: {item.Count}");
				}
			}
		}
开发者ID:donners77,项目名称:examples,代码行数:18,代码来源:Program.cs


示例18: Setup

    protected override void Setup()
    {
      //using (new DbManager("PerformanceTest"))
      //{}
      db = new NorthwindDB();

      Customers = db.Customers.ToList();
      Employees = db.Employees.ToList();
      Orders    = db.Orders.   ToList();
      Products  = db.Products. ToList();

      foreach (var o in Orders)
      {
        o.Customer = Customers.SingleOrDefault(c => c.Id == o.CustomerID);
        o.Employee = Employees.SingleOrDefault(e => e.EmployeeID == o.EmployeeID);
      }

      foreach (var c in Customers)
        c.Orders = Orders.Where(o => c.Id == o.CustomerID).ToList();
    }
开发者ID:jogibear9988,项目名称:ormbattle,代码行数:20,代码来源:BLToolkit.generated.cs


示例19: InnerJoinOnMultipleColumns

		public void InnerJoinOnMultipleColumns(string context)
		{
			using (var db = new NorthwindDB(context))
			{
				var query =
					from p in db.Product
					from o in db.Order
					join d in db.OrderDetail
						on     new { p.ProductID, o.OrderID }
						equals new { d.ProductID, d.OrderID }
					select new
					{
						p.ProductID,
						o.OrderID,
					};

				foreach (var item in query)
					Console.WriteLine(item);
			}
		}
开发者ID:ronnyek,项目名称:linq2db,代码行数:20,代码来源:JoinOperatorTests.cs


示例20: Setup

        protected override void Setup()
        {
            db = new NorthwindDB();

            Customers = db.Customers.ToList();
            Employees = db.Employees.ToList();
            Orders    = db.Orders.   ToList();
            Products  = db.Products. ToList();

            foreach (var o in Orders)
            {
                o.Customer = Customers.SingleOrDefault(c => c.Id == o.CustomerID);
                o.Employee = Employees.SingleOrDefault(e => e.EmployeeID == o.EmployeeID);
            }

            foreach (var c in Customers)
            c.Orders = Orders.Where(o => c.Id == o.CustomerID).ToList();

            DataConnection.TurnTraceSwitchOn();
            DataConnection.WriteTraceLine = (s, s1) => Debug.WriteLine(s, s1);
        }
开发者ID:sdanyliv,项目名称:ormbattle,代码行数:21,代码来源:Linq2Db.generated.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NorthwindEntities类代码示例发布时间:2022-05-24
下一篇:
C# NorthwindConfig类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap