从数据库更新模型不会为存储过程

时间:2018-06-08 08:06:34

标签: c# sql-server entity-framework edmx

我有一个新的存储过程。

Go
If object_id('GetAuditLogHistory') is not null
    Drop Proc GetAuditLogHistory
Go
Create Proc GetAuditLogHistory
As
Begin

    Select lo.Id,
        Case when lt.Name='User Roles' Then 
                STUFF((SELECT ', ' + CAST(Value AS VARCHAR(20)) [text()]
                FROM LogNewValues 
                WHERE LogDescritionId = ld.Id
                FOR XML PATH(''), TYPE)
                .value('.','NVARCHAR(MAX)'),1,2,' ') 
            when lt.Name='Companies' Then 
                STUFF((SELECT ', ' + CAST(mc.Name AS VARCHAR(20)) [text()]
                FROM LogNewValues ln
                Inner Join MasterCompany mc on mc.Id=ln.Value
                WHERE LogDescritionId = ld.Id
                FOR XML PATH(''), TYPE)
                .value('.','NVARCHAR(MAX)'),1,2,' ') 
            when lt.Name='Groups' Then 
                STUFF((SELECT ', ' + CAST(gd.Name AS VARCHAR(20)) [text()]
                FROM LogNewValues ln
                Inner Join GroupDefinition gd on gd.Id=ln.Value
                WHERE LogDescritionId = ld.Id
                FOR XML PATH(''), TYPE)
                .value('.','NVARCHAR(MAX)'),1,2,' ') 
            Else ld.ChangedField + ' changed to '+ ld.NewValue
        End as List_Output
    Into #TempCommaSeperatedRecords
    from LogOperation lo
    Inner Join LogDescription ld on lo.Id=ld.LogId
    Inner Join LogTypeMaster lt on lt.Id=ld.LogTypeId

    --Select * from #TempCommaSeperatedRecords

    Select 
    --lo.*,cd.UserName,ca.UserName,ld.*,ln.*
    lo.Id,
    ld.Id,
    cd.UserName as DoneBy,
    ca.UserName as AffectedUser,
    lo.LogTime,
    ld.Description,
    cr.List_Output
    from LogOperation lo
    Inner Join Customer cd on cd.CustomerId=lo.DoneBy
    Inner Join Customer ca on ca.CustomerId=lo.UpdatedEntity
    Inner Join LogDescription ld on lo.Id=ld.LogId
    Left Join #TempCommaSeperatedRecords cr on cr.Id=lo.Id
    --Left Join LogNewValues ln on ln.LogDescritionId=ld.Id
End
Go

我正在尝试将其添加到我的edmx中。我更新了edmx文件。此SP已添加到其中。但是不生成返回类型类。

public virtual int GetAuditLogHistory()
    {
        return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetAuditLogHistory");
    }

edmx生成的代码返回int。如何为此SP生成返回类型类?

0 个答案:

没有答案