c# - 当我使用 StoredProcedureEFCore Nuget 包时出现“Size 属性的大小为 0 addparam 无效”错误
问题描述
我正在为我的 .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>());
如何为这些参数定义大小?
解决方案
尝试设置每个IOutParam<string>
这样的大小
.AddParam("BookName", out IOutParam<string> bookNameParameter,500)
推荐阅读
- flutter - 使用不包含 MediaQuery 的上下文调用 MediaQuery.of()。(紧急援助)
- sql - 使用带有组合框的 Vb.net 显示数据库中的数据
- web-services - Web 框架会在读取正文之前检查授权标头吗?
- tailwind-css - 将鼠标悬停在 Tailwindcss 中时如何增加文本输入宽度(带过渡)
- python - 如何在不刷新烧瓶项目页面的情况下更新值
- ios - 错误:属性声明中应有“var”关键字
- linux - 为什么nop操作会导致sigint?
- javascript - 使用particles.js 插件更改背景滑块旋转
- jekyll - 如何在 Jekyll 中显示前 N 个帖子
- java - Android中泰卢固语字符串的正则表达式?