Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7872307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:09:53+00:00 2026-06-03T02:09:53+00:00

I actively use caching in my ASP.NET web site. Though, some objects requested from

  • 0

I actively use caching in my ASP.NET web site.

Though, some objects requested from db are really absent. For instance, I’m checking if there is a Discount for the particular product by looking record with ProductId=@ProductId in ProductsDiscount table. Absence of the record means no discount.

Do you think it is a good idea to put null discount objects into Cache?

Or I would better invent something better (using null-object pattern, for instance). In fact, I don’t really like idea to start using null-object pattern as it will require a lot of redesign that I would like to avoid at least right now.

Thanks. Any thoughts are welcome.

P.S. In fact, I can’t even put null object into Cache, when I try to call:

HttpContext.Current.Cache.Insert("name...", null);

i receive:

Value cannot be null.

P.P.S. Why MSDN tells nothing about this behavior?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:09:54+00:00Added an answer on June 3, 2026 at 2:09 am

    For your case, you could use DBNull.Value as the ‘no data’ marker:

    HttpContext.Current.Cache.Insert("name...", DBNull.Value);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So recently I've really started to use php actively, and I need some insights
I am .Net programmer who is looking to branch out and possibly use some
We have some devs on Android part of our application who actively use prefixing
I have a simple question: Would you rather use a plugin that is actively
Okay so I've noticed that even though I use the correct path for the
I'm trying to use a select list to actively filter the results I get
I'm currently evaluating the use of ADO.NET for a C++ application that currently uses
I just implemented a simple WCF server using net.tcp . First, I use 127.0.0.1
Currently, I have a system that actively generates the pages on my site using
I m trying to use smtp class from Python 2.6.4 to send smtp email

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.