将存储过程结果映射到Entity Framework中的自定义复杂类型
问题描述:
考虑存储过程 GetEmployees
,该存储过程具有 SELECT
语句,例如
Consider a stored procedure GetEmployees
which has a SELECT
statement like
SELECT EMP_ID, EMP_NAME, EMP_EMAIL
FROM EMPLOYEE
此存储过程将其结果映射到复杂类型 GetEmployees_Result
This stored procedure will have its results mapped to a complex type GetEmployees_Result
class GetEmployees_Result {
public int EMP_ID;
public string EMP_NAME;
public string EMP_EMAIL;
}
是否可以将函数导入的结果映射到其他复杂类型类似于以下示例:
Is it possible to map the result of the function import to a different complex type like the one below:
class GetEmployeesResult {
public int Id;
public string Name;
public string Email;
}
答
这是一个标准功能。您已转到函数import的映射,并将结果类型更改为自定义类型。
It is a standard feature. You have go to the mapping of the function import and change the result type to the custom type.