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
|
We have a legacy database mostly driven by stored procedures, and almost all of our tables have 7 common fields: 3 foreign keys to the user who last created/updated/deleted the record, 3 datetime fields corresponding to those times, and a bit indicating whether or not the record is "deleted". Is there any way to shoehorn the old system into Lightspeed's automatic tracking system or will I need to add a custom OnSave strategy to every model that employs this behavior? The columns do not share the default columns names with Lightspeed, and removing the bit field in exchange for a null check on the deletion date is unfortunately not an option at this time. As a secondary consideration, the number of foreign key references because of these fields makes the designer look pretty messy. Is there any way to hide certain FK references in the designer without removing them or altering the database? Thanks! |
|
|
You should be able to handle some of this by using a custom naming strategy which will let you define the column names for mapping the special fields within LightSpeed. Have a look at: http://www.mindscapehq.com/documentation/lightspeed/Implementing-Storage-Policies-with-LightSpeed/Implementing-Policies-in-HandCoded-Entities and http://www.mindscapehq.com/documentation/lightspeed/Controlling-the-Database-Mapping/Overriding-the-Default-Mapping for details. You wont be able to change the behaviour around how we handle a soft-delete though, so you will need to implement this as custom logic if you need to rely on the bit field to exclude deleted records. One way of handling this might be to use a custom query filter - see http://www.mindscapehq.com/blog/index.php/2012/03/26/ninja-entity-filtering-in-lightspeed/ for some details on implementing this. If you set it up so you can indicate to the query filter when you want to bring back deleted records you can have your implementation either include the extra criteria for each query or not.
|
|