首先编写存储过程数据库脚本,包括READONLY参数

时间:2017-11-08 21:33:08

标签: c# .net sql-server entity-framework visual-studio-2017

为什么READONLY参数不是通过数据库优先EF迁移生成的?

我有一个带有以下签名的存储过程:

CREATE PROCEDURE [dbo].[PWz_P_GetshowOfferings]
    (@showID INT = NULL,
     @SegmentID INT = NULL,
     @SegmentKey VARCHAR(40) = NULL,
     @ChannelID INT,
     @ChannelKey VARCHAR(40) = NULL,
     @SalesRegionID INT,
     @ReturnExpiredOfferings BIT,
     @AccountID INT = NULL,
     @AccountFilterPairs PWz_TT_KeyValuePair READONLY)

以下是在上下文中生成的:

public virtual ObjectResult<PWzPGetAvailableOfferingsResult> PWz_P_GetshowOfferings(Nullable<int> showID, Nullable<int> segmentID, Nullable<int> channelID, Nullable<int> salesRegionID, Nullable<bool> returnExpiredOfferings, Nullable<int> accountID)
{
    var showIDParameter = showID.HasValue ?
            new ObjectParameter("showID", showID) :
            new ObjectParameter("showID", typeof(int));

    var segmentIDParameter = segmentID.HasValue ?
            new ObjectParameter("SegmentID", segmentID) :
            new ObjectParameter("SegmentID", typeof(int));

    var channelIDParameter = channelID.HasValue ?
            new ObjectParameter("ChannelID", channelID) :
            new ObjectParameter("ChannelID", typeof(int));

    var salesRegionIDParameter = salesRegionID.HasValue ?
            new ObjectParameter("SalesRegionID", salesRegionID) :
            new ObjectParameter("SalesRegionID", typeof(int));

    var returnExpiredOfferingsParameter = returnExpiredOfferings.HasValue ?
            new ObjectParameter("ReturnExpiredOfferings", returnExpiredOfferings) :
            new ObjectParameter("ReturnExpiredOfferings", typeof(bool));

    var accountIDParameter = accountID.HasValue ?
            new ObjectParameter("AccountID", accountID) :
            new ObjectParameter("AccountID", typeof(int));

    return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<PWzPGetAvailableOfferingsResult>("PWz_P_GetshowOfferings", showIDParameter, segmentIDParameter, channelIDParameter, salesRegionIDParameter, returnExpiredOfferingsParameter, accountIDParameter);
}

为什么在上下文中没有生成此参数?

@AccountFilterPairs PWz_TT_KeyValuePair READONLY

0 个答案:

没有答案