VisitorGroupRole.GetRepository(); obsolete



I'm looking at some documentation regarding Improve testability and support for rapid releases without breaking changes:

When using 


It says that I should use IVisitorGroupRoleRepository instead. However, this interface doesn't expose a GetAll method, which we are using.

I've seen a List function in IVisitorGroupRepository, but is this the same as the old function? Also, what is the difference between a visitor group role and a visitor group?

Aug 30, 2016 13:33

When a visitor group is saved using the repository (IVisitorGroupRepository) it is registered in the system as a "role", the runtime representation if you will. The reason is that it can hook into the security system and become a "virtual role".

Anyhow, if you just want a list of visitor groups you can go directly to the source and use IVisitorGroupRepository.List.

I will report a bug that we should update the obsolete message.

Aug 30, 2016 16:15

Thanks for clarifying, Per.

Are you saying using IVisitorGroupRepository.List(), I will get the same result as VisitorGroupRole.GetRepository().GetAllRoles()?

Aug 30, 2016 17:54

I'm running into this issue while upgrading from 9 to 11 and getting the obsolete method warning 

CS0618 'VisitorGroupRole.GetRepository()' is obsolete: 'Get IVisitorGroupRoleRepository/IVisitorGroupRepository from the IOC container.'

 IVisitorGroupRepository.List() does not return the same type as VisitorGroupRole.GetRepository().GetAllRoles()... (IEnumerable<VisitorGroup> vs IEnumerable<string>)

Do any of the EPiServer guys know how this should be done yet? I imagine this will be breaking in v12.

Thanks in advance,


Jan 24, 2018 23:18

Was there ever an answer to this?

Could it be possible to create the IEnumerable<string> from the IEnumerable<VisitorGroup> if there string was the VisitorGroup name?

Apr 15, 2020 15:00
* 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.