c# - How to utilize EF and LINQ to add filters and specify tables, columns, filters and order by dynamically -


i have database structure (all parent , childs tables),

enter image description here

what doing

now want create ad hoc reporting page, let user select tables , columns in these tables.

when user select tables , columns, can add filters (is in list or contains or filter etc..) columns.

i send information json web service create, in web service planning use entityframework required dataset.

what have done

i able create html ui, web services, database layer repositories , uow, database etc..

question

i mean can this,

var result = context.parenta.include("child1.subchild1").include(....).where(.. 

but not sure how can specify columns want or add filters.

for specifying column names can use select linq query :

var result = context.parenta.include("child1.subchild1").include(....).where(..).select(s=> new {name = s.parentname , subname = s.subchild.name }); 

for adding filters need define them in clause

.where(p=>p.name.contains("somevalue")) 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -