SkipValuesOnUpdate/Insert at class level
See original GitHub issueWould it be possible to apply the SkipValuesOnUpdate and SkipValuesOnUpdate attribute at class level? Currently it is only effective at member level, but when applying a path-based Column attribute on a complex member, SkipValuesOnUpdate cannot be applied.
For example, if I supply only the customer name and not surname, I want to skip the surname field being updated to a null in the below model:
[Table("tbl_customer")]
[Column("customer_name", "Customer.Name"), SkipValuesOnUpdate(null) <-- cannot be applied
[Column("customer_surname", "Customer.Surname"), SkipValuesOnUpdate(null) <-- cannot be applied here]
public class SomeModel
{
...
[NotColumn, SkipValuesOnUpdate(null) <-- has no effect here]
public CustomerModel Customer { get; set; }
}
this is based off the example here -> https://github.com/linq2db/linq2db/blob/master/Tests/Model/ComplexPerson.cs
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Skip a column on INSERT with JPA - java
I have a JPA/EclipseLink model with multiple parameters whose values are set as defaults by the PostgreSQL database. Specifically, I have:.
Read more >SQL | INSERT IGNORE Statement
Inserting multiple records INSERT OR IGNORE INTO Employee (EmployeeID, Name, City) VALUES (15007, 'Shikha', 'Delhi'), (15002, 'Ram', 'Mumbai'), ...
Read more >Skip Lists
With some very small probability, - the skip list will just be a linked list, or - the skip list will have every...
Read more >Skip list in Data structure
The skip list is an extended version of the linked list. It allows the user to search, remove, and insert the element very...
Read more >Documentation: 15: INSERT
INSERT inserts new rows into a table. One can insert one or more rows specified by value expressions, or zero or more rows...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Great, it is much better than extending API.
I’ve spent some time on getting this to work and going through the code and have managed to get it to work without needing to change any code in Linq2DB itself.
The quick fix is to apply the
SkipValuesOnUpdate
on the actual sub-class members. i.e: