这在SQL端执行为class MyAlertController: UIViewController {
typealias CompletionHandler = (_ clickedButton: UIButton) -> Void
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
func showAlertWithButtonClicked(clickedButton: @escaping (MultipleMethodRunningHandle)) {
//Do what you want
}
func pressedCancelButton(button: UIButton) {
//At this point compiler doesn't allow me to use that completionHandler globally in the class
button.tag = 0
clickedButton(button)
}
func pressedSendButton(button: UIButton) {
//At this point compiler doesn't allow me to use that completionHandler globally in the class
button.tag = 1
clickedButton(button)
}
func pressedAddButton(button: UIButton) {
//At this point compiler doesn't allow me to use that completionHandler globally in the class
button.tag = 2
clickedButton(button)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
:
.Count()
然后在获取计数之前检索整个表:
account.SelectMany(acc => acc.Transactions).Count(t => !t.Disabled)
为什么呢?我希望能够将谓词提取为变量。有没有办法做到这一点,并仍然受益于SQL端操作?
修改
显然删除代码的private Expression<Func<Transaction, bool>> transactionsFilterPredicate = t => !t.Disabled;
account.SelectMany(acc => acc.Transactions).Count(this.transactionsFilterPredicate.Compile())
部分解决了问题......代码仍然编译(如在.Compile()
中)并且Count在SQL端。 MSBuild
有什么好处?