我有四张桌子:
- Client with PK ClientID.
- Destination with PK DestinationID.
- Language with PK LanguageID.
- DestinationDetail with PK DestinationID.
- RL-Client-Destination with PKs ClientID and DestinationID.
客户端可能有零个或 n 个目的地。一个目的地有 n 个 DestinationDetails,每个 DestinationDetail 都有一种语言。
行。我需要检索给定客户端和给定语言的所有 DestinationDetails。
我开始写这个:
try
{
ObjectQuery clientes =
guiaContext.Cliente;
ObjectQuery destinos =
guiaContext.Destino;
ObjectQuery idiomas =
guiaContext.Idioma;
ObjectQuery detalles =
guiaContext.DetalleDestino;
IQueryable detalleQuery =
from cliente in clientes
from destino in destinos
from idioma in idiomas
from detalleDestino in detalles
where destino.
select detalleDestino;
}
catch
{
}
}
有什么建议吗?
谢谢!