c# - Linq with entity framework -


i'm new linq , entity framework , appreciate advice on following scenario.

i have entity model 2 tables.

travel_request , resource

sample fields

travel_request

request_id resource_id 

resource

resource_id resource_name 

i add resource_name list when returning travel_requests

thanks in advance

hi need use linq join:

var data = t in travel_request        join r in resource on t.resource_id equals r.resource_id        select new                {                   requestid = t.request_id,                  resourceid = t.resource_id,                  resourcename = r.resource_name               }; 

if have ef association be:

var data = t in travel_request     select new            {                  requestid = t.request_id,                  resourceid = t.resource_id,                  resourcename = t.resource.resource_name            }; 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -