使用SubSonic的“已删除"行

编程入门 行业动态 更新时间:2024-10-26 12:35:48
本文介绍了使用SubSonic的“已删除"行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用SubSonic(使用ActiveRecord或集合)加载数据时,仅加载IsDeleted设置为false的记录.如何显示已删除的行?

When loading data with SubSonic (either using ActiveRecord or a collection), only records with IsDeleted set to false will load. How can I show those rows that have been deleted?

例如,删除具有以下条件的员工:

For example, deleting an Employee with:

Employee.Delete(1)

现在,员工1被标记为已删除.现在,我想选择撤消删除和/或显示已删除员工的列表,我该怎么做?如果用户不小心删除了员工,或者他们想转到以前删除过的员工(即仅将 IsDeleted 设置为true的员工)进入废纸'"列表,则该操作将被撤消.

Now employee 1 is marked as deleted. Now I want the option to undo the delete and / or show a list of deleted employees, how can I do that? Either it will be undone if the user accidentally deleted the employee, or they want to go to a 'trash' list with previously deleted employees (i.e. only those with IsDeleted set to true).

使用SubSonic 2.2

Using SubSonic 2.2

推荐答案

ActiveRecord没有内置此功能.您需要为此设置其他查询.您未指定2.2或3.0.这是2.2语法.

ActiveRecord doesn't have this built in. You'll need to set up additional queries for this. You didn't specify 2.2 or 3.0. This is 2.2 syntax.

public EmployeeCollection FetchAll(bool isDeleted) { return new SubSonic.Select().From(Employee.Schema).Where(IsDeletedColumn).IsEqualTo(isDeleted).ExecuteAsCollection<EmployeeCollection>(); } public EmployeeCollection GetTrashList() { return FetchAll(true); }

更多推荐

使用SubSonic的“已删除"行

本文发布于:2023-10-24 09:49:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1523622.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:SubSonic   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!