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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:07:08+00:00 2026-06-08T14:07:08+00:00

GlobalCache is declared in a website and I am creating another object in the

  • 0

GlobalCache is declared in a website and I am creating another object in the business layer which needs to call a method on GlobalCache. Since both reference a “Contract” assembly of interfaces, my first thought was to define IGlobalCache in “Contract” and use Ninject to instantiate IGlobalCache in the business layer to call the method.

The problem is that the method is static and you can’t declare static methods in an interface. How else can you call a static method from an assembly that has no knowledge of the type the method belongs to?

  • 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-08T14:07:10+00:00Added an answer on June 8, 2026 at 2:07 pm

    You could create an interface with that method (non-static obviously) and create an implementation of this interface in an assembly that knows of the class with the static method. This implementation simply delegates to the class with the static method.

    In Assembly A (Contracts):

    public interface IGlobalCache
    {
        void Foo();
    }
    

    In Assembly B (Business):

    class FooBar
    {
        public FooBar(IGlobalCache globalCache) { /*...*/ } // dependency injection
    }
    

    In Assembly C:

    class GlobalCacheImpl : IGlobalCache
    {
        public void Foo()
        {
            GlobalCache.FooStatic();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With Play 1.0 we had the session.getId() method to retrieve a unique session identifier.
I have a particular PHP page that, for various reasons, needs to save ~200
so I made an app which communicates with JSON on the web. It fetches
// Global cache of images. // Using SoftReference to allow garbage collector to clean
I've been trying to tinker with a global Cache module, but I can't figure
Question about how AppFabric's cache feature can be used. I apologize for asking a
I would like to use a class and its class variables as a global
I have a class called cache. It is an generic, abstract class responsible for
So I have a custom subclass of OrmLiteSqliteOpenHelper . I want to use the
What I want is to access current HttpServlerRequest + HttpServletResponse + HttpSession + some

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.