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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:50:25+00:00 2026-05-20T01:50:25+00:00

I am using PRISM 4 and got my head around almost all features, however

  • 0

I am using PRISM 4 and got my head around almost all features, however as soon as I would like to inject my DomainContext class (RIA) into my view model, the hell breaks loose. 🙂 It would be great if an experienced Unity/Prism developer could give me an advice how to proceed.

Within my bootstrapper, I am registering the required class in Unity Container like this:

protected override void ConfigureContainer()
        {
            base.ConfigureContainer();
            Container.RegisterType<SCMDomainContext>();
        }

Within the NavigationModule, I have the following in the ctor to register the NavigationView with a particular region.

public NavigationModule(IUnityContainer container, IRegionManager regionManager)
        {
            _container = container;
            _regionManager = regionManager;

            _regionManager.RegisterViewWithRegion(Constants.NavRegion, () => _container.Resolve<NavigationView>());

        }

The View takes the View Model as dependency:

 public NavigationView(NavigationViewModel viewModel)
        {
            InitializeComponent();

            Loaded += (s, e) =>
                          {
                              DataContext = viewModel;
                          };            
        }

The ViewModel has the following:

public NavigationViewModel(SCMDomainContext context)
        {
            _context = context;
            ConstructCommon();
        }

As soon as I comment this ctor out and put a en empty ctor, it is all fine, for some reason I can’t resolve the SCMDomainContext class. Which is the one you add to have the Domain Context created for you provided by Ria Services.

Since I am using Silverlight, I can’t see the stack trace to follow the exception, all I get is this message on a page. What am I missing please?

Microsoft JScript runtime error: Unhandled Error in Silverlight Application An exception occurred while initializing module 'NavigationModule'. 
    - The exception message was: Activation error occured while trying to get instance of type NavigationModule, key ''
    Check the InnerException property of the exception for more information. If the exception occurred 
    while creating an object in a DI container, you can exception.GetRootException() to help locate the 
    root cause of the problem.    at Microsoft.Practices.Prism.Modularity.ModuleInitializer.HandleModuleInitializationError(ModuleInfo moduleInfo, String assemblyName, Exception exception)
   at Microsoft.Practices.Prism.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
   at Microsoft.Practices.Prism.Modularity.ModuleManager.LoadModulesThatAreReadyForLoad()
   at Microsoft.Practices.Prism.Modularity.ModuleManager.IModuleTypeLoader_LoadModuleCompleted(Object sender, LoadModuleCompletedEventArgs e)
   at Microsoft.Practices.Prism.Modularity.XapModuleTypeLoader.RaiseLoadModuleCompleted(LoadModuleCompletedEventArgs e)
   at Microsoft.Practices.Prism.Modularity.XapModuleTypeLoader.HandleModuleDownloaded(DownloadCompletedEventArgs e)
   at Microsoft.Practices.Prism.Modularity.XapModuleTypeLoader.IFileDownloader_DownloadCompleted(Object sender, DownloadCompletedEventArgs e)
   at Microsoft.Practices.Prism.Modularity.FileDownloader.WebClient_OpenReadCompleted(Object sender, OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OpenReadOperationCompleted(Object arg)

Your help on this is highly appreciated,
Kave

  • 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-20T01:50:26+00:00Added an answer on May 20, 2026 at 1:50 am

    In fact its best to create a layer for the DomainContext like this. Then its easily resolvable by an IoC:

    public class ContactModuleService : IContactModuleService
        {
            readonly SCMDomainContext _context = new SCMDomainContext();
    
            #region Implementation of IContactModuleService
    
            public EntitySet<Contact> Contacts
            {
                get { return _context.Contacts; }
            }
    
            public EntityQuery<Contact> GetContactsQuery()
            {
                return _context.GetContactsQuery();
            }
    
            public SubmitOperation SubmitChanges(Action<SubmitOperation> callback, object userState)
            {
                return _context.SubmitChanges(callback, userState);
            }
    
            public SubmitOperation SubmitChanges()
            {
                return _context.SubmitChanges();
            }
    
            public LoadOperation<TEntity> Load<TEntity>(EntityQuery<TEntity> query, Action<LoadOperation<TEntity>> callback, object userState) where TEntity : Entity
            {
                return _context.Load(query, callback, userState);
            }
    
            public LoadOperation<TEntity> Load<TEntity>(EntityQuery<TEntity> query) where TEntity : Entity
            {
                return _context.Load(query);
            }
    
            #endregion
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got this Silverlight Prism application that is using MVVM. The model calls a
I'm using prism and SL3, as soon as I drop a DataForm Control in
I'm using Prism and the Unity IoC container that comes along with Prism. However,
In a c# assembly I've got a global prism CompositeCommand to subscribe to like
I'm looking at using CompositeWPF ( http://www.codeplex.com/CompositeWPF ) - aka Prism, to build an
Using C#, I need a class called User that has a username, password, active
when using PRISM the normal way to hookup things with unity is to define
Does anyone know of WPF code examples using Prism in which modules each register
I've got a collection of ViewModels that are rendered as tabs using a style
I am creating an application using WPF which is using Prism framework. I have

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.