如何通过写一次他们分享在RIA服务客户端和服务器之间等领域类和业务规则 [英] How to share domain classes and business rules between client and server like in RIA Services by writing them only once

查看:123
本文介绍了如何通过写一次他们分享在RIA服务客户端和服务器之间等领域类和业务规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个ASP.NET - WCF应用程序,我想不用重写他们,就像在Silverlight RIA服务共享客户端和服务器之间的域类和业务规则。在一个程序集收集这些,并从客户端和服务器就可以解决问题,但如何引用这​​一点:通过增加服务refence客户会产生这些类的客户端代理,没有任何行为(方法)。我怎样才能achive呢?

In an ASP.NET - WCF application I want to share domain classes and business rules between client and server without rewriting them, just like in Silverlight RIA Services. Collecting these in one assembly and referencing this from client and server can solve the problem, but how: by adding service refence to client will generate these classes in client proxy, without any behaviour (methods). How can I achive this?

注:RIA服务将无法使用。

NOTE: RIA Services will not be used.

编辑:一些谷歌搜索后,我遇到了CSLA.NET。它可以解决这个问题呢?

After some Googling I came across CSLA.NET. Can it solve this issue?

推荐答案

确定这里是如何我已经做到了:作为blowdart说我把我想要的服务器和客户机之间共享到所有域code单独的装配。然后,我有服务器和客户端引用到这个共享程序集。然后添加服务引用的客户端,但有一个例外:在添加服务引用对话框有一个按钮高级。在那里,我已经在引用的程序检查重用类型。这样一来,我把所有的代理好吃的东西,异步方法调用等等,对我产生的。

Ok here is how I've done it: As blowdart said I put all the domain code that I want to share between server and client into a seperate assembly. Then I had both server and client referencing to this shared assembly. Then added service reference to client, with one exception: In add service reference dialog there is a button "Advanced". There I have checked reuse types in referenced assemblies. This way I had all proxy goodies, asynchronous method calls etc., generated for me.

这篇关于如何通过写一次他们分享在RIA服务客户端和服务器之间等领域类和业务规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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