2
我在SQL中有CASE查詢,我該如何使用Entity Framework做到這一點?如何在實體框架中實現選擇案例?
DECLARE @SystemTypeId int
SELECT @SystemTypeId = [SystemTypeId] FROM [Properties] WHERE [Id] = @PropertyId
SET @RETURN_VAL =
CASE @SystemTypeId
WHEN 2 THEN (SELECT [Created] FROM [Assets] WHERE [Id] = @AssetId)
WHEN 3 THEN (SELECT dbo.GetAssetValueById([CreatedBy])
FROM [Assets]
WHERE [Id] = @AssetId)
WHEN 9 THEN (SELECT [LastModified]
FROM [Assets]
WHERE [Id] = @AssetId)
ELSE NULL
END