相关疑难解决方法(0)

错误6046:无法生成存储功能的函数导入返回类型

我的sql数据库中有一个标量值函数.

将此函数导入Entity Framework模型时收到此错误:

Error 6046: Unable to generate function import return type of the store function 'GetContentByIdAndCul'.
The store function will be ignored and the function import will not be generated.   ..\EntityModels.edmx
Run Code Online (Sandbox Code Playgroud)

我的函数tsql是:

ALTER FUNCTION [FRM].[GetContentByIdAndCul] 
(@Id int,@Culture nvarchar(5))
RETURNS nvarchar(max)
AS
BEGIN
declare @Result nvarchar(max)

if @Id is not null
    set @Result='This Content not defined in this Language'

select @Result=Value from CUL.Contents
WHERE ID=@Id AND (CUL.Contents.Culture = LOWER(@Culture) 
            OR CUL.Contents.Culture = LOWER(SUBSTRING(@Culture,1,2)))   
return @Result      
END
Run Code Online (Sandbox Code Playgroud)

linq entity-framework sql-function

18
推荐指数
3
解决办法
1万
查看次数

标签 统计

entity-framework ×1

linq ×1

sql-function ×1