Skip to content

IQueryable.Select by property names (EF compatible extensions)

License

Notifications You must be signed in to change notification settings

mustaddon/LinqString

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LinqString NuGet version

IQueryable.Select by property names (EF compatible extensions)

using LinqString;


var result = queryableSource
    .OrderBy("SubObj.Prop1", ">Prop2")
    .Select("Prop1", "Prop2", "SubObj.Prop1")
    .ToList();

// is an analogue of

var analogue = queryableSource
    .OrderBy(x => x.SubObj.Prop1)
    .ThenByDescending(x => x.Prop2)
    .Select(x => new { 
        x.Prop1,
        x.Prop2,
        SubObj = new { 
            x.SubObj.Prop1
        },
    }).ToList();

Program.cs