VisitorGroupRole.GetRepository(); obsolete

Vote:
 

Hi.

I'm looking at some documentation regarding Improve testability and support for rapid releases without breaking changes: http://world.episerver.com/documentation/Release-Notes/ReleaseNote/?releaseNoteId=CMS-3446

When using 

VisitorGroupRole.GetRepository();

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?

#154814
Aug 30, 2016 13:33
Vote:
 

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.

#154819
Aug 30, 2016 16:15
Vote:
 

Thanks for clarifying, Per.

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

#154824
Aug 30, 2016 17:54
Vote:
 

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,

Ben 

#187516
Jan 24, 2018 23:18
* 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.