Override registrations in SimpleContainer/WP7

Topics: Bootstrappers & IoC
Jan 3, 2012 at 12:34 AM

How do I register my own customized core services? For instance, how do I register my own INavigationService, one that extends FrameAdapter?

When I try to register my own instance, I'm getting dups in the container, and a nice crash here:


        /// <summary>
        ///   Requests an instance.
        /// </summary>
        /// <param name = "service">The service.</param>
        /// <param name = "key">The key.</param>
        /// <returns>The instance, or null if a handler is not found.</returns>
        public object GetInstance(Type service, string key) {
            var entry = GetEntry(service, key);
            if(entry != null) {
                return entry.Single()(this);


Jan 3, 2012 at 1:36 PM

As of changeset c39225e8d285 I have enabled the phone container to detect whether a pre-existing instance of a service is in the container. If found, the default service will not be registered. In order to register your custom service, you should register it before calling PhoneContainer.RegisterPhoneServices()

Jan 3, 2012 at 2:57 PM

Fantastic Rob, thanks!