locked
Where to store function RRS feed

  • Question

  • User-1397164318 posted

    Hi all,

    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!

    Monday, February 8, 2010 4:52 AM

Answers

  • User559104930 posted

    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 to both.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 8, 2010 8:19 AM

All replies

  • User559104930 posted

    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 to both.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 8, 2010 8:19 AM
  • User-1397164318 posted

    Hi Aquaren,

    thats too easy.... Embarassed Could have found this on my own.... Many thanks for your answer and the link!!

    Wednesday, February 10, 2010 3:48 AM
  • User559104930 posted

    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.

    Wednesday, February 10, 2010 7:53 AM