Vivek Chandraprakash
Vivek Chandraprakash

Reputation: 1163

Enterprise Library question

what is the difference between the below two statements? which one is more efficient?

Database db = EnterpriseLibraryContainer.Current.GetInstance("QuickStarts Instance");

Database db = DatabaseFactory.CreateDatabase();

Upvotes: 1

Views: 272

Answers (1)

Chris Tavares
Chris Tavares

Reputation: 30411

They are functionally identical. DatabaseFactory just turns around and calls the first line.

The DatabaseFactory is part of the older API based around static facades that Entlib is moving away from. The call to EnterpriseLibraryContainer is more future proof, and it has the advantage of being a single entry point that works regardless of which block you're using.

Upvotes: 1

Related Questions