远程方法,远程集中管理 [英] Remote methods, central management of remoting

查看:150
本文介绍了远程方法,远程集中管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先让我解释什么,我想做的事情。我想devolop将侦听客户端请求的服务器。我的服务器采用模块化架构。

First of all let me explain what I want to do. I want to devolop a server that will listen to client requests. My server has a modular architecture.

例如,有报价模块。要约模块有4个项目:动作,信息,实体和查询。该查询项目通常包含包含远程方法的类。

For example, there is an Offer module. The Offer Module has 4 projects: Action, Message, Entity, and Query. The Query project generally contains the classes which contain remote methods.

第一个问题:我怎么能发展自己的服务器,使得其管理所有事务,查询中心。我的意思是,所有的请求都应该从这次中央管理类被路由到所请求的模块及其远程方法。我需要你的想法。

First question: How can I develop my server such that it manages all transactions, queries centrally. I mean, all the requests should be routed from this central managing class to the requested module and its remote method. I need your ideas.

二:比方说,在我的提议模块,查询项目的ProductQuery类有10个方法,但其中5个是远程的。该CustomerQuery类有15个方法,其中3人是远程的方式。我想获得的所有远程方法在一个查询项目(例如在OfferModule的查询项目,或会计模块的查询项目)的一个组件,用于远程处理。例如,在一个OfferQuery装配

Second: Let's say that in my Offer module, the Query project's ProductQuery class has 10 methods but 5 of them are remote. The CustomerQuery class has 15 method, 3 of them are remote methods. I want to obtain all remote methods in one query project (for example in OfferModule's Query project, or Accounting module's Query project) to one assembly for remoting. For example in one OfferQuery assembly.

我需要你的帮助。谢谢!

I need your help. Thank you!

推荐答案

我会离开你的第一个问题的答复,因为它不能被合理地以目前的形式回答。

I'll leave your first question unanswered, because it cannot be reasonably answered in its current form.

我的第二个问题的理解:

首先,让我试着去了解你的服务器体系结构的基本布局:

First, let me try to understand your server architecture's basic layout:

  +--------+  1     1..n  +--------+  1    1..n  +---------+
  | Server |<>------------| Module |<>-----------| Project |
  +--------+              +--------+             +---------+

有一台服务器,其中具有或由1个或多个模块,每个具有或由几个projecs。我把这个直接从你的问题。我不理解这里的第一件事是,我们谈论的运行时组件,或者你的源$ C ​​$ C解决方案的布局?

"There's one server, which has or consists of 1 or more modules, each of which has or consists of several projecs." I took this straight from your question. The first thing I don't understand here is, are we talking about run-time components, or about the layout of your source code solution?

更具体地说,你似乎有模块,项目和类的这个层次:

More concretely, you seem to have this hierarchy of modules, projects, and classes:

Server
|
+---- Accounting (module)
|     ¦
|     ? (projects)
|
+---- Offer (module)
¦     |
?     +---- Action (project)
      |
      +---- Message (project)
      |
      +---- Entity (project)
      |
      +---- Query (project)
            |
            +---- ProductQuery (class)
            |
            +---- CustomerQuery (class)
            ¦
            ?

如果我理解正确的话,你现在要收集来自例如,所有的远程查询方法 ProductQuery CustomerQuery 常见的 OfferQuery 类中...这是正确的?

And if I understand you correctly, you now want to gather all "remote" query methods from e.g. ProductQuery and CustomerQuery inside a common OfferQuery class... is this correct?

建议对第二个问题的解决方案方向:

现在,因为你没有提供太多细节的技术,并且使用的框架,我也会留下来有些含糊:

Now, given that you have not provided much detail about the technologies and frameworks that you use, I'll also stay somewhat vague:

我觉得你想要做的是不是一个好方法。为什么?因为你打算把完全不相关的东西放到一个特定的类,基于这样的理念,他们都是查询的方法。但他们查询非常不同的东西:例如, 商情产品客户。这不是一个良好的面向对象设计,因为,它不是面向领域的。它的查询为主。

I think what you're trying to do isn't a good approach. Why? Because you're going to put completely unrelated things into one single class, based on the idea that they're all "query" methods. But they query very different things: e.g. Offers, Products, Customers. That's not a good object-oriented design because, well, it's not "domain-oriented". It's query-oriented.

我觉得你应该好好制定一个干净的对象(域)模型。围绕在你的系统中的逻辑实体设计类(如已经提到的优惠,产品,账户,客户等)。保持完全免费的查询方法的相应类。

I think you would do well to develop a clean object (domain) model. Design classes around the logical entities in your system (e.g. the already mentioned offers, products, accounts, customers, etc.). Keep the corresponding classes completely free of query methods.

现在,你在哪里的疑问去了?你可以看一下对象关系映射器模型(OR / M)完成这个任务。休眠(或.NET,NHibernate的)或微软的实体框架.NET都是不错的选择。他们将映射您的域模型到关系型数据库,并完成所有的创建,查询,更新和删除在DB你。

Now, where do the queries go? You could look at object-relational model mappers (OR/M) for this task. Hibernate (or with .NET, NHibernate) or Microsoft's Entity Framework for .NET are good options. They will map your domain model onto a relational database and do all the creating, querying, updating and deleting in the DB for you.

这篇关于远程方法,远程集中管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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