This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hey there, I'm currently doing some refactoring and have decided to come up with a generic repository pattern for all of my LightSpeed entities, I'm having not problem with handling Save/Get/Delete ops in a generic way, but when it comes to Update, things are a bit tricky. The below code illustrates my approach to the problem of performing Update in a generic way. Please consider my extension method. Will it suffice? or am I missing something? Cheers!
|
|
|
A couple of comments:
|
|
|
Thanks :) Would you be so kind as to elaborate on your 1st comment? How do I safeguard vs the FK fields scenario you've described? |
|
|
If you use the Metadata libraries you will avoid this problem :) Basically you just need to avoid setting the FK fields directly. When using the Metadata libraries you will be setting the property values so this triggers the appropriate logic to handle wire-up between entities etc.
|
|
|
Just to clarify, I need to avoid :
Am I correct? :) |
|
|
Yes, that would be right :)
|
|