November Happy Hour will be moved to Thursday December 5th.

ILanguageBranchRepository.ListAll(), how to use it?

Vote:
 

I just upgraded a cms 6 r2 site to cms 7 and im having some troubles with using the old code "LanguageBranch.ListAll()". The obsolete information says to use ILanguageBranchRepository.ListAll() instead, but that of course won't work. So how am I suppose to use this method? If I made a LanguageBranchRepository object i could call lbr.ListAll but I don't know how to work with the objects that the constructor expects or if making a new object of LanguageBranchRepository that way really is the most efficient way.

The constructor expects a ServiceAccessor<LanguageBranchDB> and LocalizationService object.


Any help apreachiated. I feel that I've had many obsolete calls which always suggest IInterface.Method() which wont work.

#74493
Aug 29, 2013 13:57
Vote:
 

Hi, I think you should get the instance like this:

var repository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<ILanguageBranchRepository>();
var result = repository.ListAll();

    

#74500
Aug 29, 2013 19:06
Vote:
 

Thank you!

#74540
Aug 30, 2013 16:31
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.