【问题标题】:"the Size property has an invalid size of 0 addparam" error when I use StoredProcedureEFCore Nuget package当我使用 StoredProcedureEFCore Nuget 包时出现“Size 属性的大小为 0 addparam 无效”错误
【发布时间】:2020-01-22 20:40:15
【问题描述】:

我正在为我的 .net 核心 pwa 项目使用 StoredProcedureEFCore nuget 包。 我正在尝试使用带有一些字符串输出参数的存储过程,但是当我运行它时,它会给出错误消息“Size 属性的大小为 0 无效”

我已阅读文档,但找不到字符串大小的内容: https://github.com/verdie-g/StoredProcedureEFCore

also I have tested this: 
I test this:
bookNameParameter.Size = 500;

but it does not work for this nuget package.
C#
context.LoadStoredProc("dbo.Book_Details")
                .AddParam("BookId", bookId)
                .AddParam("Id", out IOutParam<long> id)
                .AddParam("BookName", out IOutParam<string> bookNameParameter)
                .AddParam("ProducerName", out IOutParam<string> producerNameParameter)
                .AddParam("EnBookName", out IOutParam<string> enBookNameParameter)
                .AddParam("EnProducerName", out IOutParam<string> enProducerNameParameter)
                .AddParam("Content", out IOutParam<string> contentParameter)
                .AddParam("Type", out IOutParam<int> TypeParameter)
                .AddParam("Price", out IOutParam<int> PriceParameter)
                .AddParam("DiscountPrice", out IOutParam<int> DiscountPriceParameter)
                .AddParam("LikeCount", out IOutParam<int> likeCountParameter)
                .AddParam("BaseLikeCount", out IOutParam<int> baseLikeCountParameter)
                .AddParam("BookPage", out IOutParam<int> BookPageParameter)
                .AddParam("PublisherName", out IOutParam<string> publisherNameParameter)
                .AddParam("BookSize", out IOutParam<int> BookSizeParameter)
                .AddParam("LanguageType", out IOutParam<int> LanguageTypeParameter)
                .AddParam("PresentationMode", out IOutParam<int> PresentationModeParameter)
                .AddParam("ISBN", out IOutParam<string> ISBNParameter)
                .AddParam("BookVersion", out IOutParam<long> bookVersionParameter)
                .AddParam("AverageRate", out IOutParam<float> averageRateParameter)
                .Exec(r => lstEpisode = r.ToList<Episode>());

如何为这些参数定义尺寸?

【问题讨论】:

    标签: c# sql-server stored-procedures entity-framework-core


    【解决方案1】:

    尝试像这样设置每个IOutParam&lt;string&gt;的大小

    .AddParam("BookName", out IOutParam<string> bookNameParameter,500)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-27
      • 2011-04-15
      • 2020-08-02
      • 2021-10-02
      • 1970-01-01
      • 2018-12-05
      • 1970-01-01
      相关资源
      最近更新 更多