Closed ydlkrishna closed 6 years ago
@ydlkrishna The blog post you reference encapsulates the conditional include in the GetProduct
method of a ProductRepository
. You can do the same thing with URF by creating your own ProductRepository
that extends Repository<Product>
, where you will have access to the DbContext
and can use it to implement the kind of query you see here.
Please help me to implement Conditional Include something like below... using URF.Core
https://www.bartwolff.com/Blog/2017/08/19/entity-framework-conditional-includes return _context.Products .Where(x => x.Id == id) .Select(x => new { p = x, r = x.Resources.Where(y => y.LanguageCode.Equals(languageCode)) }) .AsEnumerable() .Select(x => x.p) .FirstOrDefault();