amishp11
New member
- Joined
- Apr 22, 2010
- Messages
- 2
- Programming Experience
- 10+
In a simple object model I'm trying to wrap some database tables with business objects.
In an effort to save bandwidth and # of fields on an update, I want to track to which properties are updated (set) and only update those to the database. I'm currently doing
Where "LogChange" is a method that will add Parameter1 to a name value collection IF the new value is different from the old value. And then turn around and pass that name value collection into sql stored proc.
This work flow works fine, but I want to say I've seen some code snippets somewhere that do a much better job with this. But unfortunately, I'm unable to locate it.
Any thoughts/advice/snark?
In an effort to save bandwidth and # of fields on an update, I want to track to which properties are updated (set) and only update those to the database. I'm currently doing
VB.NET:
Public Property Description() As String
Get
Return m_sDescription
End Get
Set(ByVal value As String)
LogChange("Description", m_sDescription, value) '<-------
m_sDescription = value.Trim
End Set
End Property
Where "LogChange" is a method that will add Parameter1 to a name value collection IF the new value is different from the old value. And then turn around and pass that name value collection into sql stored proc.
This work flow works fine, but I want to say I've seen some code snippets somewhere that do a much better job with this. But unfortunately, I'm unable to locate it.
Any thoughts/advice/snark?