No documentation of failure states (or it is hard to find if it exists?)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- csharp
- Lĩnh vực
- documentation
Hướng nghiên cứu
Bắt đầu với docs/index.md và Readme.md, sau đó kiểm tra các chú thích và phần triển khai của InsertAsync trong src/Dapper.Contrib/SqlMapperExtensions.Async.cs. Xác minh các trường hợp biên được liệt kê của InsertAsync và UpdateAsync, bao gồm hành vi phụ thuộc vào cơ sở dữ liệu và các giá trị trả về, đồng thời ghi lại các kết quả và ngoại lệ đã được xác nhận.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C#
- Star
- 293
- Fork
- 108
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DapperLib/Dapper.Contrib
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
DapperLib/Dapper.Contrib#22 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 42/100
DapperLib/Dapper.Contrib#174 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
DapperLib/Dapper.Contrib#173 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 10/100
DapperLib/Dapper.Contrib#172 · 1 bình luận · 4 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
DapperLib/Dapper.Contrib#169 ·
Tất cả issue của DapperLib/Dapper.Contrib
Issue tương tự
-
:watch: Not Triaged dotnet-target-version
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
copilot documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 2 ngày
-
untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
dotnet/dotnet-api-docs#13124 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
BHoM/MidasCivil_Toolkit#441 ·