Enterprise Library 3.1 - slow?

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

Guest

Seeing as it is being recommended as the successor to SqlHelper.cs, I am
trying to use the Data Access Application block from the Enterprise Library.

My class works fine until i add the following line of code anywhere,
whereapon it runs incredibly slowly.

Database db = DatabaseFactory.CreateDatabase();

I understand that a database connection is a big resource, but it is taking
a good 10 to 15 seconds to even step to the method within the class with this
line in it, let alone run the line itself!

I hope it is simply a config issue i have overlooked, or i'll be sticking
with SqlHelper.

thanks in advance for any suggestions.
 
I don't have that behavior, and I use the 3.x version all the time.

1. Are you sure its not erroring out? As in, the server doesn't exist, and
its maximizing the ConnectionTimeout property?

2. It is the (first call) OR second, third, Nth call? JIT compiling and
assembly loading. Look at the assemblies loading in the code window.
One thing I do in the code, is de-reference the Oracle reference/assemblies,
and comment out the Oracle (concrete) class, plus a few minor changes to
Assembly.cs I believe.
That can slightly help with assembly loadup time. But that shouldn't be our
issue anyways.

3. I'm assuming you're using Sql Server, since you used the DAAB in the
past. Post your .config file connection string information so the newsgroup
can see how you're setting up your connection strings.
 
In reply to your points.

1) No it doesn't appear to be erroring out. The class does eventually load
(taking info from a datareader into the class properties) and displays in my
winform. I narrowed it down to adding/removing this line as to the place
where the slowness appeared. When i add this line, just stepping to the
Load() method takes the time.

2) Loading the class without the call to the database object simply loads my
businessobjects dll, symbols loaded and nothing more. Loading it with that
CreateDatabase line added, loads the following extras:

'ARESUI.vshost.exe' (Managed): Loaded
'C:\VSSWorking\dotNET\ARES\ARESUI\bin\Debug\Microsoft.Practices.EnterpriseLibrary.Data.dll', No symbols loaded.
'ARESUI.vshost.exe' (Managed): Loaded
'C:\VSSWorking\dotNET\ARES\ARESUI\bin\Debug\Microsoft.Practices.EnterpriseLibrary.Common.dll', No symbols loaded.
'ARESUI.vshost.exe' (Managed): Loaded
'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just My
Code' is enabled.

It loads these on the call to my this.Load() within the constructor of my
class. i.e as i step through the code it is on the this.Load() line NOT the
CreateDatabase() Line.

When the CreateDatabase Line is run it also loads the following:

'ARESUI.vshost.exe' (Managed): Loaded
'C:\VSSWorking\dotNET\ARES\ARESUI\bin\Debug\Microsoft.Practices.ObjectBuilder.dll', No symbols loaded.
The thread '<No Name>' (0x820) has exited with code 0 (0x0).
'ARESUI.vshost.exe' (Managed): Loaded
'C:\WINDOWS\assembly\GAC_32\System.Data.OracleClient\2.0.0.0__b77a5c561934e089\System.Data.OracleClient.dll', No symbols loaded.
'ARESUI.vshost.exe' (Managed): Loaded
'C:\WINDOWS\assembly\GAC_MSIL\System.Management\2.0.0.0__b03f5f7f11d50a3a\System.Management.dll', No symbols loaded.

I am using the compiled version of the framework dll as supplied by the
installation of the Enterprise Library, I originally used project references
to the Library so i could step through it and see what it was doing, but
don't feel the need to alter things so hoped the compiled version would be
fine for my needs.

3) Yes. It's SQL Server 2000. My Config file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings,
Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
<dataConfiguration defaultDatabase="ARES"/>
<connectionStrings>
<add name="ARES" connectionString="Data Source=MyServer;Initial
Catalog=ARES;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>

hope this helps!
 
Couple of extras:

1) I have just run it on my Laptop running local SQL2005 (which is the only
major difference) and it runs pretty slick, so thinking now it's a PC config
thing

2) On subsequent calls to the same class from the same winform it's fine too.
 
From previous post:
'C:\WINDOWS\assembly\GAC_32\System.Data.OracleClient\2.0.0.0__b77a5c561934e089\System.Data.OracleClient.dll',
No symbols loaded.

That's the one you can eliminate, if you want to. I doubt that's the issue.


I would try a test with the network protocol. (Since I think you're saying
your local one works fine, speed wise).
This might be a goose chase, but it might affect your remote speed.

Look here:
http://support.microsoft.com/kb/269882
and TAKE NOTICE of this:
Network Library=dbmssocn
(that's all to notice, as in, don't read the KB and think I"m saying
something from it) (Im pointing out that there is A way and A syntax for
specifiying the Network Library.

There are about 3-4 options you can pick.

dbmssocn says "use the Tcp/IP protocol".

You'll have to find the others.
http://www.google.com/search?hl=en&q=Sql+Server+2000+"Network+Library"+dbmssocn

But that might get you going.

The reason I mention this is that I was at a client site one time, and they
were using the "default" network protocol, which I believe for their setup
was named pipes.

We switched to tcp/ip and everything worked well (normal).

As I said, this might be a goose chase, but network protocol is one of the
least talked about and specified attributes of the overall sql server
connection string.
 
Thanks for the info... no dice as yet though...

As if by magic, the project is now on hold anyway, so i'll address this
again in about's a month's time! By which time there may well be similar
posts...

oweing to my curious nature, i have to say i'm peplexed by the fact that
it's on the call to my Load() method. I assume that the prescence of the
Factory Creation method means it's JIT'ing the enterprise library stuff?
 
The continuing saga...

I have added the source code for the enterprise library to my solution to
step through it and now the following line in EnterpriseLibraryFactory.cs is
the culprit

public static T BuildUp<T>(IConfigurationSource configurationSource)
{
return BuildUp<T>((IReadWriteLocator)null, configurationSource); //
This line!!
}

It loads the following as displayed in the Output window

'ARESUI.vshost.exe' (Managed): Loaded
'C:\VSSWorking\dotNET\ARES\ARESUI\bin\Debug\Microsoft.Practices.ObjectBuilder.dll', No symbols loaded.

Is there anywhere i can get the source to this dll? so i may continue the
search?!! or are there further suggestions now i've narrowed it down?

Note: Subsequest calls to this are NOT slow.

TIA
 
Microsoft.Practices.ObjectBuilder.dll

thats in the source code of the EnterpriseLibrary.

I usually reference this .dll directly in my project (that are using the
Data block)

Microsoft.Practices.EnterpriseLibrary.Common
Microsoft.Practices.EnterpriseLibrary.Data
Microsoft.Practices.ObjectBuilder
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top