using (MTSEntities entities = new MTSEntities())
{
string queryStr = @"select b.UserName as UserName,
SqlServer.AVG(SqlServer.DATEDIFF('year', a.BirthDay, SqlServer.getDate())) as ArgAge
from MTS_CaseInfo as a inner join MTS_Doctor as b
on a.Account = b.Account group by b.UserName";
ObjectQuery<ReportGender> query = entities.CreateQuery<ReportGender>
(queryStr);