Internal Table Properties are Ignored
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start at the property-to-column mapping used by InsertAsync and inspect the Type.GetProperties() call described in the issue. Reproduce the failure with an internal model and verify that the generated INSERT no longer has empty column and value lists when the model's properties are mapped.
Written by the indexing model from the issue text.
Description
This wasn't clear from the docs, but these methods don't appear to map internal properties to column names, only the public ones. I got the following error trying to call InsertAsync<T> on an internal model:
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Private.CoreLib.dll: 'Incorrect syntax near ')'.'
It turns out that the property -> column mapping is calling Type.GetProperties(), which returns only public properties by default, which was generating the follow query:
INSERT INTO dbo.my_table () values (); SELECT SCOPE_IDENTITY() id
I've raised #159 to allow these models to be marked as internal without having to override that modifier on all of the table class's properties.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DapperLib/Dapper.Contrib
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
DapperLib/Dapper.Contrib#22 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
DapperLib/Dapper.Contrib#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
DapperLib/Dapper.Contrib#173 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 10/100
DapperLib/Dapper.Contrib#172 · 1 comment · 4 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
DapperLib/Dapper.Contrib#169 ·
All issues in DapperLib/Dapper.Contrib
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·