Getting started with DAAB Hands On Lab for Ent Lib 4.1

Topics: Data Access Application Block, Enterprise Library Core, General discussion
Dec 21, 2009 at 8:07 PM

I've just started this lab  (ex01\begin folder using SimpleData.sln file) using Visual Studio 2008 and I'm running into issues which I think may be related to having an earlier version of Ent Lib installed on my machine (when I click start->all programs-> microsoft patterns & practices -> Enterprise Library 3.1 May 2007 is what I see).

Symptom 1: when I right-click on my app.config, Edit Enterprise Library Configuration tool is not exposed (i.e. not integrated into Visual Studio 2008) so I had to run EntLibConfig.exe and manually type the name of the database into the connection string (i.e. no ellipses in the ConnectionString property to launch the Connection Properties dialog) and this got created:

 

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </configSections>
    <connectionStrings>
        <add name="QuickStarts Instance" 
            connectionString="Database=EntLibQuickStarts;Server=(local)\SQLEXPRESS;Integrated Security=SSPI"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>

 

 

Symptom 2: Instructions for step 5 (mnuLoad_Click on page 3) emphasize coding to create the default database

 

db = DatabaseFactory.CreateDatabase( );

 

....which I did but with the app.config as above it blows up when I click Load. I can fix by specifying:

 

db = DatabaseFactory.CreateDatabase("QuickStarts Instance");

 

Symptom 3: An earlier project using Visual Studio 2005 and Ent Lib 3.1 exposes the choice of Edit Enterprise Library Configuration when I right click on its web.config file.

When I ran the EntLibLabs4_1.msi file last Friday, I think I specified a location for the output to be on my D: drive (i.e. my C:\Program Files\ location still contains the 3.1 version) and hence my 4.1 version is at this location:  D:\Enterprise Library 4.1 HOL\Lib

I'm thinking I am not set up correctly. Can different versions coexist "side by side"? Thanks.


Dec 22, 2009 at 4:25 AM

Hi,

For your symptom #1. You may try uninstalling the ent lib 4.1 and re-install it again. For #2, You may set the DefaultDatabase property of the DAAB to "QuickStarts Instance" so that you can use the db = DatabaseFactory.CreateDatabase( );
(without parameter). For #3 i remember having both 3.1 and 4.1 at the same time, and they both have the context menu for visual studio integration. For now, you can try a re-install and check if does solve the problem.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Dec 22, 2009 at 6:04 PM

Thanks for your reply.

I feel pretty sheepish now with this question. Apparently, I had not even installed the Ent Lib 4.1 !!

I ran the .msi file for the Ent Lib 4.1 Hands on Labs (HOL) with the result being all the Ent Lib 4.1 DLLs being placed in my designated location:

D:\Enterprise Library 4.1 HOL\Lib

Seeing all the assemblies there like Microsoft.Practices.EnterpriseLibrary.Common.dll, etc. I guess I presumed that installing the HOL somehow installed the Ent Lib 4.1 itself.

Your response got me to see if indeed I had overlooked a more basic install which I had. After installing it, all of my symptoms have cleared up and I've confirmed that both the 3.1 and 4.1

versions seem to coexist side by side (at least in the Start -> All Programs tree). Thanks again.