No documentation of failure states (or it is hard to find if it exists?)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 文档
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- csharp
调研方向
先从 docs/index.md 和 Readme.md 开始,然后检查 src/Dapper.Contrib/SqlMapperExtensions.Async.cs 中 InsertAsync 的注释和实现。验证所列出的 InsertAsync 和 UpdateAsync 边界情况,包括依赖数据库的行为和返回值,并记录已确认的结果和异常。
由索引模型根据 Issue 内容生成。
描述
It is not clear from the documentation, nor from the code comments, nor from the actual code, what happens in several cases.
The comment from InsertAsync, as seen in SqlMapperExentsions.Async.cs
/// <summary>
/// Inserts an entity into table "Ts" asynchronously using Task and returns identity id.
/// </summary>
/// <typeparam name="T">The type being inserted.</typeparam>
/// <param name="connection">Open SqlConnection</param>
/// <param name="entityToInsert">Entity to insert</param>
/// <param name="transaction">The transaction to run under, null (the default) if none</param>
/// <param name="commandTimeout">Number of seconds before command execution timeout</param>
/// <param name="sqlAdapter">The specific ISqlAdapter to use, auto-detected based on connection if null</param>
/// <returns>Identity of inserted entity</returns>
Steps to reproduce:
- First, read https://github.com/DapperLib/Dapper.Contrib/blob/main/docs/index.md
- Next, read https://github.com/DapperLib/Dapper.Contrib/blob/main/Readme.md
Expected outcome:
Learn how to handle edge cases that might be encountered when using Dapper.Contrib
Actual outcome:
I currently lack clarity on the following:
-
InsertAsync, return value when
Task<int>cannot represent key in database- What is the "Identity" returned when the table uses
longand has more thanINTMAXentities? [1] - What is the "Identity" returned when the key is a GUID or hashed string?
- What is the "Identity" returned after inserting an
IEnumerable<Entity>?
- What is the "Identity" returned when the table uses
-
InsertAsync, single entity, non-zero key in key-incrementing table
- Insert nothing and return zero?
- Insert nothing and throw?
- If so, what?
- Insert entity as if the key was zero, return the key of the new row?
- Behavior depends on underlying database?
-
InsertAsync, single entity, non-zero key already in table
- Retain existing entity and return zero?
- Retain existing entity and throw exception?
- If so, which one?
- Insert entity as if the key was zero, return the key of the new row?
- Retain existing entity, returning its key?
- If so, any way to learn you didn't insert?
- Overwrite existing entity, returning the key?
- Behavior depends on underlying database?
-
InsertAsync, multiple entities, some keys already in table
- Insert none and return zero?
- Insert none and throw exception?
- If so, which one?
- Insert new entities only and retain existing entities, returning count of delta?
- if so - any way to learn which ones were not inserted?
- Insert all, overwriting existing entities, returning count of all entities in original list?
- Behavior depends on underlying database?
-
InsertAsync, single or multiple insert, table not found
(The entity class name does not correspond to any table names, the[Table("name")]attribute is not present)- Return zero?
- Throw exception?
- If so, which exception?
- Wildcard option: Create that table and populate it?
- Behavior depends on underlying database?
-
InsertAsync, single or multiple insert, column not found
(Entity has field that is not marked[Write(false)], column does not exist in database)- Write correct fields, return as normal?
- Write nothing and return zero?
- Write nothing and throw?
- If so, which exception?
- Wildcard option: Create that column?
- Behavior depends on underlying database?
-
InsertAsync, single or multiple insert, field not found
(Entity is missing a field representing a column that exists in the table)- Write other fields, leaving empty field as null/zero/empty string, return as normal?
- Write nothing and return zero?
- Write nothing and throw?
- If so, which exception?
- Behavior depends on underlying database?
-
UpdateAsync
(Just about all the same questions except reverse the "entity alread exists" logic)- No such ID in table
- Missing fields
- Extra fields
- No such table
-
other problems
(connection bad, connection loss or timeout, transaction in bad state)- Surely that's a throw, right?
- I mean, it has to be?
- But which exception?
[1] My company works with physical goods rather than at internet scale so we aren't reaching there any time soon (I believe our deepest table only has 3'000'000 entities) but somebody is going to run into that limit, especially if they run at internet-scale and e.g. store log messages in their database.
- 主要语言
- C#
- 星标
- 293
- 派生
- 108
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DapperLib/Dapper.Contrib 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 75/100
DapperLib/Dapper.Contrib#22 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 42/100
DapperLib/Dapper.Contrib#174 ·
-
难度 2/5 1-3 小时 新手友好度 45/100
DapperLib/Dapper.Contrib#173 ·
-
难度 1/5 1 小时以内 新手友好度 10/100
DapperLib/Dapper.Contrib#172 · 1 条评论 · 4 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 48/100
DapperLib/Dapper.Contrib#169 ·
查看 DapperLib/Dapper.Contrib 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
SubtitleEdit/subtitleedit#15462 ·
维护者通常 1 天内回复
-
:watch: Not Triaged
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
comp:instrumentation.aspnetcore
难度 2/5 1-3 小时 新手友好度 72/100
open-telemetry/opentelemetry-dotnet-contrib#5427 ·
维护者通常 1 天内回复
-
design-proposal
难度 2/5 1-3 小时 新手友好度 78/100
dotnet/aspnetcore#69592 ·
维护者通常 1 天内回复
-
Client Container Registry customer-reported needs-team-attention question Service Attention
难度 2/5 1-3 小时 新手友好度 74/100
Azure/azure-sdk-for-net#63470 · 3 条评论 · 1 个 reaction ·
维护者通常 1 天内回复