Tom Hollander's blog

patterns, practices and pontification

Brian blogs on ObjectBuilder and EntLib

Brian blogs on ObjectBuilder and EntLib

  • Comments 5

More than a few people have peeked behind the curtain of Enterprise Library for .NET 2.0 and have raised some excellent questions about ObjectBuilder and its role in Enterprise Library. Brian Button, our new fearless development leader has just written an excellent blog post that unravels many of the mysteries of this part of the architecture - and if it doesn't answer your questions, please post comments and I know Brian will be ever-so-happy to answer you later on.

And finally - I know the release date of EntLib for .NET 2.0 is on many people's minds. While I can't give you a final date right now, I can let you know that we are now on the final tasks (things like final testing of the installer and putting together the MSDN pages), so we are very close and I'll get an update to you very soon - rest assured that the release will be branded January 2006.

This posting is provided "AS IS" with no warranties, and confers no rights.

  • Hi Tom,

    just in case anybody is interested in following topics:
    - Using System.Configuration classes with thelp of Entlib
    - Instrumentation of Enterprise Library
    - Configuration of Application Blocks

    then you can have a look at http://geekswithblogs.net/akraus1/

    Yours,

    Alois Kraus
  • Tom,

    I have a question regarding the Data Access block. How can I reuse a connection object across multiple reads using the Database object?

    I know I can create a transaction and pass it to the Database methods but as I am doing only selects I wand to create a connection open it, perform multiple selects and then close it. In EntLib 1 this was possible.

    Thank you
    Ivan
  • Tom,

    I have a question regarding the Data Access block. How can I reuse a connection object across multiple reads using the Database object?

    I know I can create a transaction and pass it to the Database methods but as I am doing only selects I wand to create a connection open it, perform multiple selects and then close it. In EntLib 1 this was possible.

    Thank you
    Ivan
  • Hi Ivan -

    Although it may seem counterintuitive, in general it is best to open and close a connection with each use. This is because "closing" a connection doesn't really close it at all - it returns the open connection to the connection pool so it can be reused by a different thread.

    That said, if you're not doing anything else between queries, I can imagine it may be more efficient to keep the one connection open. I don't think there's an easy way of doing this with EntLib v2 - but I didn't think it was easy in v1 either. We did rename Database.GetConnection() to Database.CreateConnection() to more accurately reflect its behavior, but IIRC we didn't change what it did.

    Tom
  • Hi Tom,

    Thank you for your comment. EntLib v1 actually had methods where you could pass an open connection.

    I looked at the Database class and created only several overloads in order to be able to pass an open connection. Most of the functionality is actually there and handles the transaction parameter, which comes with an open connection. I could send you the code if you are interested.

    I find this feature useful as sometimes I have to perform several reads from the database with little application logic between them. Using the same open connection speeds the whole operation a lot.

    Regards
    Ivan
Page 1 of 1 (5 items)