Home  /  Questions  /  Question

60   95.3
Mar 07, 2011

Best Pattern for DAO

What is the best pattern for the DAO?  Is it best to create an Abstract Factory that returns an abstract DB connection object for instance?  Everybody seems to have different opinions... 

1,364   100.0
Mar 08, 2011
I would prefer to go with Enterprise data block from P&P as most of the plumbing code is done there and extend my apps further. 

But to answer your question , if you are building a DAO from scratch then you will find yourself moving towards Abstract Factory to take care of multiple providers and multiple return types.

You may also have a look at the Provider model which is a combination of multiple patterns and implement your own DAL using this....


Also, now Entity Framework (which again is based on a combination of basic patterns) is available which is a good option as well.  So, you see, there cannot be one answer :).