• EF 导航属性的使用


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;


    namespace ModelFirst
    {
        class Program
        {
            static void Main(string[] args)
            {
                Model1Container context = new Model1Container();
                //Customer customer = new Customer() { CustomerName = "zhangsan", CustomerPwd = "123" };
                //Order order1 = new Order() { ProductName = "apple", Customer = customer };
                //Order order2 = new Order() { ProductName = "banana", Customer = customer };
                //context.Customer.Add(customer);
                //context.Order.Add(order1);
                //context.Order.Add(order2);
                //context.SaveChanges();


                var customers = from c in context.Customer
                                select c;
                foreach (var c in customers)
                {
                    Console.WriteLine(c.CustomerName + ":");
                    foreach (var o in c.Order)
                    {
                        Console.WriteLine(o.ProductName);
                    }
                }
                Console.Read();
            }
        }
    }
  • 相关阅读:
    创建二叉树
    并查集
    opn模块
    【ES6】map、reduce、filter、sort、箭头函数、class继承、yield
    css应用视觉设计
    json解决ajax跨域的原理
    flex盒子布局
    前后台交互ajax请求模块
    react后台项目开发(一)
    高阶函数&&高阶组件(二)
  • 原文地址:https://www.cnblogs.com/dxmfans/p/9434656.html
Copyright © 2020-2023  润新知