❔ How do I make part of a Linq query optional?
I have a query like this:
My problem is that the contracts should be optional - as sometimes rc.ContractNo can be null. How can I achieve this?
2 Replies
you may think doing a left join so
join con in _radanContext.Contracts on rc.ContractNo.DefaultIfEmpty() equals con.ContractNo
and if you don't need em just do where != null
kinda something like this
if this is what you are trying to achieveWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.