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

  • SEARCH
  • Home
  • 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 7578839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:31:31+00:00 2026-05-30T17:31:31+00:00

in a classic Passive-MVP pattern, how can i avoid a reference of the presenter

  • 0

in a classic Passive-MVP pattern, how can i avoid a reference of the presenter in my view completely & still inject the presenter instance which needs the view instance as a parameter.

with asp.net as an example:

  • my implemented views (web project) should not have a reference to the Presenters. (Neither IPresenter nor the concrete ones)
  • when the view instantiates, (basically my web page), the presenter should be instantiated with the current view’s reference.
  • i am using unity as my ioc container.

right now what i do in the web page’s code behind is this:

public partial class SomePage : MyBasePage, ISomeView
{
    private readonly ISomePresenter presenter;

    public SomePage()
    {
        this.presenter = ResolveSomeWay(this);
    }
}

for this i have a reference of the ‘Presenter Contracts DLL’ in my view implementation. is there a way to avoid this reference completely & still hook up the presenter with the view instance, when the view instantiates?

i just care about the presenter instantiation, since the presenter’s constructor can set the passed parameter-view-instance to its View Property & it subscribes to the view’s events, for any future communication.

thanks folks for your time.

  • 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-30T17:31:32+00:00Added an answer on May 30, 2026 at 5:31 pm

    You could “publish” a new View was instantiated to a Message Bus, to which a Presenter factory could “bind” the instantiated View to a Presenter. Although the View would be agnostic of the presenter, it would not be of the Message Bus.

    public partial class SomePage : MyBasePage, ISomeView
    {
        // Alternative #1
        public SomePage(IMessageBus messageBus)
        {
            // You publish a message saying that a handler for ISomeView is to handle the
            // message.
            messageBus.Publish<ISomeView>(this);
        }
        // Alternative #2
        public SomePage()
        {
            Resolver.Resolve<IMessageBus>().Publish<ISomeView>(this);
        }
    }
    
    // This could be somewhere else in your application (this could be a separate DLL), but 
    // I will use the Global.asax.cs here, for simplicity
    public void Application_Start()
    {
        Container.Resolve<IMessageBus>()
                 .Subscribe<ISomeView>(someView => 
                     {
                        var presenter = new SomePresenter(someView);
                     });
    }
    
    public interface ISomeView {
        event Action<ISomeView> SomeEvent;
    }
    
    public class SomePresenter
    {
        public SomePresenter(ISomeView view) {
            // if you attach the presenter to the View event, 
            // the Garbage Collector won't finalize the Presenter until
            // the View is finalized too
            view.SomeEvent += SomeEventHandler;
        }
    
        private void SomeEventHandler(ISomeView view) { 
           // handle the event
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In classic ASP.NET Web Forms view engine, we can set the ContentType in the
The classic Fisher Yates looks something like this: void shuffle1(std::vector<int>& vec) { int n
In classic MVC the model notifies the view about changes made on it. In
In classic ASP (which I am forced to use), I have a few factory
Classic producer-consumer-problem. I have x app servers which write records in a DB table
I have this classic ASP site which has been working fine until we updated
In Classic ASP, how can I get a true or false value indicating that
We have an ASP Classic website running on Windows Server 2003 and IIS6 which
Classic database table design would include an tableId int index(1,1) not null which results
Using the classic code snippet: if (x & (x-1)) == 0 If the answer

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.