Sunday, June 19, 2005

Enterprise Library Tips for Configuration

[This was originally posted at http://timstall.dotnetdevelopersjournal.com/enterprise_library_tips_for_configuration.htm]

Enterprise Library is Microsoft's next generation of Application Blocks. It's a free, integrated suite of common architectural components that your project probably needs. It has several good perks:

  • Includes all source code
  • An auto-config tool to handle the Xml config files.
  • 38 projects of well written code - i.e. a good example to learn from
  • Full documentation
  • A huge community supporting it.

You can download it here. Be sure to check the official blogs:

When I first was playing around with it, I had trouble with creating strong names and config files.

Configuration Tips

1. A single application can have multiple physical config files:

  • CachingQuickStart.exe.config (app)
  • cachingConfiguration.config (other block)
  • dataconfiguration.config (other block)

Furthermore, you'll need to make sure that the correct file is copied to the app's bin. Merely rebuilding or using EntLib's config tool doesn't copy all configs.

2 - For the data access block config, you'll need to set both the connection string as well as the individual params. Config looks like:


   
       
       
       
   

3 - For the Caching Block's Data Provider:

  • "PartitionName" does not correspond to actual database partitions, but rather a value in the Caching.CachData.PartitionName column. This means that you don't need to create a DB partition for the DB cache to work.
  • Make sure that you run the script to create the Caching DB ('Caching').
  • Make sure that user has access to the 'Caching' database, and can insert into the CacheData table. Merely running the create script doesn't provide access to custom users.

4 - For the Caching Block's Isolated Storage, this uses System.IO.IsolatedStorage. You do not provide a physical file path name. Partition Name is a folder name like "MyApp".

I'll discuss Strong Names in my next post.

No comments:

Post a Comment