How to get specific columns returned by stored procedure in variable/list using Entity Framework Core

How to get specific columns returned by stored procedure in variable/list using Entity Framework Core

I want to get list of specific columns returned by stored procedure.In the result set two column names will be common and one column name will be dynamic.

I want to get list of specific columns returned by stored procedure.In the result set two column names will be common and one column name will be dynamic.

ALTER PROC DBO.GETLANGUAGETRANSLATION(@LANGCODE VARCHAR(10))
AS
BEGIN
DECLARE @QUERY NVARCHAR(255)
SET @QUERY= N'SELECT RESOURCENAME,ENText,'+UPPER(@LANGCODE)+' INTO #TEMP FROM DBO.LANGUAGETRANSLATION SELECT * FROM #TEMP';
EXEC(@QUERY);
END

RESOURCENAME and ENText column will be same in output each time but based in input parameter third column name will vary.

I am writing below code in C# using Entity Framework Core LINQ

public async Task<IEnumerable<LanguageTranslation>> GetAsync(string langCode)
        {
            var context = new LQMSDbContext(AppConstants.DB_CONNECTION_STRING_KEY);
            try
            {
                string query = "GetLanguageTranslation '" + langCode + "'";
                var result = context.LanguageTranslation.FromSql(query).ToList();
                var result1 = context.Database.ExecuteSqlCommand("GETLANGUAGETRANSLATION @p0", parameters: langCode );
            }
            catch(Exception ex)
            {
                string a = ex.Message;
            }


        return await _dbSet
        .Where(x =&gt; x.Equals(langCode))
         .ToListAsync();
    }

I am trying to call stored procedure GETLANGUAGETRANSLATION using two different approaches. But both are failing with below error

The required column 'ESText' was not present in the results of a 'FromSql' operation

Where ESText refers to the column which I am not returning from stored procedure but present in table.

I want to store only few columns in result set in c# and not all.

Can any body help me in this?

NOTE : It works fine with Select * from LanguageTranslation query


entity-framework c-sharp

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

C. C++. C#. 차이점 알려드림. 5분 순삭. Explain C.C++.C#. Like I'm Five

C. C++. C#. 차이점 알려드림. 5분 순삭. Explain C.C++.C#. Like I'm Five. 아시죠? C는 C++.C# 줄인말이 아니라는거?

Auditing Your C# Models with Entity Framework

When working with data, oftentimes my clients or customers have asked me, “who changed that record?”. I always add some audit info to all my entities (models/tables) to know who added or changed a piece of data and when it was last changed.

Learn how to perform CRUD operations using C Sharp

QuickStart: CRUD Operations in C Sharp. Learn how to perform CRUD operations using C Sharp for MongoDB databases.

Loops in C++ | For, While, and Do While Loops in C++

In this Video We are going to see how to use Loops in C++. We will see How to use For, While, and Do While Loops in C++.

Using isdigit() in C/C++

In this article, we'll take a look at using the isdigit() function in C/C++. This is a very simple way to check if any value is a digit or not. Let's look