Click here to Skip to main content
15,914,162 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two projects [Main Project, Data Access Project] in one solution [LDM].

Main Project Contains Pages, scripts, images, etc.

Data Access Project Contains only Data Base operations.

I need to access HttpRuntime.Cache in Data Access Project.

How can i do that??
Posted
Comments
_ProgProg_ 24-Mar-14 6:00am    
Any Ideas??

Fully qualify it,
C#
System.Web.HttpRuntime.Cache
However, I would strongly suggest you pass in the values you need from the web app. If you access it from your data access layer then your data access layer cannot be reused outside of a system hosted by IIS. It's better to pass the values in.
 
Share this answer
 
You don't. The reason is quite simple and you said it yourself. The DataAccess project is responsible SOLELY for access to the database. The Http.Cache is part of the UI and, hence, the DataAccess project shouldn't have ANY access to the Cache at all, nor should it care.

Why? Well, for starters, if you wanted to use the DataAccess project in a WPF app or a WinForms app or a Windows Store app, you've tied your DataAccess project to having access to a HTTP.Cache that doesn't exist in those types of projects so you can't reuse your DataAccess code in other kinds of applications.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900