我在sql中有以下查询,
select * from dbo.WaitingLists 
where WaitingListTypeId in (1)
or StakeBuyInId in (Select StakeBuyInId from dbo.WaitingLists where StakeBuyInId in (5) and 
WaitingListTypeId = 2)
在这种情况下,有时 StakeBuyInId 为 null 或 WaitingListTypeId 为 null。我想在以下代码中通过 linq c# 执行此查询。
 public GameListItem[] GetMyWaitingList(Guid UserId, int LocalWaitingListTypeId, int GlobalWaitingListTypeId, int[] StakeBuyInIds)
            {
                ProviderDB db = new ProviderDB();
                List<GameListItem> objtempGameListItem = new List<GameListItem>();
                List<GameTables> objGameTablesList = new List<GameTables>();
                var objWaitingListUser = db.WaitingLists.Where(x => x.UserId.Equals(UserId));
                if (LocalWaitingListTypeId > 0 || (GlobalWaitingListTypeId > 0 && StakeBuyInIds != null))
                {
                    objWaitingListUser = objWaitingListUser.Where(x => x.WaitingListTypeId == LocalWaitingListTypeId || (x.WaitingListTypeId == GlobalWaitingListTypeId 
                                            && StakeBuyInIds != null ? StakeBuyInIds.Contains((Int32)x.StakeBuyInId) : true)
                                         );
                }
                return objtempGameListItem.ToArray();
            }
这里 StakeBuyInIds int[] 有时会为空,那么我将如何对上述 sql 查询执行 linq 操作。谢谢你的帮助。