J'ai une table avec un schéma similaire:Typage semi-dynamique Dapper?
CREATE TABLE [dbo].[Property](
[id] [uniqueidentifier] NOT NULL,
[PropertyOccupantTypeId] [uniqueidentifier] NULL,
[PropertyStatusId] [uniqueidentifier] NOT NULL
-- Other potential columns
)
Il a beaucoup de valeurs de recherche sur ce que mon utilisateur n'a pas besoin de savoir quoi que ce soit au sujet. Ils ont juste besoin PropertyStatus
pas PropertyStatusId
En supposant que les tables de consultation ont 2 colonnes chacune (guid: id, varchar: valeur) Est-il possible d'écrire une requête similaire à:
SELECT p.id,
po.value as OccupantType,
ps.value as PropertyStatus
-- Other potential columns
FROM Property p
join PropertyOccupantType po on p.PropertyOccupant = po.id
join PropertyStatus ps on p.PropertyStatusId = ps.id
et ont cette la carte à un objet Property
qui ressemble à:
public class Property
{
public Guid id;
public string PropertyOccupant;
public string PropertyStatus;
}
Ou dois-je interroger les tables supplémentaires manuellement et cartographier les valeurs de cette façon?