zoukankan      html  css  js  c++  java
  • 基于EF的外键的查询 使用【ForeignKey(“ SupplierId”】特性

      //实体模型类:
            /// 供应商id
            /// </summary>
            public Guid? SupplierId { get; set; }
            /// <summary>
            /// SupplierId—是该表的外键 是DB_Supplier表的主键
            /// DB_Supplier 表名
            /// </summary>
            [ForeignKey("SupplierId")]
            public virtual DB_Supplier Supplier { get; set; }
      var list = WMFactory.FMCostBillService.FindByPage(start, length, out totalCount, x => x.OrderByDescending(a => a.CreateTime), null, condition).Select(a => new
                {
                    Id = a.Id,
                    BillTag = a.BillTag,
                    Code = a.Code,
                    PdtCodes = a.PdtCodes,
                    BillDate = a.BillDate,
                    FollowMan = a.FollowMan,
                    SrcType = a.SrcType,
                    SrcOrderCode = a.SrcOrderCode,
                    Supplier = new {
                        Name = a.Supplier.SpName,
                    },
                    SpBrank=a.SpBrank,
                    SpTaxNo=a.SpTaxNo,
                    SpBrankMan=a.SpBrankMan,
                    SpBrankAccount=a.SpBrankAccount,
                    SpAddrTel=a.SpAddrTel,
                    ApplyMey=a.ApplyMey,
                    PaidMey=a.PaidMey,
                    IsDebt=a.IsDebt,
                    IsCutDown=a.IsCutDown,
                    PayType=a.PayType,
                    FicType=a.FicType,
                    InvoiceNumber=a.InvoiceNumber,
                    Remark=a.Remark,
                    CreateUser=a.CreateUser,
                    CreateTime=a.CreateTime
                });

    客户端 使用时 直接对象点属性  比如 “  { "title": "供应商", "data": "Supplier.Name" },”

  • 相关阅读:
    品优购项目(web)
    Linux
    web前端面试题
    三级网络
    Vue报错:TypeError: Cannot create property ‘xxx‘ on string ‘xxxx
    vue 动态添加页面背景色
    vue 打开新页面 页面滚动到顶部
    ios 系统 h5 页面不发送请求
    小程序返回上一页
    小程序动态设置页面背景色、
  • 原文地址:https://www.cnblogs.com/cloudcmm/p/10776768.html
Copyright © 2011-2022 走看看