Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Clause of related table

$
0
0

I'm still trying to wrap my head around LINQ, EF, MVC3.  I have a basic structure like this (Entities)

Employee -> EmployeeStatus -> Team

The above are the tables (Entities) I'm currently concerned about.  An employee can have many employee status, a given employee status has one team.

I'm tring to get the list of employees by team based on their latest status.  Latest status is determined by another table joined to EmployeeStatus call EmployeeOperations.  EmployeeOperations has a date column which is what I'd based the "latest" status on.  My entities in MVC have all relations set up.  I have a basic query that would return all employees and be able to grab the related tables.

The list of employees is returned by Iqueryable.

public IQueryable<T> Query
{
get { return context.Set<T>().AsQueryable(); }
}

so I was trying to use something like Employees.Query.OrderByDescending(eo => eo.OperationDate).Select(es => es.TeamID == id)

That's the general concept of what I'm trying to accomplish, where es would represent EmployeeStatus which has the TeamID foreign key. Any thoughts or help on the best way to accomplish this. Seems like a pretty basic scenario.  


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>