暴露来自数据对象的警告 [英] Exposing warnings from data objects

查看:89
本文介绍了暴露来自数据对象的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过面向服务的程序集公开Data对象(在将来的使用中可能会成为WCF服务).

数据对象是树状设计的,并且是由属性分配形成的.现在,我想公开数据流警告,并想知道什么是最好的方法,必须考虑以下几点:(1)分离(2)易于访问.一方面,我希望UI团队能够访问字段警告(或错误),而不必让他们将字段名称映射到外部源,但另一方面,我不希望警告挂起"在对象本身上(因为我没有看到正确的设计).

我努力为每个字段创建一种新型的包装器,该包装器将公开事件,并且他们必须注册他们关心的事件(但完全不确定),我很高兴听到您的消息的想法.你能指导我一个尊重的设计模式吗? dp在这里最适合做什么?

非常感谢您!

I''m exposing Data objects via service oriented assembly (which on future usages might become a WCF service).

The data object is tree designed, as well as formed from allot of properties. I now want to expose data flow warnings and wondering what''s the best way to do it having to things to consider: (1) seperation (2) ease of access. On the one hand, i want the UI team to be able to access a fields warnings (or errors) without having them mapping the field names to an external source but on the other hand, i don''t want the warnings "hanged" on the object itself (as i don''t see it a correct design).

I tought of creating a new type of wrapper for each field, that''ll expose events and they''ll have to register the one''s they care about (but totally not sure) I''ll be happy to hear your thoughts. Could you please direct me to a respectful design pattern ? what dp will do best here ?

Thank you very much!

推荐答案

由于您需要让UI团队处理您的数据合同",因此最好构建直接映射到合同的视图对象.
这将需要转换代码才能在视图和合同之间转换,并且反之亦然.

这些对象可以包含内置的数据流"警告.
UI团队需要从这些继承并添加他们自己的UI相关代码,但会受到您的规则的约束.

当然,您可能需要在wcf端重复数据流警告,以防有人想要调用服务.
As you need to have the UI team deal with your "datacontracts" it would be better to build view objects that map directly to your contracts.
This will require conversion code to convert between the view and your contracts and visaversa.

These objects can contain your "dataflow" warning built in.
The UI team would need to inherit from these and add their own UI related code but would be bound by your rules.

You would of course need to duplicate the dataflow warnings on your wcf side in case someone wants to call the services.


这篇关于暴露来自数据对象的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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