LLBLGEN:我怎样才能softdelete一个入口 [英] LLBLGen: How can I softdelete a entry
问题描述
我继承了使用LLBLGEN临为DB层的项目。数据库模式要求的是,当条目被删除的标志(DeletedDate被设置为当前时间)。最后一个程序员忽略了这一要求,并在整个应用程序中使用定期删除。
I have inherited a project that uses LLBLGen Pro for the DB layer. The DB model requires that when a entry is deleted a flag (DeletedDate is set to the current time). The last programmer ignored this requirement and has used regular deletes throughout the entire application.
有没有一种方法来设置代码生成器自动执行此操作或做我必须超载对于需要它的实体每个delete操作符?
Is there a way to set the code generator to do this automatically or do I have to overload each delete operator for the Entities that requires it?
推荐答案
我实现了这个在SQL Server 2005中使用INSTEAD OF触发器在删除任何软删除表。触发器设置删除标志,并进行清理。该方案的优点在于它正确处理由访问数据库中的任何系统发出的删除。 INSTEAD OF是在SQL Server中相对较新的,我知道有一个Oracle相当于
I implemented this in SQL Server 2005 using INSTEAD OF triggers on delete for any soft delete table. The triggers set the delete flag and perform clean-up. The beauty of this solution is that it correctly handles deletes issued by any system that accesses the database. INSTEAD OF is relatively new in SQL Server, I know there's an Oracle equivalent.
这解决方案也很好地与我们的O / R映射器播放 - 我创建视图,筛选出软删除的记录和映射的。该观点也被用于所有报告。
This solution also plays nicely with our O/R mapper -- I created views that filter out soft deleted records and mapped those. The views are also used for all reporting.
这篇关于LLBLGEN:我怎样才能softdelete一个入口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!