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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:19:29+00:00 2026-06-14T21:19:29+00:00

On a project I’m working on I’m trying to develop a generic mechanism for

  • 0

On a project I’m working on I’m trying to develop a generic mechanism for sending back messages from anywhere in the code base to the front end for possible logging, displaying to the user etc.

Messages could be sent because of an error/exception, to report progress etc. Initially I thought of using something like log4net to report the message data and have a custom appender at the application level to consume these messages and then display them/log them as appropriate. However I’m not sure that this is the best approach because of a couple of issues

1) The project is split across a number of separate assemblies and I’ve seen that there are issues with configuration of log4net across multiple dlls.

2) This messaging scheme is more than just logging, so using a logging framework may be too restrictive.

At the moment I’m using C# custom message events to send data from assemblies and registering a handler at the application level to capture them.

However I’ve realized that the the Messenger class in MVVMLight is exactly what I’m looking for, a way to send a generic data packet (class) across assemblies. But because I could be sending messages from model code I’m wondering if this is adding unnecessarily dependencies to MVVMLight in to the model code.

My impression is that the Model code should be as dependency free as possible so that it could be dropped into any application framework without modifications.

What do you guys think?

  • 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-14T21:19:30+00:00Added an answer on June 14, 2026 at 9:19 pm

    If that’s what you’re trying to do then you should use the Messenger class.

    How likely is it (really) that the model code is going to be used by another application? If it’s something generic (user preferences, security, etc) then you might want to use it elsewhere but if you’re providing bespoke business data then YAGNI.

    From a good practices perspective I’d suggest doing something like this:

    public interface IMessenger<T>
    {
        public void Send(T message);
    }
    
    public class MessengerProxy:IMessenger<ErrorDto>
    {
        public void Send(ErrorDto error)
        {
            Messenger.Default.Send(error);
        }
    }
    
    public class AnotherModel
    {
        public AnotherModel(IMessenger<ErrorDto> errorRegister)
        {
            _errorRegister=errorRegister;
        }
    
        private RegisterError(Exception ex)
        {
          var dto=new ErrorDto(ex,"My Title");
          _errorRegister.Send(dto);
        }
    }
    

    Register the MessengerProxy in MVVM Light and have it injected into the constructor of your Model classes. In my model class, above, I inject the interface into the constructor. This gives me access to the Messenger but allows me to change the underlying implementation if I need to later on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The project that I am working on (Node.js) implies lots of operations with the
This project was coped almost exacatly from the example on the admob page but
Project: http://development.legendarylion.com/ Website in development. Trying to get a .png to show up over
Project I'm working on uses jQuery. I have a series of Ajax calls being
Project file here if you want to download: http://files.me.com/knyck2/918odc So I am working on
Project is C#. So I have a bunch of multithreaded code that is designed
Current project is an Mvc4 application, I had Ioc working and recently it just
The project i am working at right now requires some declarative way of defining
My project demands and upgrade from groovy 1.7.2 to 1.8.x stable release, there are
Project Lombok makes it trivial to implement the boilerplate code in the classes. Is

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.