如何从业务层显示错误消息 [英] How to display an error msg from business layer

查看:106
本文介绍了如何从业务层显示错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一次采访中,他们问我如何在业务层的UI上显示消息.

例如,仅当年龄大于18岁时,我才允许用户注册.我可以在页面级别进行验证,但是由于某些原因,我将在业务层中进行检查,因此我需要在UI上显示一条消息,要求他们输入更大的年龄超过18岁.

但是通常,我们将显示页面级仪式上的所有错误消息.如何显示业务层中的错误消息

In a an interview they asked me how can we display a msg on UI from business layer.

for example i will allow users to register only if their age is greater than 18 I can do validation in page level but for some reason i will check this in business layer so i need to display a msg on UI that they have to enter age greater than 18 .

But generally we will display all error msg from page level rite how can we display error msg from business layer

推荐答案

一种好方法是使用EventAggrigator(事件聚合器-马丁·福勒
http://www.martinfowler.com/eaaDev/EventAggregator.html [
One good way may be to use an EventAggrigator (Event Aggregator - Martin Fowler
http://www.martinfowler.com/eaaDev/EventAggregator.html[^]). Prism provides an implementation. The Prism example has advantages in that you can specify the thread.


这篇关于如何从业务层显示错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆