diff options
author | crupest <crupest@outlook.com> | 2022-12-13 17:17:06 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-12-20 20:32:53 +0800 |
commit | 4fe8d1c88cafd86950e41ae81b94c0d1790e7dfa (patch) | |
tree | 58bcafc3383e26943f3b8d86136d707c24b25c8b /docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/README.md | |
parent | 37ccef55ad134cc10e91d82fe6b60286daf644cc (diff) | |
download | crupest-4fe8d1c88cafd86950e41ae81b94c0d1790e7dfa.tar.gz crupest-4fe8d1c88cafd86950e41ae81b94c0d1790e7dfa.tar.bz2 crupest-4fe8d1c88cafd86950e41ae81b94c0d1790e7dfa.zip |
Develop secret api. v37
Diffstat (limited to 'docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/README.md')
-rw-r--r-- | docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/README.md | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/README.md b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/README.md index ca8a6f1..b008ea7 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/README.md +++ b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/README.md @@ -19,24 +19,29 @@ The ultimate CRUD scaffold finally comes. 1. Create insert clause. 2. Check clauses' related columns are valid. -3. For each column: +3. Create a real empty insert clause. +4. For each column: 1. If insert item exists and value is not null but the column `IsGenerated` is true, throw exception. 2. If insert item does not exist or value is `null`, use default value generator to generate value. However, `DbNullValue` always means use `NULL` for that column. - 3. Coerce null to `DbNullValue`. - 4. Run validator to validate the value. - 5. If value is `DbNullValue`, `IsNotNull` is true and `IsAutoIncrement` is false, throw exception. -4. Generate sql string and param list. -5. Convert param list to `Dapper` dynamic params with proper type conversion in `IColumnTypeInfo`. -6. Execute sql and return `KeyColumn` value. + 3. If value is `null` and the column `IsAutoIncrement` is true, skip to next column. + 4. Coerce null to `DbNullValue`. + 5. Run validator to validate the value. + 6. If value is `DbNullValue`, `IsNotNull` is true, throw exception. + 7. Add column and value to real insert clause. +5. Generate sql string and param list. +6. Convert param list to `Dapper` dynamic params with proper type conversion in `IColumnTypeInfo`. +7. Execute sql and return `KeyColumn` value. ### Update 1. Create update clause, where clause. 2. Check clauses' related columns are valid. Then generate sql string and param list. -3. For each column: +3. Create a real empty update clause. +4. For each column: 1. If update item exists and value is not null but the column `IsNoUpdate` is true, throw exception. 2. Invoke validator to validate the value. 3. If `IsNotNull` is true and value is `DbNullValue`, throw exception. -4. Generate sql string and param list. -5. Convert param list to `Dapper` dynamic params with proper type conversion in `IColumnTypeInfo`. -6. Execute sql and return count of affected rows. + 4. Add column and value to real update clause. +5. Generate sql string and param list. +6. Convert param list to `Dapper` dynamic params with proper type conversion in `IColumnTypeInfo`. +7. Execute sql and return count of affected rows. |