优点和使用企业库的优缺点 [英] Advantages and disadvantages of using Enterprise Library

查看:89
本文介绍了优点和使用企业库的优缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

林刚起步的项目,因为这个项目是个人我不知道什么是使用企业库的优势是什么?我们使用的版本2的几个项目办公室,但即时通讯的它的优势(中预留的良好做法)不十分清楚,尤其是在数据库组件。任何建议?谢谢

Im just starting a project and since this project is personal I was wondering what are the advantages of using Enterprise Library? We use the version 2 for several projects in the office but im not quite sure (aside of the good practices) of the advantages of it, especially in the database component. Any advice? Thanks

推荐答案

对于数据库应用程序块的主要优点是,它可以更容易地生产数据库无关的code。开发商主要交互通用数据库和的DbCommand对象,而不是如的SqlConnection,SqlCommand的,等等。因此,切换到不同的数据库(如Oracle)的变得更为可行。根据您的业务需求,这可能是有优势的。 EntLib还轻轻地敦促开发商使用DbParameter的查询参数,从而降低了SQL注入攻击的风险的方向。

For the database application block, the main advantage is that it makes it easier to produce database-agnostic code. The developer interacts mainly with generic Database and DbCommand objects, rather than eg SqlConnection, SqlCommand, etc. Thus, switching to a different database (ie Oracle) becomes more feasible. Depending on your business needs, this could be a definite advantage. EntLib also gently prods the developer in the direction of using DbParameter for query parameters, which reduces the risk of SQL injection attacks.

作为另一海报mentionned,数据应用程序块是稍高级别比直ADO.NET类,因此往往需要的code行更少做同样的事情。

As another poster mentionned, the data app block is somewhat higher-level than the straight ADO.NET classes, so it tends to require fewer lines of code to do the same thing.

从我的观点来看,数据,例外和记录块是最有用的。异常和日志记录以及使它很容易记录异常(废话),以一些地方和一些格式。例如,他们可以把整个异常日志条目,包括堆栈跟踪,在Windows事件日志使其比较容易诊断问题。

From my point of view, the data, exception and logging blocks are the most useful. Exception and Logging together make it very easy to log exceptions (duh) to a number of places and in a number of formats. For example, they can put the entire exception log entry, including the stack trace, in the Windows event log making it relatively easy to diagnose a problem.

EntLib的一个缺点是,一些应用程序块放置相当多的逻辑到配置文件。所以,你的逻辑是多个S $ P $垫出来;还有一部分是在code,一些配置文件。有利的一面是,该配置可以被修改后的版本,甚至部署后。

One disadvantage of EntLib is that some app blocks place quite a bit of logic into configuration files. So your logic is more spread out; some of it is in code, some in config files. The upside is that the configuration can be modified post-build and even post-deployment.

这篇关于优点和使用企业库的优缺点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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