Last post Feb 10, 2010 07:53 AM by aquaren
Feb 08, 2010 04:52 AM|Ich|LINK
this is a question regarding the correct strategy. My scenario: We have several web applications retrieving parameters from a MS SQL database. Normally these values do not change too often, so it's save to cache them instead of querying the database again
and again. We already have 2 different DLLs: Web.DLL and SQL.DLL. Web.DLL contains some features reusable for our web applications. SQL.DLL contains some procedures for easier usage of Enterprise Library.
Now the new function seems to need both: Access to SQL and then to the Web.Cache. But where should I store the procedure now? SQL.DLL normally does not need web.dll (as we also have some windows applications), and web.dll does not necessarily need the SQL.DLL
(even though in most cases our web apps also use the SQL.DLL). Currently I have it in the Web.DLL but I'm not too happy having a reference to SQL.DLL there. And in my mind the procedure would more belong to SQL.DLL than to Web.DLL. (Searching the Procedure
I often check the SQL.DLL first and wonder where it has gone....).Or why should my console application access web.dll to retrieve a parameter from SQL Database??!
Another way might be of course the split, so my web app first retrieves the value and then adds it to the cache on it's own. But i want to have this as easy as possible. Otherwise one might forget to cache and the value is retrieved again and again.
Any ideas for a best practice?Many thanks!
Feb 08, 2010 08:19 AM|Aquaren|LINK
All things web should stay in the Web.dll. All things SQL should stay in the SQL.dll. You really should not have a situation where a single method needs to use both, but if you do, one option would be to to create a service layer (Service.dll) that has references
Feb 10, 2010 03:48 AM|Ich|LINK
thats too easy.... Could have found this on my own.... Many thanks for your answer and the link!!
Feb 10, 2010 07:53 AM|Aquaren|LINK
Sometimes we can lose perspective when we work on a code base for an extended period of time. I'm glad I could help you out.