0

How can I write this query using LINQ?

SELECT CAST(CASE WHEN [IsForReplication] = 1  THEN 'Yes' 
                   ELSE 'No' END AS NCHAR) as [IsForReplication], * 
FROM [SAN].[dbo].[PolicyInterval]

2 Answers 2

2
var query = from pi in context.PolicyInterval
            let IsForReplication = pi.IsForReplication ? "Yes" : "No"
            select new
            {
                IsForReplication,
                PolicyInterval = pi,
            };
Sign up to request clarification or add additional context in comments.

Comments

0
var result = PolicyInterval.Select(entry => new {IsForReplication = entry.IsForReplication.Equals(1).ToString(), data = entry});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.