What are the pros and cons in using Enterprise Library?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm new to .net. It seems that those application blocks in Enterprise
Library are very useful especially when one tries to build a new application.
I want to know the pros and cons in using those blocks. Is MS going to
release new Enterprise Library for future .net version/build? If I use the
current version of the blocks, what happen when a new version comes out?
 
I spent a good deal of time looking at and experimenting with the first
release of the Enterprise Library. That version dealt with application
configuration, application logging, polymorphic data access, caching, and
cryptography.

Configuration: it was fairly complex with the requirement that you create a
serializable configuration class. With VS 2005, configuration management is
really simple.

Logging: It was slow and bulky. All of my projects use log4net which has
log4j as its origins. It works great

Caching - looked interesting but not overly useful.

Data access - I work with both SQL Server and Sql Anywhere. Both .net
drivers have their "features" which require some interesting workarounds.
Furthermore, the DataSet has an interesting feature.
Dataset.GetChanges(System.Data.DataRowState.Added) not only includes the
rows that are added, but also includes the parent rows if they have been
modified. As a result, you simply can't call the adapter.update method for
those rows that have been added. You have to verify that the rowstate is
Added. So much for polymorphic data access.

Cryptography - It's not that hard plus the Enterprise Library did not
support asymmetric encryption.

So, for my purposes, I rejected the Enterprise Library. Your conclusions
might be different.
 
Thanks Jim. Since you did not use Enterprise Library, what do you use?
Which version of .net framework are you using now?
 
I'm working with the 2.0 framework.

log4net is used for all logging. Program.cs (for windows apps) has some
code to catch unhandled exceptions:
/* Unhandled errors */
ThreadExceptionHandler handler = new ThreadExceptionHandler();
Application.ThreadException += new
ThreadExceptionEventHandler(handler.Application_ThreadException);

For data caching (smart client apps), simple writes / reads to isolated
storage is used.

I wrote my own cryptography utility class that does MD5 hashing, Rijndael
symmetric encryption and RSA asymmetric encryption.

For data access, I've got a static helper class for processing generic data
adapter lists. For configuring data adapters, I've got a little MS Access
program that writes all the C# code. I found table adapters to be terrible
and the data adapter sql wizards to be inadequate.

For the application configuration, that's all done through VS 2005 and some
special C# stuff to pull the info out of app.config.

So let's see, that covers configuration, logging, caching, data acess and
cryptography. Not much left for the Enterprise Library.

Jim
 
Jim,

Thansk for the detail information. The main reason I'm thinking about the
Enterprise Library is the Data Access and Validation block. I also think
the table adapter is not flexible enough. However, to use data adapter will
require coding from scratch. So, I'm wondering whether the Data Access block
in Enterprise Library will be a good starting point.

By the way, I don't know that VS2005 has a data adapter sql wizard.
 
Add a component to your project. Right click the data tab in the toolbox.
Click customize. Add a SqlDataAdapter and a SqlConnection. Now drag a data
adapter onto the component designer surface. It works just like VS 2003.

I found the designer to be inadequate for generating sql code. Look at the
data that it has available and the C# code it generates. It doesn't take a
whole lot of imagination to create a data structure and code generator using
that as an idea base that configures data adapters the way you want them.

Well worth the time.

The Enterprise Library is not going to address correctly configuring the
data adapters with complex SQL that handles auto increment keys and
timestamp concurrency checking:

SELECT CERegistrationID,NonMemberID,Paid,RealtorID,SmartCard, 1 AS
Downloaded,CAST(TS AS INT) AS TS
FROM dbo.CERegistration
WHERE CERegistrationID IN (SELECT CR.CERegistrationID
FROM dbo.CourseRegistration AS CR INNER JOIN dbo.Course AS C ON
CR.CourseID = C.CourseID
WHERE C.EventID = @EventID)

INSERT INTO dbo.CERegistration (NonMemberID,Paid,RealtorID,SmartCard)
VALUES (@NonMemberID,@Paid,@RealtorID,@SmartCard);SELECT CERegistrationID,
CAST(TS AS INT) AS TS FROM dbo.CERegistrationWHERE CERegistrationID =
SCOPE_IDENTITY()

UPDATE dbo.CERegistration
SET [NonMemberID] = @NonMemberID,
[Paid] = @Paid,[RealtorID] = @RealtorID,
[SmartCard] = @SmartCard
WHERE CERegistrationID = @Original_CERegistrationID AND CAST(TS AS INT) =
@Original_TS;SELECT CAST(TS AS INT) AS TS FROM dbo.CERegistration WHERE
CERegistrationID = @CERegistrationID

DELETE FROM dbo.CERegistration
WHERE CERegistrationID = @Original_CERegistrationID AND CAST(TS AS INT) =
@Original_TS

My code generator wrote the above sql automatically except for the SELECT
statement. For the SELECT statement, I had to manually add the WHERE clause
to the retrieve only those CERegistration rows that are referenced by the
many-to-many CourseRegistration table that references the one-to-many Course
table for an Event.

Just typing that SELECT statement into the Microsoft SQL wizard will cause
it to chock and will prevent it from continuing on to configure the
parameter collection.

Also, the Enterprise Library will not address the nasty little traps in the
adapter itself when updating.
 
Thanks Jim. When you're commenting on Enterprise Library, I assume that
you're referring to Enterprise Library 1.0 not Enterprise Library 3.1. I
wonder whether MS has enhanced it to resolve the issues you mentioned.

Jim Rand said:
Add a component to your project. Right click the data tab in the toolbox.
Click customize. Add a SqlDataAdapter and a SqlConnection. Now drag a data
adapter onto the component designer surface. It works just like VS 2003.

I found the designer to be inadequate for generating sql code. Look at the
data that it has available and the C# code it generates. It doesn't take a
whole lot of imagination to create a data structure and code generator using
that as an idea base that configures data adapters the way you want them.

Well worth the time.

The Enterprise Library is not going to address correctly configuring the
data adapters with complex SQL that handles auto increment keys and
timestamp concurrency checking:

SELECT CERegistrationID,NonMemberID,Paid,RealtorID,SmartCard, 1 AS
Downloaded,CAST(TS AS INT) AS TS
FROM dbo.CERegistration
WHERE CERegistrationID IN (SELECT CR.CERegistrationID
FROM dbo.CourseRegistration AS CR INNER JOIN dbo.Course AS C ON
CR.CourseID = C.CourseID
WHERE C.EventID = @EventID)

INSERT INTO dbo.CERegistration (NonMemberID,Paid,RealtorID,SmartCard)
VALUES (@NonMemberID,@Paid,@RealtorID,@SmartCard);SELECT CERegistrationID,
CAST(TS AS INT) AS TS FROM dbo.CERegistrationWHERE CERegistrationID =
SCOPE_IDENTITY()

UPDATE dbo.CERegistration
SET [NonMemberID] = @NonMemberID,
[Paid] = @Paid,[RealtorID] = @RealtorID,
[SmartCard] = @SmartCard
WHERE CERegistrationID = @Original_CERegistrationID AND CAST(TS AS INT) =
@Original_TS;SELECT CAST(TS AS INT) AS TS FROM dbo.CERegistration WHERE
CERegistrationID = @CERegistrationID

DELETE FROM dbo.CERegistration
WHERE CERegistrationID = @Original_CERegistrationID AND CAST(TS AS INT) =
@Original_TS

My code generator wrote the above sql automatically except for the SELECT
statement. For the SELECT statement, I had to manually add the WHERE clause
to the retrieve only those CERegistration rows that are referenced by the
many-to-many CourseRegistration table that references the one-to-many Course
table for an Event.

Just typing that SELECT statement into the Microsoft SQL wizard will cause
it to chock and will prevent it from continuing on to configure the
parameter collection.

Also, the Enterprise Library will not address the nasty little traps in the
adapter itself when updating.
By the way, I don't know that VS2005 has a data adapter sql wizard.
 
Hi,

dotNet surely contains wizard data adapters and it works very perfectly.
That if you are working and create your data access on your form level.
But whenever you will transfer your data access to another tier, I think
you will have another scenario. You must then create your own tool for
data access.

Enterprise Manager? well, its a pre-defined and existing tools that you
can use. Well, it really depends on the application you will be having.
Maybe it will work on your side maybe not. dotNet already contains lot
of tools but you have to build it for your own.
 
Back
Top