Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Advantages and disadvantages of using Enterprise Library

Tags:

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

like image 480
Gustavo Rubio Avatar asked Oct 27 '08 18:10

Gustavo Rubio


People also ask

What is the use of Microsoft Enterprise Library?

Microsoft Enterprise Library is a collection of reusable application blocks designed to assist software developers with common enterprise development challenges.

What is Enterprise Library System?

The Microsoft Enterprise Library is a set of tools and programming libraries for the Microsoft . NET Framework. It provides APIs to facilitate proven practices in core areas of programming including data access, logging, exception handling and others.

How do I install Enterprise Library?

Step 1: Right-click on References and choose the Manage Nuget Packages and search for the Enterprise Library and install it on the project. Step 2: Now add two new folders named DAL and Model to the library project. Step 3: Right-click on the Model folder and add a new class named CollegeDetails.


2 Answers

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.

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.

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.

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.

like image 163
Paul Lalonde Avatar answered Oct 02 '22 02:10

Paul Lalonde


My team did an evaluation of the Microsoft Patterns and Practices Enterprise Library about 2 years ago as part of a re-engineering of our product line. The only part we ended up using was the database block. We even wrapped that in some classes that we could instantiate so we could mock out the DAL for unit testing; the Microsoft code block used static calls for database work. I am not sure if Microsoft has integrated any of the LINQtoSQL or Entity Framework stuff into the db block. I would be hesitant to use the db block now if it did not leverage one of those.

As far as logging goes, we found Log4Net to be a much more robust and flexible solution that the Microsoft logging. We went with that for our logging needs.

For exception handling, we rolled our own. The Microsoft code did not handle the remoting cases we wanted to handle, and since we were using a 3rd party logging framework it made more sense to write our own exception library and integrate with that. I have found that some level of integration of the logging framework into the exception framework can be very useful. We wrote some lightweight wrapper classes around Log4Net and called those from our exception logging so we didn't introduce dependencies on Log4Net.

like image 44
Jason Jackson Avatar answered Oct 02 '22 04:10

Jason Jackson