C#:CodeBehind和代码重用在Windows应用程序中使用继承 [英] C#: CodeBehind and Code Re-Use Using Inheritance in windows applications

查看:61
本文介绍了C#:CodeBehind和代码重用在Windows应用程序中使用继承的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有没有办法在Windows应用程序中分离界面代码

用于各种设计目的?就像它可以在ASP.NET中完成一样,一个

代码可以在不同的外观中继承不同的设计。


真诚

Del

解决方案

当然有办法。它被称为分层应用程序。 usualy

图层是

DAL - 数据访问层,

BL - 业务层

PL - 表示层


DAL和BL包含在类库项目中。您可以使用BL和DAL以及Winform或者和Web进行

解决方案类库项目

表示层应用程序。


我希望这有帮助

Galin Iliev [MCSD.NET]
www.galcho.com


感谢Galcho的回复!您是否可以在工作室2005中找到构建

分层应用程序的示例?


" Expert C#Business Objects"是一个开始阅读的好地方,以及一个方便的投资。


我们使用新的System.Windows.Forms.BindingSource实现

我们的业务对象的基类。我相信你必须使用

..Net 2.0来利用它。


现在我们的业务对象可以用作任何数据绑定的数据源

控制,我们可以把我们的业务逻辑放到课堂上。例如,

我们的业务对象有一个验证数据的Update()方法,然后
调用将更改的数据写回数据库。如果验证

失败,则记录错误。然后在其上显示错误

提供程序的详细信息表单将显示相应的错误消息。


实际上不可能向您发送代码示例,因为1)我不是

发送专有代码广告2)将

放在一起作为一个例子需要很长时间。


如果您仍然不确定如何继续,您可以考虑签约

a当地顾问几个小时,以便让您入门。那就是我所做的
,花了很多钱。


加里

ja ***** @ gmail.com 写道:



有没有在Windows应用程序中分离界面代码的方法
用于各种设计目的?就像它可以在ASP.NET中完成一样,一个
代码可以在不同的皮肤中继承不同的设计。

真诚的
Del



Hi

Is there a way to seperate code of interface in windows applications
for various design purposes? Just like it can be done in ASP.NET, one
code can be inherited in different skins with different design.

Sincerely
Del

解决方案

of course there is a way. It is called layered application. usualy
layers are
DAL - Data Access Layer,
BL - Business Layer
PL - Presentation layer

DAL and BL are contained in Class library projects. You can have in on
solution Class library project with BL and DAL and Winform or\and Web
Application for Presentation layer.

I hope this helps
Galin Iliev[MCSD.NET]
www.galcho.com


Thanks Galcho for your response! Can you drop an example of building
layered application in studio 2005?


"Expert C# Business Objects" is a good place to start reading, and a
handy investment.

Our implementation using the new System.Windows.Forms.BindingSource as
the base class for our business object. I believe you must be using
..Net 2.0 to take advantage of this.

Now our business object can be used as a datasource for any data bound
control, and we can put our business logic into the class. For example,
our business object has an Update() method that validates the data, then
calls writes the changed data back to the database. If validation
fails, the record is flagged in error. A detail form with an error
provider on it can then display the appropriate error message.

It isn''t really possible to send you code examples because 1) I''m not
sending out proprietary code ad 2) It would take quite a while to put
together an example for you.

If you still aren''t sure how to proceed, you might consider contracting
a local consultant for a couple hours just to get you started. That''s
what I did, and it was money very well spent.

Gary

ja*****@gmail.com wrote:

Hi

Is there a way to seperate code of interface in windows applications
for various design purposes? Just like it can be done in ASP.NET, one
code can be inherited in different skins with different design.

Sincerely
Del



这篇关于C#:CodeBehind和代码重用在Windows应用程序中使用继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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