using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using System.Linq.Dynamic.Core; namespace IRaCIS.Core.Infrastructure.Extention { public static class IQueryableExtensions { /// /// 获取第一条 null提示 /// /// /// /// /// public static async Task FirstNotNullAsync(this IQueryable source) { var result =await source.FirstOrDefaultAsync(); if (result == null) { throw new QueryBusinessObjectNotExistException($"The query object does not exist in database, Please check the query parameters"); } else { return result; } } } }