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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:31:28+00:00 2026-05-23T03:31:28+00:00

So in my current code i’m working on some sort of notification manager. The

  • 0

So in my current code i’m working on some sort of notification manager.

The idea is that my main BL will use this notification manager per method call. Hence there will probably only be one notification manager (singleton in unity i guess).

When you use the notification manager you can send a notification via SMS\Email\Other. what actually happens is that the notification manager resolves a “INotificationProvidor” which also resides in unity container. This resolve is done by name as in “SMS”, “Email”, “Other”.

Here is a little code snippet:

var notificationProvidor =
    m_Container.Resolve<INotificationProvidor<TResult>>(
        typeOfNotification.ToString());

ResultMessage<TResult> notificationResult = notificationProvidor
    .SendNotification(source, destination, message, subject);

As you can see the notification manager holds an instance of the container to resolve each one of the “INotificationProvidor”s.

How can i possible remove this need of holding the container in the notification manager? with the following restrictions:

  • Not all types of “INotificationProvidor”‘s (SMS,email,other) might be registered in the container.
  • There will be only one notification manager. (since BL using it will be alive during the course of the application and would receive it from DI)

In short…resolving dependency per method call. 🙂

  • 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-23T03:31:28+00:00Added an answer on May 23, 2026 at 3:31 am

    I suggest the only way to do it is to use some sort of factory, to resolve INotificationProvider instead of Unity container, in any case you have to hold a reference to something, that will resolve dependencies in runtime.

    Here’s the factory’s interface:

    interface IProvidersResolver 
    {
        INotificationProvider<TNotification> Resolve<TNotification>();
    }
    

    That’s how you can use it in NotificationManager:

    // here you hold the reference to the resolver
    private IProvidersResolver _resolver;
    
    // here you use injected factory to resolve INotificationProvider
    void UseResolver()
    {
        INotificationProvider<SomeNotification> provider = _resolver.Resole<SomeNotification>();
    }
    

    So you hold a reference to IProviderResolver (the factory) only. This is the common practice. Alternatively you can:

    1. instantiate NotificationManager for every INotificationProvider<TNotification>
    2. pass a reference to the container into NotificationManager
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My current code that i use is this: <script type=text/javascript> $(document).ready(function(){ $('#on_holiday').trigger('click'); }); </script>
This question is related to a previous question of mine That's my current code
foreach(var someDisposableObject in listOfDisposableObjects) { //some code someDisposableObject.Dispose(); //current code contains something like this.
This is my current code that does a MultiField Query ''# Variables used by
Current code that isn't working attachments[contact.vcf] = {:content=> card.to_s} mail(:to =>card.email, :subject =>Test) Example
My current code is this $swift = email::connect(); $swift->setSubject('hello') ->setFrom(array('alex@example.com.au' => 'Alex')) ->setTo(array('alex@example.com.au' =>
I am having a bit of difficulty with this current code I have set
this is my current code $('ul#attachmentlist>li').last().after(<li>new item on list</li>); $('ul#attachmentlist>li').last().effect(highlight, {}, 2000); what i
My current code is this: int volume = Alert.getVolume(); // reads 100 Alert.setVolume(0); It
I have the current code that readings a text file into memory: std::streampos fsize

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.