public IQueryable<RecentlyCreatedAssetViewModel> getRecentlyCreatedAssetsByCompanyID(int companyID)
{
return (from a in db.Assets
join ab in db.AssetBundles on a.AssetID equals ab.AssetID
join b in db.Bundles on ab.BundleID equals b.BundleID
where a.CompanyID == companyID && a.AssetTypeID == 11 && a.IsActive == true && a.ShowInResults == true
orderby a.CreateDate descending
select new RecentlyCreatedAssetViewModel { AssetID = a.AssetID, AssetName = a.AssetName, AssetTypeID = a.AssetTypeID, BundleIcon = b.BundleIcon, BundleName = b.BundleName }).Take(10);
}
Run Code Online (Sandbox Code Playgroud)
事实证明,我还想找回一些db.AssetBundles中没有关系的db.Assets,但是我不知道如何做到这一点,我想把空格(空字符串)放在Bundle的位置当没有关系时,RecentCreatedAssetViewModel的字段.这个查询不会返回一个在连接中没有关系的资产,但是如何更改它以便它们只是将空字符串放入丢失的数据中?