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 7688679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:58:46+00:00 2026-05-31T19:58:46+00:00

I am trying to build a cache class using the Ardalis Example http://ardalis.com/introducing-the-cachedrepository-pattern I

  • 0

I am trying to build a cache class using the Ardalis Example http://ardalis.com/introducing-the-cachedrepository-pattern

I am getting the error saying it has zero arguments. I can figure out how to pass the top part.

The cache part of the class has no errors and the base class works

What am i doing wrong in the top part of the respository class. How am i inheriting wrong.

Thank you for any help.

Repository Class with the problem

   public class TweetSearchCache : TweetSearch  
  {
   // SingleUserAuthorizer auth;

    public TweetSearchCache() : base //(SingleUserAuthorizer auth) 
    {



    }

    private static readonly object CacheLockObject = new object();
    public override List<Search>  GetTweets()
   {

        string cacheKey = "GetSearch";



        var result = HttpRuntime.Cache[cacheKey] as List<Search>;

        if (result == null)
        {
            lock (CacheLockObject)
            {
                result = HttpRuntime.Cache[cacheKey] as List<Search>;

                if (result == null)
                {

                    result = base.GetTweets().ToList();                                            

                    HttpRuntime.Cache.Insert(cacheKey, result, null,

                  DateTime.Now.AddMinutes(2), TimeSpan.Zero);

                }

            }
        }


        return result;



    }

  }

Base Class

    public class TweetSearch
    {
     private readonly SingleUserAuthorizer _auth;

      public TweetSearch(SingleUserAuthorizer auth)
    {
        _auth = auth;
    }


    public virtual List<Search> GetTweets()
    {
        string hashTerm = "#searchterm";

        string rejectedWords = "Searchterm";


        using (var twitterCtx = new TwitterContext(_auth))
        {
            var queryResults = (from search in twitterCtx.Search
                                where search.Type == SearchType.Search &&
                                      search.Hashtag == hashTerm ||
                                    //   search.Query == twitQuery ||
                                    //   search.WordPhrase == twitPhrase ||
                                      search.WordNot == rejectedWords &&

                                      search.ShowUser == true &&
                                      search.IncludeEntities == true &&
                                      search.Locale == "EN" &&
                                       search.PageSize == 100
                                select search).ToList();

            return queryResults;//.ToList();
        }



    }
  • 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-05-31T19:58:47+00:00Added an answer on May 31, 2026 at 7:58 pm

    You should probably read more about basic C# syntax. The argument can either come from an argument in the derived constructor, or you can build it using a static field, property or method. The first example shows the base argument coming from the derived constructor. The second example shows the use of a static method.

    public TweetSearchCache(SingleUserAuthorizer auth) : base(auth) {
    // ...
    }
    

    Or

    public TweetSearchCache() : base(CreateAuth()) {
    // ...
    }
    
    public static SingleUserAuthorizer CreateAuth() {
        SingleUserAuthorizer createdAuth = ...
        // ...
        return createdAuth;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build a simple abstract Cache class that can enforce methods
Trying to cache an xml file using the build in wordpress function called get_transient
Im trying to build call to action button on my site using jQuery. I
I'm trying to build a system using jqgrid which does everything on the clientside,
Hi I'm trying to implement jquery token input according to railscasts #258 http://railscasts.com/episodes/258-token-fields Where
I'm trying to use hibernate to build up a local cache of data that
I am trying to build an iPhone web application using ASP.NET. The page is
Trying to configure TeamCity to build our project, I'm having trouble getting the git
I am trying to build the documentation for my application using Sandcastle Help File
I'm trying build a method which returns the shortest path from one node to

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.