Does anyone know if it possible to do a VirtualRoleProvider (or the likes) which creates more than a single virtual role? Say, I wanted to create a number of roles based on a table in SQL server?
I believe it must be a pretty common scenario.
I think you need to create one for each role, but you could make your own RoleProvider and add roles there
Thank you for the answer.
You're right - It is possible to extend the membership- and role provider to obtain the same functionaliy. But I'm just puzzled by the fact that this is not possible with the VirtualRoleProvider, it being based on the Provider model!?! Anyways, shouln't it at least be possible to plug in at the same place?
The Virtual Role only gets its name through configuration. Each configuration element can only support one role name, but you can certainly add the same type reference multiple times with different names. If in your role you implement the Initialize method you'll get the name-value pairs of the config so you can find out what role name has been configured for the instance. Or add your own extra configuration (decompile the EPiServer.Security.UserMappedRole for inspiration).