Ok, I have finally got *most* of the Enterprise Library working. I thought it was going to be a quick upgrade since I have been using the Data Application and Exception Handling Blocks for several years, but it was a bit of a learning curve.
Rather than explain what they are (which is available on MSDN) or give step by step instructions (which is available upon install), I thought I would give you my “two cents” which should shorten your learning curve (at least a little).
- Make sure you run the “Install Services” batch file so that you get can view Performance Logs (you will see errors in your Eventlog if you don’t). (And yes you can turn them off if you don’t want to use them).
- I would Learn the blocks in the following order:
- Data Access
- Exception Handling
- Logging and Instrumentation
- Configuration
- Data Access
- To log to a database, make sure you run %Install Dir%\src\Logging\Sinks\Database\Scripts\LoggingDatabase.sql. When you set up your database to log to, it will ask what sproc to run. The default is “WriteLog”. This will create that sproc along w/ the underlying table in its own database.
- The connection string is now assembled for you from parameters you add to a “Connection String” node. I had to add “user id” and “password” manually.
- Connectionstring’s are replaced with “Databases”…sorta. In the Enterprise Library Configuration Utility you set up different “Databases” which are essentially names for connectionstrings. They host the configuration for that database.
- If you are used to the old Data Application Block, you will have to change your code since all the static functions are now contained in a Database wrapper class. For example:
will become:
DataSet ds = SqlHelper.ExecuteDataset(con,storedProcedureName,parameterValues);
“DATABASE NAME” is how you refer to which “database” in the Enterprise Library Config you want to run it against. Hopefully you have some type of Data Access Layer so that these changes don’t span across all your projects. Thankfully, I really only had to change about 20 references in one class.
Database db = DatabaseFactory.CreateDatabase(“DATABASE NAME”);
DataSet ds = db.ExecuteDataSet(storedProcedureName,parameterValues);
- Understand that you will have to spend several hours reading through the documentation. I spent about 3 or 4 hours reading the Data Access code and converting my class to use it. Then I spent another 3 or 4 hours reading the rest.
Resources:
Enterprise Library Download
Channel 9 Online Tutorials
GotDotNet Enterprise Library Message Board
Scott Mitchell’s Introduction to Enterprise Library
Enterprise Library Webcasts with Ron Jacobs
3 responses to “Enterprise Library Quick Start”
Personally I prefer an O/R Mapper and ELMAH 😉
Yeah, definately can’t fault you for that. Going O/R seems too cumbersome for me, but ELMAH seems nice. I remember reading about it but not liking it enought to replace my existing application block.
http://xenical.fe.crimea.ua/xenical/non-prescription-xenical.html
http://xenical.fe.crimea.ua/xenical/xenical-fact.html
http://xenical.fe.crimea.ua/xenical/xenical-generic.html
http://xenical.fe.crimea.ua/xenical/xenical-customer-reviews.html
http://xenical.fe.crimea.ua/xenical/xenical-and-existing-fat.html
http://xenical.fe.crimea.ua/xenical/xenical-medical-problems.html
http://xenical.fe.crimea.ua/xenical/xenical-cheap-consultation.html
http://xenical.fe.crimea.ua/xenical/xenical-with-no-prescription.html
http://xenical.fe.crimea.ua/xenical/xenical-safety.html
http://xenical.fe.crimea.ua/xenical/xenical-study.html
http://xenical.fe.crimea.ua/xenical/xenical-reviews.html
http://xenical.fe.crimea.ua/xenical/xenical-prices.html
http://xenical.fe.crimea.ua/xenical/xenical-paypal.html