Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

No default Instance is registered and cannot be automatically determined for type....

Vote:
 

hi all, am trying to implement multiple languages for my project. 

so am following this article http://jondjones.com/creating-a-multi-language-picker-in-episerver/.

when i am implemented code like above am getting error. the error is 

No default Instance is registered and cannot be automatically determined for type 'EPiServerSites.Business.ContentRepository.IContentRepositoryFactory'

There is no configuration specified for EPiServerSites.Business.ContentRepository.IContentRepositoryFactory

1.) new EpiServerDependencies(*Default of IContentRepositoryFactory*, *Default of ILinkResolverFactory*, *Default of IContextResolverFactory*)
2.) EPiServerSites.Business.EpiServerDependencies
3.) Instance of EPiServerSites.Business.EpiServerDependencies
4.) Container.GetInstance(EPiServerSites.Business.EpiServerDependencies)

 am getting this error at BaseBlockController.

am using StructureMapDependencyResolver which is came predefind.

and both class files are below.

namespace EPiServerSites.Business.ContentRepository
{
    
    public interface IContentRepositoryFactory
    {
        IContentRepository GetContentRepository();
    }
}


namespace EPiServerSites.Business.ContentRepository
{
    public class ContentRepositoryFactory : IContentRepositoryFactory
    {
       

        internal Injected ContentRepositoryService;

        public IContentRepository GetContentRepository()
        {
            return ContentRepositoryService.Service;
        }
    }
}



Base block controller is 




 public abstract class BaseBlockController : BlockController
        where TBlockData : BlockData
    {
        private Injected epiServerDependencies;

        private Injected routeHelper;

        [DefaultConstructor]
        public BaseBlockController()
        {
        }

        protected PageData CurrentPage
        {
            get
            {
                return routeHelper.Service.Page;
            }
        }

        protected EpiServerDependencies EpiServerDependencies
        {
            get
            {

                var value = epiServerDependencies.Service;
                value.CurrentPage = CurrentPage;

                return value;
            }
        }
    }
#175151
Edited, Feb 14, 2017 8:09
Vote:
 

It seems to me that you forgot to register your class for your interface. Some attribute like this is needed:

    [ServiceConfiguration(ServiceType = typeof(IContentRepositoryFactory))]

    public class ContentRepositoryFactory : IContentRepositoryFactory
#175163
Feb 14, 2017 10:53
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.