How to write simple Where Clause for dynamic filtering in linq when we use groups in join
I have simple search page i want to filter the results.
var TransactionStats = from trans in context.ProductTransactionSet.Include("SPL")
select new
{
trans.InvoiceNo,
ProductGroup = from tranline in trans.ProductTransactionLines
group tranline by tranline.ProductTransaction.TransactionID
into ProductGroupDetil
select new
{
开发者_JAVA百科 TransactionDateTime = ProductGroupDetil.Select
(Content => Content.TransactionDateTime)
}
};
I want to use TransactionDateTime in where clause when required.
if (_FilterCrieteria.DateFrom.HasValue)
{
TransactionStats.Where
(
a => a.ProductGroup.Where
(
dt => dt.DateofTransaction >= _FilterCrieteria.DateFrom &&
dt.DateofTransaction >= _FilterCrieteria.DateFrom
)
)
}
Can any one correct the syntax?
The third row in your second code block should probably read:
TransactionStats = TransactionStats.Where
精彩评论