zoukankan      html  css  js  c++  java
  • linq内联左联

    内联:没有into

    左联:有into

    例子:

    from GoodsStore in this.GetCurrentDbSession.Tbl_OfficeSupplies_GoodsStoreDLL.LoadEntities(a => (Guid.Empty==GoodsID?true:a.GoodsID==GoodsID))
    join goods in GetCurrentDbSession.Tbl_OfficeSupplies_GoodsDLL.LoadEntities(a => (Guid.Empty == GoodsCategoryID ? true : a.GoodsCategoryID == GoodsCategoryID) && (Guid.Empty == GoodsID ? true : a.ID == GoodsID))
    on GoodsStore.GoodsID equals goods.ID
    join goodscategory in this.GetCurrentDbSession.Tbl_OfficeSupplies_GoodsCategoryDLL.LoadEntities(a => (Guid.Empty == GoodsCategoryID ? true : a.ID == GoodsCategoryID))
    on goods.GoodsCategoryID equals goodscategory.ID
    join goodsSpecifications in GetCurrentDbSession.Tbl_OfficeSupplies_GoodsSpecificationDLL.LoadEntities(a => true)
    on GoodsStore.GoodsSpecificationID equals goodsSpecifications.ID
    join goodsUnit in GetCurrentDbSession.Tbl_OfficeSupplies_GoodsUnitDLL.LoadEntities(a => true)
    on goods.UnitID equals goodsUnit.ID into tmp1
    from tt in tmp1.DefaultIfEmpty()
    select new
    {
    GoodsID = goods.ID == null ? Guid.Empty : tt.ID,
    GoodsName = goods.Name,
    GoodsCategoryName = goodscategory.Name,
    GoodsSpecificationID = goodsSpecifications.ID == null ? Guid.Empty : goodsSpecifications.ID,
    GoodsSpecificationName = goodsSpecifications.Name,
    GoodsUnitName = tt.Name,
    Count= GoodsStore.Count,
    ProcurementCount=GoodsStore.ProcurementCount,
    ApplyCount= GoodsStore.ApplyCount
    };

  • 相关阅读:
    【NYOJ】[22]素数求和问题
    【NYOJ】[13]Fibonacci数
    【NYOJ】[13]Fibonacci数
    【CodeForces】[606A]Magic Spheres
    【CodeForces】[606A]Magic Spheres
    【杭电】[1201]18岁生日
    【杭电】[1201]18岁生日
    【杭电】[1994]利息计算
    【杭电】[1994]利息计算
    新型量子云装置问世 让你免费体验量子计算机
  • 原文地址:https://www.cnblogs.com/liuqiyun/p/8616358.html
Copyright © 2011-2022 走看看