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
|
Hi, I'm trying to implement Undo feature at a db level. The setup is like this. There is a master DB (MDB) that has the initial entities value stored. A modification to entities will be stored to a slave DB (SDB). And when I need to "restore", it overwrites values from MDB to SDB. I'll probably have several SDBs later on but I'm concerned with single MDB and SDB Possible scenario is the following. (assume MDB and SDB with the same table definitions)
It looks like I need two separate UOW that needs to talk to each other, but it's not that simple problem to solve. This is where I'm currently. I have one LightSpeed.lsmodel, shared by the both UOWs. It seems to work fine; I can read/write from each UOW independently. One of the problem I have is that ID is the only unique key and they may not be the same on both DB (ID is autogenerated when adding a new entity). It would be really nice but I'm not sure if there are some support for backup/restore for per entity in LightSpeed. If not, I need some help implmenting this the right way. I appreciate if you have some suggestions. Thanks. -ck |
|
|
Hi Chris, Your best bet would be to have a look at using the GeneratedId override which is available on a per entity basis to control how the Id value is calculated. You could then use this in conjunction with a flag or other such determining value in your code to force the Id to be a pre-determined value. We have some brief notes on how to use this in the documentation here: http://www.mindscapehq.com/documentation/lightspeed/Working-with-Legacy-Databases/Using-Natural-Keys
|
|
|
Thanks Jeremy, I'll take a look at the documentation you mentioned. -chris |
|
|
Hi, Jeremy, I got the natual key to work but I have problem working with MDB and SDB at the same time. I thought I was able to access them independently but it turns out I just working with MDB only. I the first secenario, where I first create an entity in MDB and duplicate to SDB.
Everything seems to work fine but accessing the entity added to SDB actually turned out to be MDB entity.
(SUoW.FindById Is there something I missed? BTW, I didn't call "SaveChanges()" yet. Thanks. -chris |
|