多层应用程序 [英] Multilayer applications

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

问题描述




人们,我想得到一些关于谁以及如何编写

多层应用程序的统计数据。


我们至少有几层:


1.表示层,即GUI。

2.业务逻辑层。


还有什么?使用数据库,数据集等的数据层?有没有人

将这一层分开更容易将最后一层与

业务逻辑层结合起来?什么是PRO和CONTRAs?


另外一个问题 - 我们可以从数据库中获取DataSet,然后将
解析为我们的自定义对象并使用对象。但我喜欢直接使用

DataSets,我发现它带给我一些优势,例如

它是显示数据的最有用的解决方案。 DataGrid或者在
DataTable中然后我得到我自己的对象并手动填满DataGrid。


任何人都可以写几句他是如何使用Web的

示例的应用程序,项目结构等等。


是否有人将SQL查询保存到单独的文件中并单独创建

数据层只是为了使用数据库?或者基本上所有人都更喜欢

在商业逻辑层工作?


谢谢,

Dmitri

Hi,

People, I''d like to get some statistics about who and how writes a
multilayer applications.

We''re having at least a few layers:

1. Representation layer, i.e. GUI.
2. Business logic layer.

What else? A data layer working with database, datasets etc.? Does anybody
separates this layer of it''s easier to combine the last one with the
business logic layer? What are PROs and CONTRAs?

Another one question - we can get the DataSet from the database, then parse
it into our custom objects and work with objects. But I like to work with
DataSets directly where I see that it brings me some advantage, for example
it''s the most useful solution to show the data in a DataGrid or in a
DataTable then I get my own object and fill up the DataGrid manually.

Can anybody write just a few words how he works with Web Applications for
example, the structure of the project, etc.?

Does anybody save the SQL queries into a separate file and makes a separate
data layer just to work with the database? Or basically all are preferring
to work at the business logic layer?

Thanks,
Dmitri

推荐答案

" Just D" < no@spam.please>在消息中写道

news:qFiMc.16600
"Just D" <no@spam.please> wrote in message
news:qFiMc.16600


Zr.3254@okepread01 ...
Zr.3254@okepread01...

<人们,我想得到一些关于谁和如何编写多层应用程序的统计数据。

我们至少有几层:

1.表示层,即GUI。
2.业务逻辑层。

还有什么?使用数据库,数据集等的数据层?
是否有人将这一层分开?将最后一层与
业务逻辑层结合起来更容易?什么是PRO和CONTRAs?


我通常将其分开并从业务层引用它。这使得你无法通过GUI进行直接数据库调用。

另一个问题 - 我们可以从数据库中获取DataSet,然后是
将其解析为我们的自定义对象并使用对象。但我喜欢直接使用
DataSet,我发现它给我带来了一些优势,对于
例子来说,它是在DataGrid或
中显示数据的最有用的解决方案。 DataTable然后我得到我自己的对象并手动填充DataGrid。


坚持使用自定义对象并使用数据加载器。在大多数情况下,你会对数据集的局限性感到沮丧。

任何人都可以只写几句话来说明他如何使用Web应用程序
示例,项目的结构等?


不确定你想要什么。关于Web应用程序的一些指示。保持

GUI简单。尽量不要制作Windows。您浏览器中的应用。尽量避免查看

状态和会话状态。使用隐藏变量或

参数作为WinForms等效于静态的参数变量。

是否有人将SQL查询保存到一个单独的文件中并使
单独的数据层只是为了与数据库一起工作?或者基本上所有人都更喜欢在业务逻辑层工作?
Hi,

People, I''d like to get some statistics about who and how writes a
multilayer applications.

We''re having at least a few layers:

1. Representation layer, i.e. GUI.
2. Business logic layer.

What else? A data layer working with database, datasets etc.? Does anybody separates this layer of it''s easier to combine the last one with the
business logic layer? What are PROs and CONTRAs?
I generally separate it and reference it from the business layer. This keeps
you from being able to make the direct database calls from your GUI.
Another one question - we can get the DataSet from the database, then parse it into our custom objects and work with objects. But I like to work with
DataSets directly where I see that it brings me some advantage, for example it''s the most useful solution to show the data in a DataGrid or in a
DataTable then I get my own object and fill up the DataGrid manually.
Stick with your custom objects and use datareaders. In time you will become
frustrated with the limitations of datasets in most situations.
Can anybody write just a few words how he works with Web Applications for
example, the structure of the project, etc.?
Not sure what you want here. A few pointers on web apps in general. Keep the
GUI simple. Try not to make a "Windows" app in your browser. Avoid view
state and session state as much as possible. Use hidden variables or
parameters as your WinForms equivalent of "static" variables.
Does anybody save the SQL queries into a separate file and makes a separate data layer just to work with the database? Or basically all are preferring
to work at the business logic layer?




是的。我个人最喜欢的是使用代码生成来创建所有

数据库方法(使用SQLXML和XSLT)。你最终得到的方法是

IDataReader MySelectStoredProcedure(int parameter1,string parameter2)

{

//返回datareader的代码


SP



Yes. My personal favorite is to use code generation to create all the
database methods (using SQLXML and XSLT). You end up with methods like
IDataReader MySelectStoredProcedure(int parameter1, string parameter2)
{
// the code that returns a datareader
}

created automatically for every stored procedure.

SP




感谢您的回答。
Hi,

Thanks for the answer.
我通常将其分开并从业务层引用它。这使您无法通过GUI进行直接数据库调用。


我认为GUI和busuness逻辑层是不同的实例。

是的,分开它们是有意义的,但应该做多少。我在本消息后面看到了

,您更喜欢使用存储过程来代替嵌入式文本查询的
。这是真的吗?我从我的公司使用Sql查询

层,但是我写了一个SqlWrapper类库,我只是发送这些查询

然后返回DataStets。

坚持使用自定义对象并使用数据加载器。在大多数情况下,您会对数据集的局限性感到沮丧。


嗯,如果我只需要获取一些数据并在DataGrid上显示那么为什么

我应该使用自己的自定义对象而不是DataSet,将现有对象绑定到DataGrid并享受更容易。我是对还是不对?或者你

解析所有DataSet并创建自己的自定义类然后公开它?在所有

其他情况下,使用我自己的类来处理数据更方便,我知道。

保持GUI简单。尽量不要制作Windows。浏览器中的应用程序。
尽量避免查看状态和会话状态。使用隐藏变量或


走这条路并不总是那么容易。有时我会使用同一页面显示

的东西并编辑一些东西。这是我老板的要求。这就是为什么我需要

页面状态,只是在页面模式之间切换,它工作正常。

参数,因为你的WinForms相当于静态。变量。


是的,我发现了这个技巧,但有时这些隐藏的变量是可见的,如果您从浏览器中保存页面并且这不是很好。我看到很多例子

当我试图保存一些页面只是为了记住交易

而且我得到了一大堆变量,隐藏在通常的模式中,但是在保存模式下可以看到
。这很有趣,但并不重要。

是的。我个人最喜欢的是使用代码生成来创建所有的数据库方法(使用SQLXML和XSLT)。你最终得到的方法是


你总是使用存储过程而不是实现的SQL代码吗?

IDataReader MySelectStoredProcedure(int parameter1,string parameter2)
{
//返回数据加载器的代码
}
为每个存储过程自动创建。
I generally separate it and reference it from the business layer. This
keeps
you from being able to make the direct database calls from your GUI.
I supposed that GUI and the busuness logic layer are different instances.
Yes, that makes sense to separate them but how much it should be done. I saw
later in this message that you prefer to use the stored procedures instead
of embedded text queries. Is it true? I use Sql Queries from my business
layer but I wrote a SqlWrapper class library and I just send these queries
there and get the DataSets back.
Stick with your custom objects and use datareaders. In time you will
become
frustrated with the limitations of datasets in most situations.
Hm, if I need just to get some data and show it on the DataGrid then why
should I use my own custom object instead of a DataSet, it''s easier to bind
an existing object to the DataGrid and enjoy. Am I right or not? Or you
parse all DataSets and create your own custom class then expose it? In all
other cases it''s more convenient to use my own classes to work with data, I
know that.
Keep the GUI simple. Try not to make a "Windows" app in your browser.
Avoid view
state and session state as much as possible. Use hidden variables or
It''s not always easy to go this way. Sometimes I use the same page to show
something and to edit something. It''s my boss requirement. That''s why I need
the page status, just to switch between page modes and it works fine.
parameters as your WinForms equivalent of "static" variables.
Yes, I found this trick, but sometimes these hidden variables are visible if
you save the page from your browser and that''s not good. I saw many examples
when I was trying to save some page just to remember about the transaction
and I was getting a whole bunch of variables, hidden in a usual mode, but
visible in saved mode. That''s funny, but not critical.
Yes. My personal favorite is to use code generation to create all the
database methods (using SQLXML and XSLT). You end up with methods like
Do you always use the Stored Procedures and never an implemented SQL code?
IDataReader MySelectStoredProcedure(int parameter1, string parameter2)
{
// the code that returns a datareader
}
created automatically for every stored procedure.




我看到了一种解决方案,其中所有SQL查询都已存储到外部XML

文件中。我没有看到这种方法非常好,但它存在。从我的

的角度来看,使用业务层来处理查询要好得多。

也许我错了。


我不喜欢这种方式的主要原因 - 我不能在Windows应用程序中使用这些类

库,因为所有这些查询都将被共享

作为简单的文本文件。根本没有任何安全性。


你使用了多少层?


1. GUI。

2.业务逻辑层。

3.数据库访问层。


正确吗?


你有所有您的查询存储在数据库中作为SP?


谢谢,

Dmitri



I saw one solution where all SQL queries have been stored into external XML
file. I don''t see that this approach is very good but it exists. From my
point of view it''s much better to use a business layer to work with queries.
Maybe I''m wrong.

The main reason why I don''t like this way - I can''t use these class
libraries from Windows Application, because all these queries will be shared
as a simple text file. There is no security at all.

So how many layers you use?

1. GUI.
2. Business logic layer.
3. Database access layer.

Correct?

Are you having all your queries stored on the database as SPs?

Thanks,
Dmitri


这篇关于多层应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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